libalcommon
1.14.5
|
00001 00010 #pragma once 00011 #ifndef _LIBALCOMMON_ALCOMMON_ALBROKERMANAGER_H_ 00012 #define _LIBALCOMMON_ALCOMMON_ALBROKERMANAGER_H_ 00013 00014 # include <vector> 00015 # include <boost/shared_ptr.hpp> 00016 00017 # define MAXBROKER 10 00019 namespace AL 00020 { 00021 class ALBroker; 00022 class ALBrokerManagerImpl; 00023 00031 class ALBrokerManager 00032 { 00033 protected: 00035 ALBrokerManager(); 00036 00037 public: 00039 virtual ~ALBrokerManager(); 00040 00047 void addBroker(boost::shared_ptr<ALBroker> pBroker); 00048 00054 void removeBroker(boost::shared_ptr<ALBroker> pBroker); 00055 00062 void removeFromList(boost::shared_ptr<ALBroker> pBroker); 00063 00064 00070 boost::shared_ptr<ALBroker> getRandomBroker(void); 00071 00077 boost::shared_ptr<ALBroker> getBroker(int i); 00078 00085 boost::shared_ptr<ALBroker> getBrokerByIPPort(const std::string &strEndPoint); 00086 00087 00095 boost::shared_ptr<ALBroker> getBrokerByIPPort(const std::string &strIP, 00096 int pPort); 00097 00104 boost::shared_ptr<ALBroker> getBrokerByParentIPPort(const std::string &strIP, int pPort); 00105 00110 void killAllBroker(void); 00111 00116 boost::shared_ptr<ALBroker> getReservedBroker(void); 00117 00122 static boost::shared_ptr<ALBrokerManager> getInstance(); 00123 00130 static boost::shared_ptr<ALBrokerManager> setInstance(boost::shared_ptr<ALBrokerManager> pSingleton); 00131 00135 static void kill(); 00136 00137 private: 00139 static boost::shared_ptr<ALBrokerManager> _singleton; 00141 ALBrokerManagerImpl *_private; 00142 }; 00143 } // !namespace AL 00144 #endif // _LIBALCOMMON_ALCOMMON_ALBROKERMANAGER_H_