This function processes the update of the SERVICE_LIST, SERVICE_DESC, and STATE_LIST updates.
Whenever a service is added or removed or all services of a server are removed (the list is newly sent completely) the virtual functions AddService(), RemoveService() and RemoveAllServices() aee called.
If a new description or a new state is added, the virtual functions AddDescription() and AddStates() respectively are called.
176 const string server = svc.substr(0, svc.find_first_of(
'/'));
177 const string service = svc.substr(svc.find_first_of(
'/')+1);
179 if (service==
"SERVICE_LIST")
191 if (str[0]!=
'+' && str[0]!=
'-')
200 stringstream stream(str);
201 while (getline(stream, buffer,
'\n'))
207 const string type = buffer.substr(buffer.find_last_of(
'|')+1);
218 const string fmt = buffer.substr(buffer.find_first_of(
'|')+1, buffer.find_last_of(
'|')-buffer.find_first_of(
'|')-1);
219 const string name = buffer.substr(buffer.find_first_of(
'/')+1, buffer.find_first_of(
'|')-buffer.find_first_of(
'/')-1);
222 const bool iscmd = type==
"CMD";
230 const TypeList::iterator v = list.find(name);
252 const TypeList::iterator v = list.find(name);
256 err <<
"DimServiceInfoList: Service '" << server <<
"/" << name <<
"' already in list not as it ought to be.";
257 throw runtime_error(err.str());
260 list[name] = make_pair(fmt, iscmd);
267 list[name] = make_pair(fmt, iscmd);
274 if (service==
"SERVICE_DESC")
283 stringstream stream(
getInfo()->getString());
284 while (getline(stream, buffer,
'\n'))
291 const string name = v[0].name.substr(v[0].name.find_first_of(
'/')+1);
292 const string comment = v[0].comment;
294 list[name] = make_pair(comment, vector<Description>(v.begin()+1, v.end()));
302 if (service==
"STATE_LIST")
virtual void AddDescription(const std::string &, const std::string &, const std::vector< Description > &)
std::map< const std::string, ServiceType > TypeList
ServiceList fServiceList
A map storing the service description to retrieve all informations.
std::map< const std::string, std::pair< std::string, std::vector< Description > > > DescriptionList
virtual void RemoveAllServices(const std::string &)
DimServiceInfoListImp * fList
virtual void RemoveService(std::string, std::string, bool)
static std::vector< Description > SplitDescription(const std::string &buffer)
virtual void AddStates(const std::string &, const std::vector< State > &)
virtual void AddService(const std::string &, const std::string &, const std::string &, bool)
static std::vector< State > SplitStates(const std::string &buffer)
Time of state change.