Changeset 10895 for trunk/FACT++/src
- Timestamp:
- 06/01/11 10:05:49 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/dataLogger.cc
r10887 r10895 440 440 set<string> fGrouping; 441 441 ///configuration flags 442 bool fHasBlackList;443 bool fHasWhiteList;444 442 bool fDebugIsOn; 445 443 float fStatsPeriodDuration; … … 602 600 bool DataLogger::ShouldSubscribe(const string& server, const string& service) 603 601 { 604 if (service == "SERVICE_LIST") 602 if (fWhiteList.size()>0 && 603 (fWhiteList.find(server + "/") == fWhiteList.end()) && 604 (fWhiteList.find(server + "/" + service) == fWhiteList.end()) && 605 (fWhiteList.find("/" + service) == fWhiteList.end())) 605 606 return false; 606 if (fHasWhiteList && (fWhiteList.find(server + "/") == fWhiteList.end()) && 607 (fWhiteList.find(server + "/" + service) == fWhiteList.end()) && 608 (fWhiteList.find("/" + service) == fWhiteList.end())) 609 return false; 610 if (fHasBlackList && ((fBlackList.find(server + "/") != fBlackList.end()) || 611 (fBlackList.find(server + "/" + service) != fBlackList.end()) || 612 (fBlackList.find("/" + service) != fBlackList.end()))) 607 608 if (((fBlackList.find(server + "/") != fBlackList.end()) || 609 (fBlackList.find(server + "/" + service) != fBlackList.end()) || 610 (fBlackList.find("/" + service) != fBlackList.end()))) 613 611 return false; 614 612 … … 1006 1004 AddEvent(fConfigRunNumber, "I", kSM_Ready, kSM_NightlyOpen, kSM_WaitingRun, kSM_BadRunConfig, kSM_Logging) 1007 1005 (boost::bind(&DataLogger::ConfigureRunNumber, this, _1)) 1008 (" configure the run number. cannot be done in logging state");1006 ("Configure the run number. Cannot be done in logging state"); 1009 1007 1010 1008 //Provide a logging command … … 1056 1054 1057 1055 //black/white list 1058 fHasBlackList = false;1059 fHasWhiteList = false;1060 1056 fBlackList.clear(); 1061 1057 fWhiteList.clear(); … … 1079 1075 AddEvent(fStartStopOpenedFiles, "B:1", kSM_NightlyOpen, kSM_Logging, kSM_WaitingRun, kSM_Ready) 1080 1076 (boost::bind(&DataLogger::SetOpenedFilesOnOff ,this, _1)) 1081 (" Can be used to switch the service offwhich distributes information about the open files.");1077 ("Switch off the service which distributes information about the open files."); 1082 1078 1083 1079 AddEvent(fStartStopNumSubsAndFits, "B:1", kSM_NightlyOpen, kSM_Logging, kSM_WaitingRun, kSM_Ready) 1084 1080 (boost::bind(&DataLogger::SetNumSubsAndFitsOnOff, this, _1)) 1085 (" Can be used to switch the service offwhich distributes information about the number of subscriptions and open files.");1081 ("Switch off the service which distributes information about the number of subscriptions and open files."); 1086 1082 1087 1083 fDestructing = false; … … 1697 1693 Message(" -> "+it2->first); 1698 1694 } 1699 if (fHasBlackList) 1700 { 1701 Message("------------- BLOCK LIST ----------------"); 1702 for (set<string>::iterator it=fBlackList.begin(); it != fBlackList.end(); it++) 1703 Message(*it); 1704 } 1705 if (fHasWhiteList) 1706 { 1707 Message("----------- ALLOW LIST ------------------"); 1708 for (set<string>::iterator it=fWhiteList.begin(); it != fWhiteList.end(); it++) 1709 Message(*it); 1710 } 1711 if (fGrouping.size() != 0) 1712 { 1713 Message("--------- GROUPING LIST -----------------"); 1714 Message("The following servers and/or services will be grouping under a single run fits file:"); 1715 for (set<string>::iterator it=fGrouping.begin(); it != fGrouping.end(); it++) 1716 Message(*it); 1717 } 1695 1696 Message("------------- BLOCK LIST ----------------"); 1697 for (set<string>::iterator it=fBlackList.begin(); it != fBlackList.end(); it++) 1698 Message(*it); 1699 if (fBlackList.size()==0) 1700 Message(" <empty>"); 1701 1702 Message("----------- ALLOW LIST ------------------"); 1703 for (set<string>::iterator it=fWhiteList.begin(); it != fWhiteList.end(); it++) 1704 Message(*it); 1705 if (fWhiteList.size()==0) 1706 Message(" <empty>"); 1707 1708 Message("--------- GROUPING LIST -----------------"); 1709 Message("The following servers and/or services will be grouping under a single run fits file:"); 1710 for (set<string>::iterator it=fGrouping.begin(); it != fGrouping.end(); it++) 1711 Message(*it); 1712 if (fGrouping.size()==0) 1713 Message(" <no grouping>"); 1714 1718 1715 Message("-----------------------------------------"); 1719 1716 Message("------ END OF DATA LOGGER STATE ---------"); … … 2277 2274 groupTable->makeThisCurrent(); 2278 2275 //create appropriate buffer. 2279 unsigned char* fitsBuffer = new unsigned char[8 + 3 + 2*maxCharLength + 1]; //+1 for trailling character 2280 memset(fitsBuffer, 0, 8 + 3 + 2*maxCharLength + 1); 2276 const unsigned int n = 8 + 3 + 2*maxCharLength + 1; //+1 for trailling character 2277 2278 unsigned char* fitsBuffer = new unsigned char[n]; 2279 memset(fitsBuffer, 0, n); 2280 2281 2281 char* startOfExtension = reinterpret_cast<char*>(fitsBuffer); 2282 char* startOfURI = reinterpret_cast<char*>(&fitsBuffer[8]); 2283 char* startOfLocation = reinterpret_cast<char*>(&fitsBuffer[8 + 3]); 2284 char* startOfName = reinterpret_cast<char*>(&fitsBuffer[8+3+maxCharLength]); 2285 2286 sprintf(startOfExtension, "%s", "BINTABLE"); 2287 sprintf(startOfURI, "%s", "URL"); 2282 char* startOfURI = reinterpret_cast<char*>(&fitsBuffer[8]); 2283 char* startOfLocation = reinterpret_cast<char*>(&fitsBuffer[8 + 3]); 2284 char* startOfName = reinterpret_cast<char*>(&fitsBuffer[8+3+maxCharLength]); 2285 2286 strcpy(startOfExtension, "BINTABLE"); 2287 strcpy(startOfURI, "URL"); 2288 2288 2289 int i=1; 2289 2290 for (map<string, vector<string> >::iterator it=filesToGroup.begin(); it!=filesToGroup.end(); it++) … … 2292 2293 strcpy(startOfLocation, it->first.c_str()); 2293 2294 strcpy(startOfName, jt->c_str()); 2295 2294 2296 if (fDebugIsOn) 2295 2297 { … … 2298 2300 Debug(str); 2299 2301 } 2302 2300 2303 int status = 0; 2301 2304 fits_write_tblbytes(groupFile->fitsPointer(), i, 1, 8+3+2*maxCharLength, fitsBuffer, &status); … … 2420 2423 fBlackList.clear(); 2421 2424 fWhiteList.clear(); 2425 2422 2426 if (conf.Has("block")) 2423 2427 { 2424 vector<string> vec = conf.Get<vector<string>>("block"); 2425 if (vec.size() != 0) 2426 { 2427 fHasBlackList = true; 2428 if (fDebugIsOn) 2429 Debug("Setting BLOCK list:"); 2430 } 2431 for (vector<string>::iterator it = vec.begin(); it != vec.end(); it++) 2432 { 2433 fBlackList.insert(*it); 2434 if (fDebugIsOn) 2435 Debug(" " + *it); 2436 } 2437 //Adding entries that should ALWAYS be ignored, because of Dim: otherwise the DataLogger would crash 2428 const vector<string> vec = conf.Get<vector<string>>("block"); 2429 2430 fBlackList.insert(vec.begin(), vec.end()); 2431 2432 //Adding entries that should ALWAYS be ignored 2438 2433 fBlackList.insert("DATA_LOGGER/"); 2439 2434 fBlackList.insert("/SERVICE_LIST"); 2440 2435 fBlackList.insert("DIS_DNS/"); 2441 2436 } 2437 2442 2438 if (conf.Has("allow")) 2443 2439 { 2444 vector<string> vec = conf.Get<vector<string>>("allow"); 2445 if (vec.size() != 0) 2446 { 2447 fHasWhiteList = true; 2448 if (fDebugIsOn) 2449 Debug("Setting ALLOW list:"); 2450 } 2451 for (vector<string>::iterator it=vec.begin(); it != vec.end(); it++) 2452 { 2453 fWhiteList.insert(*it); 2454 if (fDebugIsOn) 2455 Debug(" " + *it); 2456 } 2457 } 2440 const vector<string> vec = conf.Get<vector<string>>("allow"); 2441 fWhiteList.insert(vec.begin(), vec.end()); 2442 } 2443 2458 2444 //Set the grouping 2459 2445 if (conf.Has("group")) 2460 2446 { 2461 vector<string> vec = conf.Get<vector<string>>("group"); 2462 if (vec.size() != 0) 2463 if (fDebugIsOn) 2464 Debug("Setting GROUPING list:"); 2465 for (vector<string>::iterator it=vec.begin(); it != vec.end(); it++) 2466 { 2467 fGrouping.insert(*it); 2468 if (fDebugIsOn) 2469 Debug(" " + *it); 2470 } 2447 const vector<string> vec = conf.Get<vector<string>>("group"); 2448 fGrouping.insert(vec.begin(), vec.end()); 2471 2449 } 2472 2450 return true;
Note:
See TracChangeset
for help on using the changeset viewer.