FACT++  1.0
State DimServiceInfoList::GetState ( const std::string &  server,
int  state 
) const

Returns the Description of the state as defined by the arguments. given server. Service in this context can also be a command.

Parameters
serverServer name to look for
stateThe state index to look for (e.g. 1)
Returns
The State object containing the description. If the server was not found the State object will contain the index -3, if the state was not found -2.

Definition at line 444 of file DimServiceInfoList.cc.

References i, and str.

Referenced by DimServiceInfoListImp::GetState(), and ~DimServiceInfoList().

445 {
446  const ServiceList::const_iterator s = fServiceList.find(server);
447  if (s==fServiceList.end())
448  {
449  stringstream str;
450  str << "DimServiceInfoList::GetState: Searching for state #" << state << " server " << server << " not found.";
451  return State(-3, "Server not found", str.str());
452  }
453 
454  const std::vector<State> &v = s->second.third;
455 
456  for (vector<State>::const_iterator i=v.begin(); i!=v.end(); i++)
457  if (i->index==state)
458  return *i;
459 
460  stringstream str;
461  str << "DimServiceInfoList::GetState: State #" << state << " not found on server " << server << ".";
462  return State(-2, "State not found", str.str());
463 }
ServiceList fServiceList
A map storing the service description to retrieve all informations.
int i
Definition: db_dim_client.c:21
char str[80]
Definition: test_client.c:7

+ Here is the caller graph for this function: