libalcommon
2.0.6.8
|
00001 00010 #pragma once 00011 #ifndef _LIBALCOMMON_ALCOMMON_ALBROKERMANAGER_H_ 00012 #define _LIBALCOMMON_ALCOMMON_ALBROKERMANAGER_H_ 00013 00014 # include <alcommon/api.h> 00015 # include <vector> 00016 # include <boost/shared_ptr.hpp> 00017 00018 # define MAXBROKER 10 00020 namespace AL 00021 { 00022 class ALBroker; 00023 class ALBrokerManagerPrivate; 00024 00032 class ALBrokerManager 00033 { 00034 protected: 00036 ALBrokerManager(); 00037 ALBrokerManager(const ALBrokerManager &); 00038 ALBrokerManager &operator=(const ALBrokerManager &); 00039 public: 00041 virtual ~ALBrokerManager(); 00042 00049 void addBroker(boost::shared_ptr<ALBroker> pBroker); 00050 00056 void removeBroker(boost::shared_ptr<ALBroker> pBroker); 00057 00064 void removeFromList(boost::shared_ptr<ALBroker> pBroker); 00065 00071 boost::shared_ptr<ALBroker> getBrokerByName(const std::string &brokerName); 00072 00078 boost::shared_ptr<ALBroker> getRandomBroker(void); 00079 00085 boost::shared_ptr<ALBroker> getBroker(int i); 00086 00093 boost::shared_ptr<ALBroker> getBrokerByIPPort(const std::string &strEndPoint); 00094 00095 00103 boost::shared_ptr<ALBroker> getBrokerByIPPort(const std::string &strIP, 00104 int pPort); 00105 00112 boost::shared_ptr<ALBroker> getBrokerByParentIPPort(const std::string &strIP, int pPort); 00113 00118 void killAllBroker(void); 00119 00124 boost::shared_ptr<ALBroker> getReservedBroker(void); 00125 00130 static boost::shared_ptr<ALBrokerManager> getInstance(); 00131 00138 static boost::shared_ptr<ALBrokerManager> setInstance(boost::shared_ptr<ALBrokerManager> pSingleton); 00139 00143 static void kill(); 00144 00145 private: 00147 static boost::shared_ptr<ALBrokerManager> *_singleton; 00148 00149 public: 00151 ALBrokerManagerPrivate *_p; 00152 }; 00153 } // !namespace AL 00154 #endif // _LIBALCOMMON_ALCOMMON_ALBROKERMANAGER_H_