libalcommon  2.1.4.13
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
AL::ALBrokerManager Class Reference

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

#include "alcommon/albrokermanager.h"

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

ALBrokerManagerPrivate * _p
 

Protected Member Functions

 ALBrokerManager ()
 Constructor. More...
 
 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

AL::ALBrokerManager::ALBrokerManager ( )
protected

Constructor.

AL::ALBrokerManager::ALBrokerManager ( const ALBrokerManager )
protected
virtual AL::ALBrokerManager::~ALBrokerManager ( )
virtual

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.

void AL::ALBrokerManager::killAllBroker ( void  )

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: