libalcommon
1.12
|
00001 00010 #pragma once 00011 #ifndef _LIBALCOMMON_ALCOMMON_ALBROKER_H_ 00012 #define _LIBALCOMMON_ALCOMMON_ALBROKER_H_ 00013 00014 # include <list> 00015 # include <map> 00016 00017 # include <alcommon/almoduleinfo.h> 00018 # include <alvalue/alvalue.h> 00019 00020 # include <boost/shared_ptr.hpp> 00021 # include <boost/smart_ptr/enable_shared_from_this.hpp> 00022 # include <boost/noncopyable.hpp> 00023 00024 # include <qi/macro.hpp> 00025 00026 # define BROKERMASK_KEEPALIVE 1 00027 # define BROKERMASK_LIGHT 2 00028 # define BROKERMASK_NOSERVER 4 00029 # define BROKERMASK_NOHEARTBEAT 8 00030 # define BROKERMASK_WITHALNETWORK 16 00032 namespace AL 00033 { 00034 class ALMemoryProxy; 00035 class ALLedsProxy; 00036 class ALLoggerProxy; 00037 class ALMotionProxy; 00038 class ALPreferencesProxy; 00039 class DCMProxy; 00040 00041 class ALTask; 00042 class ALModuleCore; 00043 class ALProxy; 00044 class ALBrokerManager; 00045 class ALBrokerInfo; 00046 class ALBrokerImpl; 00047 00077 class ALBroker : public ::boost::enable_shared_from_this<ALBroker>, public ::boost::noncopyable 00078 { 00079 public: 00085 typedef boost::shared_ptr<ALBroker> Ptr; 00091 typedef boost::weak_ptr<ALBroker> WeakPtr; 00092 00097 boost::shared_ptr<ALBroker> getThis(); 00102 boost::shared_ptr<const ALBroker> getThis() const; 00103 00107 ALBroker(); 00108 00112 virtual ~ALBroker(void); 00113 00118 void setBrokerManagerInstance(boost::shared_ptr<ALBrokerManager> pBrokerManager); 00119 00125 boost::shared_ptr<ALModuleCore> getModuleByName(const std::string &pModuleName); 00126 00142 int registerModule(boost::shared_ptr<ALModuleCore> pModule); 00143 00152 int unregisterModule(const std::string &pModuleName); 00153 00160 bool isModulePresent(const std::string &pModuleName); 00161 00167 int getModuleList(boost::shared_ptr<std::vector<ALModuleInfo> > pModuleList); 00168 00174 int getBrokerList(std::vector<ALModuleInfo> &pBrokerList); 00175 00181 int getGlobalModuleList(boost::shared_ptr<std::vector<ALModuleInfo> > pModuleList); 00182 00183 00188 bool isExiting() const; 00189 00194 int shutdown(); 00195 00200 std::string getName() const; 00201 00206 std::string getIP() const; 00207 00212 int getPort() const; 00213 00220 boost::shared_ptr<ALProxy> getProxy(const std::string &pProxyName, int pProxyOption = 0); 00221 00227 const std::string httpGet(const std::string &pPath); 00228 00237 QI_API_DEPRECATED boost::shared_ptr<ALMemoryProxy> getMemoryProxy(void); 00238 00247 QI_API_DEPRECATED boost::shared_ptr<ALLedsProxy> getLedsProxy(void); 00248 00257 QI_API_DEPRECATED boost::shared_ptr<ALLoggerProxy> getLoggerProxy(void); 00258 00267 QI_API_DEPRECATED boost::shared_ptr<ALMotionProxy> getMotionProxy(void); 00268 00277 QI_API_DEPRECATED boost::shared_ptr<ALPreferencesProxy> getPreferencesProxy(void); 00278 00287 QI_API_DEPRECATED boost::shared_ptr<DCMProxy> getDcmProxy(void); 00288 00301 static boost::shared_ptr<ALBroker> createBroker(const std::string &pName, 00302 const std::string &pIP, 00303 int pPort, 00304 const std::string &pParentIP, 00305 int pParentPort, 00306 int pKeepAlive = 0, 00307 std::string pPath = "", 00308 bool pLoadLib = true); 00309 00310 public: 00312 boost::weak_ptr<ALBrokerManager> fBrokerManager; 00313 00315 ALBrokerImpl *_private; 00316 00317 }; 00318 00319 } // !namespace AL 00320 00321 #endif // _LIBALCOMMON_ALCOMMON_ALBROKER_H_