libalcommon  1.14
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
albrokermanager.h
Go to the documentation of this file.
1 
10 #pragma once
11 #ifndef _LIBALCOMMON_ALCOMMON_ALBROKERMANAGER_H_
12 #define _LIBALCOMMON_ALCOMMON_ALBROKERMANAGER_H_
13 
14 # include <vector>
15 # include <boost/shared_ptr.hpp>
16 
17 # define MAXBROKER 10
19 namespace AL
20 {
21  class ALBroker;
22  class ALBrokerManagerImpl;
23 
32  {
33  protected:
36 
37  public:
39  virtual ~ALBrokerManager();
40 
47  void addBroker(boost::shared_ptr<ALBroker> pBroker);
48 
54  void removeBroker(boost::shared_ptr<ALBroker> pBroker);
55 
62  void removeFromList(boost::shared_ptr<ALBroker> pBroker);
63 
64 
70  boost::shared_ptr<ALBroker> getRandomBroker(void);
71 
77  boost::shared_ptr<ALBroker> getBroker(int i);
78 
85  boost::shared_ptr<ALBroker> getBrokerByIPPort(const std::string &strEndPoint);
86 
87 
95  boost::shared_ptr<ALBroker> getBrokerByIPPort(const std::string &strIP,
96  int pPort);
97 
104  boost::shared_ptr<ALBroker> getBrokerByParentIPPort(const std::string &strIP, int pPort);
105 
110  void killAllBroker(void);
111 
116  boost::shared_ptr<ALBroker> getReservedBroker(void);
117 
122  static boost::shared_ptr<ALBrokerManager> getInstance();
123 
130  static boost::shared_ptr<ALBrokerManager> setInstance(boost::shared_ptr<ALBrokerManager> pSingleton);
131 
135  static void kill();
136 
137  private:
139  static boost::shared_ptr<ALBrokerManager> _singleton;
141  ALBrokerManagerImpl *_private;
142  };
143 } // !namespace AL
144 #endif // _LIBALCOMMON_ALCOMMON_ALBROKERMANAGER_H_