Public Member Functions | Static Public Attributes | Friends

CxUtils::MessageServer::Registry Class Reference

Registry to keep track of clients who want to receive data from the Message Server. Message Clients must register themselves to receive data from the Message Server. More...

#include <messageserver.h>

List of all members.

Public Member Functions

 Registry ()
 Constructor.
 ~Registry ()
 Destructor.
int OpenRegistry (const ID registryID)
 Open a view of the registry. Allows you to register/unregister and get a view of all registered client ID's.
int OpenRegistry (const std::string &registryID)
 Open a view of the registry. Allows you to register/unregister and get a view of all registered client ID's.
int CreateRegistry (const ID registryID, const unsigned int maxClients=MaxClients)
 Creates a registry. This option is only available to MessageServer.
int CreateRegistry (const std::string &registryID, const unsigned int maxClients=MaxClients)
 Creates a registry. This option is only available to MessageServer.
int CloseRegistry ()
 Closes the view of the registry.
int Register (const ID id)
 Adds the ID to the registry.
int Unregister (const ID id)
 Removes the ID from the registry.
int GetRegistry (List &registry)
 Gets a copy of all the client ID's in the registry.
bool IsRegistered (const ID id) const
 Checks to see if an ID is in the registry.
bool IsOpen () const
bool IsActive (const unsigned int thresholdMs=500) const
 Check to see if a server is actively checking the server for clients.

Static Public Attributes

static const unsigned int MaxClients = 25
 Maximum number of clients (change if necessary).
static const unsigned int HeaderSize = 20
 Size of registry header.

Friends

class MessageServer

Detailed Description

Registry to keep track of clients who want to receive data from the Message Server. Message Clients must register themselves to receive data from the Message Server.

Definition at line 76 of file messageserver.h.


Constructor & Destructor Documentation

MessageServer::Registry::Registry (  )

Constructor.

Definition at line 59 of file messageserver.cpp.

MessageServer::Registry::~Registry (  )

Destructor.

Definition at line 70 of file messageserver.cpp.


Member Function Documentation

int MessageServer::Registry::CloseRegistry (  )

Closes the view of the registry.

Returns:
1 on success, 0 on failure.

Definition at line 138 of file messageserver.cpp.

int MessageServer::Registry::CreateRegistry ( const ID  registryID,
const unsigned int  maxClients = MaxClients 
)

Creates a registry. This option is only available to MessageServer.

Parameters:
[in]registryIDThe ID to use for the registry. In Windows this can be a string of any kind. This should also with Linux, but you will have more reliable results using a number.
[in]maxClientsMaximum number of clients.
Returns:
1 on success, 0 on failure.

Definition at line 385 of file messageserver.cpp.

int MessageServer::Registry::CreateRegistry ( const std::string &  registryID,
const unsigned int  maxClients = MaxClients 
)

Creates a registry. This option is only available to MessageServer.

Parameters:
[in]registryIDThe ID to use for the registry. In Windows this can be a string of any kind. This should also with Linux, but you will have more reliable results using a number.
[in]maxClientsMaximum number of clients.
Returns:
1 on success, 0 on failure.

Definition at line 406 of file messageserver.cpp.

int MessageServer::Registry::GetRegistry ( MessageServer::List registry )

Gets a copy of all the client ID's in the registry.

Parameters:
[in]registryList of all items in the Registry.
Returns:
1 on success, 0 on failure.

Definition at line 272 of file messageserver.cpp.

bool MessageServer::Registry::IsActive ( const unsigned int  thresholdMs = 500 ) const

Check to see if a server is actively checking the server for clients.

Parameters:
[in]thresholdMsHow long of a threshold to determine if a server is actively checking the registry. For example, if this value is 500, then the method will return false if no server has checked the registry in more than 500 ms.
Returns:
True if registry is being checked by a server, otherwise false.

Definition at line 348 of file messageserver.cpp.

bool CxUtils::MessageServer::Registry::IsOpen (  ) const [inline]

Definition at line 95 of file messageserver.h.

bool MessageServer::Registry::IsRegistered ( const ID  id ) const

Checks to see if an ID is in the registry.

Parameters:
[in]idThe client ID to check for.
Returns:
True if registered, otherwise false.

Definition at line 308 of file messageserver.cpp.

int MessageServer::Registry::OpenRegistry ( const std::string &  registryID )

Open a view of the registry. Allows you to register/unregister and get a view of all registered client ID's.

Parameters:
[in]registryIDThe ID to use for the registry. In Windows this can be a string of any kind. This should also with Linux, but you will have more reliable results using a number.
Returns:
1 on success, 0 on failure.

Definition at line 108 of file messageserver.cpp.

int MessageServer::Registry::OpenRegistry ( const ID  registryID )

Open a view of the registry. Allows you to register/unregister and get a view of all registered client ID's.

Parameters:
[in]registryIDThe ID to use for the registry. In Windows this can be a string of any kind. This should also with Linux, but you will have more reliable results using a number.
Returns:
1 on success, 0 on failure.

Definition at line 88 of file messageserver.cpp.

int MessageServer::Registry::Register ( const ID  id )

Adds the ID to the registry.

Parameters:
[in]idThe client ID to register.
Returns:
1 on success, 0 on failure.

Definition at line 179 of file messageserver.cpp.

int MessageServer::Registry::Unregister ( const ID  id )

Removes the ID from the registry.

Parameters:
[in]idThe client ID to unregister.
Returns:
1 on success, 0 on failure.

Definition at line 227 of file messageserver.cpp.


Friends And Related Function Documentation

friend class MessageServer [friend]

Definition at line 79 of file messageserver.h.


Member Data Documentation

const unsigned int CxUtils::MessageServer::Registry::HeaderSize = 20 [static]

Size of registry header.

Definition at line 81 of file messageserver.h.

const unsigned int CxUtils::MessageServer::Registry::MaxClients = 25 [static]

Maximum number of clients (change if necessary).

Definition at line 80 of file messageserver.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines