FACT++  1.0
void DataLogger::updateSubscriptionList ( )
private

update the service

UPDATE SUBSCRIPTION LIST. Updates the subscription list service if enough time has passed. Otherwise does nothing

Definition at line 433 of file datalogger.cc.

References Time::None, DimDescribedService::setData(), DimService::setQuality(), and DimDescribedService::Update().

Referenced by Report().

434 {
435  if (fCurrentSubscriptionUpdateRate <= 0) return;
436  Time timeNow;
437  //if less than the update rate time has passed, just return
438  if (timeNow - fLastSubscriptionUpdate < boost::posix_time::seconds(fCurrentSubscriptionUpdateRate))
439  return;
440  //TODO remove me !
441 // cout << "Updating subscription list with: " << endl;
442 
443  fLastSubscriptionUpdate = timeNow;
444 
445  //update service !
446  ostringstream output;
447  for (auto serverIt=fServiceSubscriptions.begin();serverIt!=fServiceSubscriptions.end(); serverIt++)
448  {
449  if (serverIt->first == "DATA_LOGGER")
450  continue;
451  for (auto serviceIt=serverIt->second.begin(); serviceIt!=serverIt->second.end(); serviceIt++)
452  {
453  output << serverIt->first << "/" << serviceIt->first << ",";
454  if (serviceIt->second.lastReceivedEvent != Time::None)
455  output << (timeNow - serviceIt->second.lastReceivedEvent).total_seconds();
456  else
457  output << "-1";
458  output << "\n";
459  }
460  }
461 //TODO remove me !
462 //cout << output.str();
463  fCurrentSubscription->setData(output.str().c_str(), output.str().size()+1);
466 }
int fCurrentSubscriptionUpdateRate
Number of seconds since the last update of the subscribed list.
Definition: datalogger.cc:299
void setQuality(int quality)
Definition: discpp.cxx:1256
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
DimDescribedService * fCurrentSubscription
Service for broadcasting subscription status.
Definition: datalogger.cc:297
void setData(const void *ptr, size_t sz)
static const Time None
A none-time, this can be used as a simple representation of an invalid time.
Definition: Time.h:34
SubscriptionsListType fServiceSubscriptions
All the services to which we have subscribed to, sorted by server name.
Definition: datalogger.cc:224
Time fLastSubscriptionUpdate
The last time in seconds of the day when the service was update.
Definition: datalogger.cc:301

+ Here is the call graph for this function:

+ Here is the caller graph for this function: