libalcommon  2.1.0.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions
AL::ALBrokerManager Class Reference

ALBrokerManager is a class to manage brokers. More...

#include <alcommon/albrokermanager.h>

List of all members.

Public Member Functions

virtual ~ALBrokerManager ()
 Destructor.
void addBroker (boost::shared_ptr< ALBroker > pBroker)
 Add a Broker in the map of broker.
void removeBroker (boost::shared_ptr< ALBroker > pBroker)
 Remove a broker from the map of broker.
void removeFromList (boost::shared_ptr< ALBroker > pBroker)
 Remove a broker from the map of broker.
boost::shared_ptr< ALBrokergetBrokerByName (const std::string &brokerName)
 Get the suitable broker.
boost::shared_ptr< ALBrokergetRandomBroker (void)
 Get the first broker in the list.
boost::shared_ptr< ALBrokergetBroker (int i)
 Get a broker from index.
boost::shared_ptr< ALBrokergetBrokerByIPPort (const std::string &strEndPoint)
 Get a broker from IP and port address.
boost::shared_ptr< ALBrokergetBrokerByIPPort (const std::string &strIP, int pPort)
 Get a broker by port address.
boost::shared_ptr< ALBrokergetBrokerByParentIPPort (const std::string &strIP, int pPort)
 Get a broker by parent's broker port.
void killAllBroker (void)
 Remove and shutdown all brokers.
boost::shared_ptr< ALBrokergetReservedBroker (void)
 Create a empty broker.

Static Public Member Functions

static boost::shared_ptr
< ALBrokerManager
getInstance ()
 Get the ALBrokerManager singleton.
static boost::shared_ptr
< ALBrokerManager
setInstance (boost::shared_ptr< ALBrokerManager > pSingleton)
 Set the ALBrokerManager singleton.
static void kill ()
 Reset the ALBrokerManager singleton.

Public Attributes

ALBrokerManagerPrivate * _p

Protected Member Functions

 ALBrokerManager ()
 Constructor.
 ALBrokerManager (const ALBrokerManager &)
ALBrokerManageroperator= (const ALBrokerManager &)

Detailed Description

ALBrokerManager is a class to manage brokers.

It should be only singleton with various main pointer.

Definition at line 32 of file albrokermanager.h.


Constructor & Destructor Documentation

Constructor.

Destructor.


Member Function Documentation

void AL::ALBrokerManager::addBroker ( boost::shared_ptr< ALBroker pBroker)

Add a Broker in the map of broker.

Add a broker to the map if it do not already exist.

Parameters:
pBrokerpointer to a broker
boost::shared_ptr<ALBroker> AL::ALBrokerManager::getBroker ( int  i)

Get a broker from index.

Parameters:
iindex to the broker
Returns:
A pointer to the broker.
boost::shared_ptr<ALBroker> AL::ALBrokerManager::getBrokerByIPPort ( const std::string &  strEndPoint)

Get a broker from IP and port address.

Parameters:
strEndPointbroker's address, format "127.0.0.1:5559/"
Returns:
A pointer to the broker if we find it, a pointer to the first borker in the list otherwise.
boost::shared_ptr<ALBroker> AL::ALBrokerManager::getBrokerByIPPort ( const std::string &  strIP,
int  pPort 
)

Get a broker by port address.

Parameters:
strIPbroker's IP (unused)
pPortbroker's port
Returns:
A pointer to the broker if we find it, a pointer to the first borker in the list otherwise.
boost::shared_ptr<ALBroker> AL::ALBrokerManager::getBrokerByName ( const std::string &  brokerName)

Get the suitable broker.

Parameters:
brokerNamename of wanted broker
boost::shared_ptr<ALBroker> AL::ALBrokerManager::getBrokerByParentIPPort ( const std::string &  strIP,
int  pPort 
)

Get a broker by parent's broker port.

Parameters:
strIPbroker's IP (unused)
pPortparent's port the broker
Returns:
A pointer to the broker, boost::shared_ptr<ALBroker>() otherwise
static boost::shared_ptr<ALBrokerManager> AL::ALBrokerManager::getInstance ( ) [static]

Get the ALBrokerManager singleton.

Returns:
A poitner to the instance of the ALBrokerManager
boost::shared_ptr<ALBroker> AL::ALBrokerManager::getRandomBroker ( void  )

Get the first broker in the list.

Returns:
A pointer to a broker, throw if broker's list is empty
Exceptions:
ALERROR
boost::shared_ptr<ALBroker> AL::ALBrokerManager::getReservedBroker ( void  )

Create a empty broker.

Returns:
A pointer to a Broker
static void AL::ALBrokerManager::kill ( ) [static]

Reset the ALBrokerManager singleton.

Remove and shutdown all brokers.

Warning:
Program should not work any more after that.
ALBrokerManager& AL::ALBrokerManager::operator= ( const ALBrokerManager ) [protected]
void AL::ALBrokerManager::removeBroker ( boost::shared_ptr< ALBroker pBroker)

Remove a broker from the map of broker.

Warning:
It will also shutdown the broker.
Parameters:
pBrokerpointer to a broker
void AL::ALBrokerManager::removeFromList ( boost::shared_ptr< ALBroker pBroker)

Remove a broker from the map of broker.

It won't shutdown of the broker

Parameters:
pBrokerpointer to a broker
static boost::shared_ptr<ALBrokerManager> AL::ALBrokerManager::setInstance ( boost::shared_ptr< ALBrokerManager pSingleton) [static]

Set the ALBrokerManager singleton.

Warning:
It will kill the old singleton to replace it by the new one
Parameters:
pSingletonA pointer to a new ALBrokerManager
Returns:
A poitner to the new instance of the ALBrokerManager

Member Data Documentation

ALBrokerManagerPrivate* AL::ALBrokerManager::_p

A pointer to the private implementation of ALBrokerManager.

Definition at line 151 of file albrokermanager.h.


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