FACT++  1.0
int DataLogger::infoCallback ( const EventImp evt,
unsigned int  infoIndex 
)
private

Inherited from DimInfo. Handles all the Infos to which we subscribed, and log them.

Definition at line 1125 of file datalogger.cc.

References CheckForRunNumber(), MessageImp::Debug(), fAutoStarted, fDebugIsOn, fShouldAutoStart, StateMachineImp::GetCurrentState(), EventImp::GetFormat(), EventImp::GetName(), EventImp::GetSize(), StateMachineImp::kSM_Ready, Report(), StateMachineDim::SetCurrentState(), Start(), str, and TrimOldRunNumbers().

Referenced by AddService().

1126 {
1127 // if (fDebugIsOn)
1128 // {
1129 // ostringstream str;
1130 // str << "Got infoCallback called with service index= " << subIndex;
1131 // Debug(str.str());
1132 // }
1133 
1135  {
1136  fAutoStarted = true;
1137  SetCurrentState(Start(), "infoCallback");
1138 // SetCurrentState(NightlyToWaitRun());
1139  }
1140  else
1141  {
1142  if (GetCurrentState() > kSM_Ready)
1143  fAutoStarted = true;
1144  }
1145 
1146 
1147  //check if the service pointer corresponds to something that we subscribed to
1148  //this is a fix for a bug that provides bad Infos when a server starts
1149  bool found = false;
1150  SubscriptionsListType::iterator x;
1151  map<string, SubscriptionType>::iterator y;
1152  for (x=fServiceSubscriptions.begin(); x != fServiceSubscriptions.end(); x++)
1153  {//find current service is subscriptions
1154  //Edit: this should be useless now... remove it sometimes ?
1155  for (y=x->second.begin(); y!=x->second.end();y++)
1156  if (y->second.index == subIndex)
1157  {
1158  found = true;
1159  break;
1160  }
1161  if (found)
1162  break;
1163  }
1164 
1165  if (!found && fDebugIsOn)
1166  {
1167  ostringstream str;
1168  str << "Service " << evt.GetName() << " not found in subscriptions" << endl;
1169  Debug(str.str());
1170  }
1171  if (!found)
1172  return GetCurrentState();
1173 
1174 
1175  if (evt.GetSize() == 0 && fDebugIsOn)
1176  {
1177  ostringstream str;
1178  str << "Got 0 size for " << evt.GetName() << endl;
1179  Debug(str.str());
1180  }
1181  if (evt.GetSize() == 0)
1182  return GetCurrentState();
1183 
1184  if (evt.GetFormat() == "" && fDebugIsOn)
1185  {
1186  ostringstream str;
1187  str << "Got no format for " << evt.GetName() << endl;
1188  Debug(str.str());
1189  }
1190  if (evt.GetFormat() == "")
1191  return GetCurrentState();
1192 
1193 // cout.precision(20);
1194 // cout << "Orig timestamp: " << Time(I->getTimestamp(), I->getTimestampMillisecs()*1000).Mjd() << endl;
1195  // FIXME: Here we have to check if we have received the
1196  // service with the run-number.
1197  // CheckForRunNumber(I); has been removed because we have to
1198  // subscribe to this service anyway and hence we have the pointer
1199  // (no need to check for the name)
1200  CheckForRunNumber(evt, subIndex);
1201 
1202  Report(evt, y->second);
1203 
1204  //remove old run numbers
1206 
1207  return GetCurrentState();
1208 }
void CheckForRunNumber(const EventImp &evt, unsigned int index)
checks whether or not the current info being treated is a run number
Definition: datalogger.cc:1265
Mainloop running, state machine in operation.
int GetCurrentState() const
return the current state of the machine
int Debug(const std::string &str)
Definition: MessageImp.h:45
char str[80]
Definition: test_client.c:7
bool fDebugIsOn
configuration flags
Definition: datalogger.cc:315
bool fAutoStarted
Definition: datalogger.cc:394
virtual std::string GetFormat() const
Definition: EventImp.h:52
bool fShouldAutoStart
Definition: datalogger.cc:393
void Report(const EventImp &evt, SubscriptionType &sub)
Reporting method for the services info received.
Definition: datalogger.cc:1319
void TrimOldRunNumbers()
Check if old run numbers can be trimmed, and if so, do it.
Definition: datalogger.cc:1108
SubscriptionsListType fServiceSubscriptions
All the services to which we have subscribed to, sorted by server name.
Definition: datalogger.cc:224
virtual std::string GetName() const
Definition: EventImp.h:51
int Start()
start transition
Definition: datalogger.cc:1818
virtual size_t GetSize() const
Definition: EventImp.h:55
std::string SetCurrentState(int state, const char *txt="", const std::string &cmd="")

+ Here is the call graph for this function:

+ Here is the caller graph for this function: