Changeset 12277 for trunk/FACT++/src/Fits.cc
- Timestamp:
- 10/26/11 11:41:42 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Fits.cc
r12035 r12277 56 56 //! @param dataPointer the memory location where the DIM data starts 57 57 //! @param numDataBytes the number of bytes taken by the DIM data. 58 //! @param out Message object to use for propagating messages 58 59 // 59 void Fits::InitDataColumns(const vector<Description> &desc, const vector<string>& dataFormat, void* dataPointer )60 void Fits::InitDataColumns(const vector<Description> &desc, const vector<string>& dataFormat, void* dataPointer, MessageImp* out) 60 61 { 61 62 fDataFormats = dataFormat; … … 63 64 64 65 //we will copy this information here. It duplicates the data, which is not great, but it is the easiest way of doing it right now 65 if (desc.size() == dataFormat.size()) 66 { 67 fDataColDesc = desc; 66 if ((desc.size() == dataFormat.size()+1) || //regular service 67 (desc.size() == dataFormat.size()+2))//service with ending string. skipped in fits 68 {//services have one (or two) more description than columns. skip the first entry while copying as it describes the table itself. 69 fDataColDesc.clear(); 70 for (unsigned int i=0;i<dataFormat.size(); i++) 71 { 72 string name = desc[i+1].name; 73 if (name.length() > 68) name = name.substr(0, 68); 74 string comment = desc[i+1].comment; 75 if (comment.length() > 68) comment = comment.substr(0,68); 76 string unit = desc[i+1].unit; 77 if (unit.length() > 68) unit = comment.substr(0,68); 78 fDataColDesc.push_back(Description(name, comment, unit)); 79 } 68 80 return; 69 81 } 70 82 83 {//if we arrived here, this means that the columns descriptions could not be parsed 84 ostringstream str; 85 str << "Expected " << dataFormat.size() << " descriptions of columns, got " << desc.size()-1 << " for service: "; 86 if (desc.size() > 0) 87 str << desc[0].name; 88 else 89 str << "<unknown>"; 90 91 out->Warn(str.str()); 92 } 93 71 94 fDataColDesc.clear(); 95 // fDataColDesc.push_back(Description("service", "comment", "unit")); 72 96 for (unsigned int i=0;i<dataFormat.size();i++) 73 97 { … … 133 157 name = stt.str(); 134 158 } 135 159 //cout << endl << "#####adding column: " << name << " " << fDataFormats[i] << " " << fDataColDesc[i].unit << endl << endl; 136 160 fFile->AddColumn(name, fDataFormats[i], fDataColDesc[i].unit); 137 161 } … … 249 273 fFile->WriteKeyNT("TSTART", Time(doubleValue).Iso(), 250 274 "Time of the first received data"); 275 fFile->WriteKeyNT("TSTOP", Time(fEndMjD).Iso(), 276 "Time of the last receied data"); 251 277 } 252 278 fEndMjD = *reinterpret_cast<double*>(fStandardPointers[0]);
Note:
See TracChangeset
for help on using the changeset viewer.