- Timestamp:
- 08/14/12 11:08:45 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/datalogger.cc
r14348 r14364 222 222 223 223 DimWriteStatistics fFilesStats; 224 225 ///map and mutex for storing services description 226 map<string, vector<Description> > fServiceDescriptionList; 227 mutex fMutex; 228 int HandleDescriptions(DimDescriptions* desc); 229 vector<Description> GetDescription(const string& server, const string& service); 224 230 private: 225 231 /*************************************************** … … 378 384 }; //DataLogger 379 385 386 387 /** 388 * @brief the two methods below were copied from StateMachineDimControl.cc 389 * 390 */ 391 int DataLogger::HandleDescriptions(DimDescriptions* desc) 392 { 393 fMutex.lock(); 394 for (auto it=desc->descriptions.begin(); it != desc->descriptions.end(); it++) { 395 if (fDebugIsOn) 396 { 397 Debug("Adding description for service: " + it->front().name); 398 } 399 fServiceDescriptionList[it->front().name].assign(it->begin(), it->end()); 400 } 401 fMutex.unlock(); 402 403 return GetCurrentState(); 404 } 405 vector<Description> DataLogger::GetDescription(const string& server, const string& service) 406 { 407 const lock_guard<mutex> guard(fMutex); 408 const auto it = fServiceDescriptionList.find(server+"/"+service); 409 return it==fServiceDescriptionList.end()?vector<Description>():it->second; 410 } 380 411 // -------------------------------------------------------------------------- 381 412 // … … 442 473 { 443 474 DimDescriptions* d = new DimDescriptions(server); 475 d->SetCallbackDescriptions(bind(&DataLogger::HandleDescriptions, this, d)); 444 476 d->Subscribe(*this); 445 477 fServerDescriptionsList.push_back(d); … … 1190 1222 { 1191 1223 //write text header 1192 header << evt.GetName() << " " << fQuality << " "; 1193 header << cTime.Y() << " " << cTime.M() << " " << cTime.D() << " "; 1194 header << cTime.h() << " " << cTime.m() << " " << cTime.s() << " "; 1195 header << cTime.ms() << " " << evt.GetTime() << " "; 1224 header << sub.server << "_" << sub.service << " " << fQuality << " "; 1225 header << evt.GetTime() << " "; 1196 1226 1197 1227 string text; … … 1241 1271 } 1242 1272 else 1243 {//write entry to both Nightly and run logs1273 {//write entry to Nightly log 1244 1274 vector<string> strings; 1245 1275 try … … 1265 1295 } 1266 1296 ostringstream msg; 1267 msg << evt.GetName()<< ": " << strings[0];1297 msg << sub.server << "_" << sub.service << ": " << strings[0]; 1268 1298 1269 1299 if (fNightlyLogFile.is_open()) … … 1653 1683 str << "Initializing data columns for service " << sub.server << "/" << sub.service; 1654 1684 Info(str); 1655 sub.nightlyFile.InitDataColumns( Description::SplitDescription(evt.GetDescription()), dataFormatsLocal, this);1685 sub.nightlyFile.InitDataColumns(GetDescription(sub.server, sub.service), dataFormatsLocal, this); 1656 1686 1657 1687 sub.fitsBufferAllocated = true;
Note:
See TracChangeset
for help on using the changeset viewer.