FACT++  1.0
ServiceList Class Reference

Maintains a list of all servers and services available in the Dim nbetwork. More...

#include <ServiceList.h>

+ Inheritance diagram for ServiceList:
+ Collaboration diagram for ServiceList:

Public Types

typedef std::map< const std::string, std::pair< DimInfo *, DimInfo * > > ServerMap
 
typedef std::map< const std::string, std::vector< std::string > > ServiceMap
 
typedef std::map< const std::string, std::string > StringMap
 
typedef std::map< const std::string, std::vector< Description > > DescriptionMap
 

Public Member Functions

 ServiceList (const char *type, std::ostream &out=std::cout)
 
 ServiceList (std::ostream &out=std::cout)
 
 ~ServiceList ()
 Delete the allocated memory from fServerList. More...
 
void SetHandler (DimInfoHandler *handler=0)
 
std::vector< std::string > GetServerList () const
 
std::vector< std::string > GetServiceList () const
 
std::vector< std::string > GetServiceList (const std::string &server) const
 
bool HasServer (const std::string &name) const
 
bool HasService (const std::string &server, const std::string &service) const
 
bool HasService (const std::string &service) const
 
ServiceMap::const_iterator begin () const
 
ServiceMap::const_iterator end () const
 
std::vector< std::string >::const_iterator begin (const std::string &server) const
 
std::vector< std::string >::const_iterator end (const std::string &server) const
 
std::string GetFormat (const std::string &server, const std::string &name) const
 
std::string GetFormat (const std::string &service) const
 
std::string GetComment (const std::string &server, const std::string &name) const
 
std::string GetComment (const std::string &service) const
 
std::vector< DescriptionGetDescriptions (const std::string &server, const std::string &name) const
 
std::vector< DescriptionGetDescriptions (const std::string &service) const
 
void PrintServerList (std::ostream &out) const
 
void PrintServiceList (std::ostream &out) const
 
int PrintDescription (std::ostream &out, const std::string &serv="", const std::string &svc="") const
 
void PrintServerList () const
 
void PrintServiceList () const
 
int PrintDescription (const std::string &serv="", const std::string &svc="") const
 
void DumpServiceList () const
 
bool SendDimCommand (std::ostream &lout, const std::string &server, const std::string &str) const
 
bool SendDimCommand (const std::string &server, const std::string &str) const
 
- Public Member Functions inherited from DimClient
 DimClient ()
 
virtual ~DimClient ()
 
void addErrorHandler ()
 
virtual void errorHandler (int, int, char *)
 
- Public Member Functions inherited from DimInfoHandler
DimInfogetInfo ()
 
virtual ~DimInfoHandler ()
 
- Public Member Functions inherited from DimErrorHandler
virtual ~DimErrorHandler ()
 

Static Public Member Functions

static void DumpServiceList (std::ostream &out)
 
- Static Public Member Functions inherited from DimClient
static int sendCommand (const char *name, int data)
 
static int sendCommand (const char *name, float data)
 
static int sendCommand (const char *name, double data)
 
static int sendCommand (const char *name, longlong data)
 
static int sendCommand (const char *name, short data)
 
static int sendCommand (const char *name, const char *data)
 
static int sendCommand (const char *name, void *data, int datasize)
 
static void sendCommandNB (const char *name, int data)
 
static void sendCommandNB (const char *name, float data)
 
static void sendCommandNB (const char *name, double data)
 
static void sendCommandNB (const char *name, longlong data)
 
static void sendCommandNB (const char *name, short data)
 
static void sendCommandNB (const char *name, char *data)
 
static void sendCommandNB (const char *name, void *data, int datasize)
 
static int setExitHandler (const char *serverName)
 
static int killServer (const char *serverName)
 
static int setDnsNode (const char *node)
 
static int setDnsNode (const char *node, int port)
 
static char * getDnsNode ()
 
static int getDnsPort ()
 
static void addErrorHandler (DimErrorHandler *handler)
 
static int getServerId ()
 
static int getServerPid ()
 
static char * getServerName ()
 
static char ** getServerServices ()
 
static void setNoDataCopy ()
 
static int getNoDataCopy ()
 
static int inCallback ()
 

Private Member Functions

DimInfoCreateDimInfo (const std::string &str, const std::string &svc) const
 A callback to signal updates. More...
 
DimInfoCreateSL (const std::string &str) const
 
DimInfoCreateFMT (const std::string &str) const
 
void ProcessServerList ()
 
void ProcessServiceList (DimInfo &info)
 
void infoHandler ()
 

Private Attributes

std::ostream & wout
 
DimInfo fDimServers
 stream for redirection of the output More...
 
const std::string fType
 A DimInfo to retrieve the SERVER_LIST from teh DNS server. More...
 
ServerMap fServerList
 A filter for the type of the services to be collected, e.g. CMD. More...
 
ServiceMap fServiceList
 A map storing server names and a DimInfo for their SERVICE_LIST. More...
 
StringMap fFormatList
 A map storing server names and vector with all their available commands. More...
 
StringMap fDescriptionMap
 A map storing all commands and their format strings. More...
 
DescriptionMap fDescriptionList
 A map storing all descriptions for commands and services. More...
 
DimInfoHandlerfHandler
 A map storing all descriptions for arguments of command and services. More...
 

Additional Inherited Members

- Public Attributes inherited from DimInfoHandler
DimInfoitsService
 
- Static Public Attributes inherited from DimClient
static char * dimDnsNode = 0
 
static DimErrorHandleritsCltError = 0
 
static char * serverName = 0
 
static int dicNoCopy = 0
 

Detailed Description

Maintains a list of all servers and services available in the Dim nbetwork.

The idea of this class is to maintain a list of servers and services available in the Dim network. The servers are retrieved by subscribing to DIS_DNS/SERVER_LIST. The services are retrieved by subscribing to all servers SERVICE_LIST service.

The server names and the corresponidng DimInfo ovjects for their service lists are stored in fServerList.

The services of all servers are stored in the fServiceList.

From the services a lookup table fFormatList is created storing the received formats of all services/commands. The format list is only updated. So it might happen that formats for commands not available anymore are still in the list.

Whether commands or services are stored can be selected in the constructor by the type argument. Use "CMD" for commands and "" for services.

Todo:
  • Resolve the dependancy on WindowLog, maybe we can issue the log-messages via MessageImp or we provide more general modfiers (loike in MLogManip)
  • Maybe we also get updates (+/-) on the SERVCIE_LIST?
  • check if we really need our own logging stream
  • Implement fType=="*"

Definition at line 14 of file ServiceList.h.


The documentation for this class was generated from the following files: