Changeset 12443 for trunk/FACT++/src


Ignore:
Timestamp:
11/07/11 04:43:15 (13 years ago)
Author:
lyard
Message:
added comments into fits files
Location:
trunk/FACT++/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/Fits.cc

    r12422 r12443  
    6868    {//services have one (or two) more description than columns. skip the first entry while copying as it describes the table itself.
    6969        fDataColDesc.clear();
     70        fTableDesc = desc[0].comment;
     71        if (fTableDesc.size() > 68)
     72        {
     73            out->Warn("Table description \"" + fTableDesc + "\" too long. truncating it (68 char max.)");
     74            fTableDesc = fTableDesc.substr(0,68);
     75        }
    7076        for (unsigned int i=0;i<dataFormat.size(); i++)
    7177        {
    7278            string name = desc[i+1].name;
    73             if (name.length() > 68) name = name.substr(0, 68);
     79            if (name.length() > 68)
     80            {
     81                out->Warn("Column name " + name + "too long. truncating it (68 char max.)");
     82                name = name.substr(0, 68);
     83            }
    7484            string comment = desc[i+1].comment;
    75             if (comment.length() > 68) comment = comment.substr(0,68);
     85            if ((comment.length() + name.length()) > 71)
     86            {
     87                out->Warn("Column " + name + " added to \"" + comment + "\" too long. truncating to fit 68 chars.");
     88                comment = comment.substr(0,68);
     89            }
    7690            string unit = desc[i+1].unit;
    7791            if (unit.length() > 68)  unit = comment.substr(0,68);
     
    170184
    171185        fCopyBuffer.resize(fFile->GetDataSize());
    172 
     186//write header comments
     187        ostringstream str;
     188        for (unsigned int i=0;i<fStandardColDesc.size();i++)
     189        {
     190            str.str("");
     191            str << "TTYPE" << i+1;
     192            fFile->WriteKeyNT(str.str(), fStandardColDesc[i].name, fStandardColDesc[i].comment);
     193            str.str("");
     194            str << "TCOMM" << i+1;
     195            fFile->WriteKeyNT(str.str(), fStandardColDesc[i].comment, "");
     196        }
     197
     198        for (unsigned int i=0; i<fDataColDesc.size(); i++)
     199        {
     200            string name = fDataColDesc[i].name;
     201            if (name.empty())
     202            {
     203                ostringstream stt;
     204                stt << "Data" << i;
     205                name = stt.str();
     206            }
     207            str.str("");
     208            str << "TTYPE" << i+fStandardColDesc.size()+1;
     209            fFile->WriteKeyNT(str.str(), name, fDataColDesc[i].comment);
     210            str.str("");
     211            str << "TCOMM" << i+fStandardColDesc.size()+1;
     212            fFile->WriteKeyNT(str.str(), fDataColDesc[i].comment, "");
     213        }
     214        fFile->WriteKeyNT("COMMENT", fTableDesc, "");
     215        //END COMMENTS UPDATE
    173216        return fFile->GetNumRows()==0 ? true : WriteHeaderKeys();
    174217    }
  • trunk/FACT++/src/Fits.h

    r12277 r12443  
    3333    ///the vector of data column names
    3434    vector<Description> fDataColDesc;
     35    //Description of the table
     36    string fTableDesc;
    3537    ///the data format of the data columns
    3638    vector<string> fDataFormats;
  • trunk/FACT++/src/datalogger.cc

    r12442 r12443  
    806806
    807807     fOpenedNightlyFiles = new DimDescribedService(GetName() + "/FILENAME_NIGHTLY", "I:1;C", fToDim,
    808                                "Path and base name which is used to compile the filenames for the nightly files."
     808                               "Path and base name used for the nightly files."
    809809                               "|Type[int]:type of open files (1=log, 2=rep, 4=fits)"
    810810                               "|Name[string]:path and base file name");
    811811
    812812     fOpenedRunFiles = new DimDescribedService(GetName() + "/FILENAME_RUN", "I:1;C", fToDim,
    813                                "Path and base name which is used to compile the filenames for the run files."
     813                               "Path and base name used for the run files."
    814814                               "|Type[int]:type of open files (1=log, 2=rep, 4=fits)"
    815815                               "|Name[string]:path and base file name");
     
    818818     fNumSubAndFitsData.numOpenFits = 0;
    819819     fNumSubAndFits = new DimDescribedService(GetName() + "/NUM_SUBS", "I:2", fNumSubAndFitsData,
    820                                "Shows number of services to which the data logger is currently subscribed and the total number of open files."
    821                                "|NumSubAndNumOpenFiles[int]:number of dim services to which the data logger is currently subscribed plus number of files currently open by the data logger");
     820                               "Num. open files + num. subscribed services"
     821                               "|NSubAndOpenFiles[int]:Num. of subs and open files");
    822822
    823823     //services parameters
     
    955955void DataLogger::infoHandler()
    956956{
    957     if (!fAutoStarted && fShouldAutoStart)
     957    if ((GetCurrentState() == kSM_Ready) &&  (!fAutoStarted) && fShouldAutoStart)
    958958    {
    959959        fAutoStarted = true;
    960960        SetCurrentState(StartPlease());
     961    }
     962    else {if (GetCurrentState() > kSM_Ready)
     963            fAutoStarted = true;
    961964    }
    962965    DimInfo* I = getInfo();
Note: See TracChangeset for help on using the changeset viewer.