11 #ifndef _LIBALCOMMON_ALCOMMON_ALBROKER_H_
12 #define _LIBALCOMMON_ALCOMMON_ALBROKER_H_
21 # include <boost/shared_ptr.hpp>
22 # include <boost/smart_ptr/enable_shared_from_this.hpp>
23 # include <boost/noncopyable.hpp>
28 # include <qi/macro.hpp>
29 # include <qi/session.hpp>
31 # define BROKERMASK_KEEPALIVE 1
32 # define BROKERMASK_LIGHT 2
33 # define BROKERMASK_NOSERVER 4
34 # define BROKERMASK_NOHEARTBEAT 8
35 # define BROKERMASK_WITHALNETWORK 16
73 class ALBrokerPrivate;
74 class ALBroker :
public ::boost::enable_shared_from_this<ALBroker>,
public ::boost::noncopyable
82 typedef boost::shared_ptr<ALBroker>
Ptr;
88 typedef boost::weak_ptr<ALBroker>
WeakPtr;
94 boost::shared_ptr<ALBroker> getThis();
99 boost::shared_ptr<const ALBroker> getThis()
const;
115 void setBrokerManagerInstance(boost::shared_ptr<ALBrokerManager> pBrokerManager);
122 boost::shared_ptr<ALModuleCore> getModuleByName(
const std::string &pModuleName);
132 int unregisterModule(
const std::string &pModuleName);
140 bool isModulePresent(
const std::string &pModuleName);
147 int getModuleList(boost::shared_ptr<std::vector<ALModuleInfo> > pModuleList);
154 int getBrokerList(std::vector<ALModuleInfo> &pBrokerList);
161 int getGlobalModuleList(boost::shared_ptr<std::vector<ALModuleInfo> > pModuleList);
168 bool isExiting()
const;
186 std::string getName()
const;
192 std::string getIP()
const;
203 std::string getParentIP()
const;
208 int getParentPort()
const;
216 boost::shared_ptr<ALProxy> getProxy(
const std::string &pProxyName,
int deprecated = 0);
223 std::string httpGet(
const std::string &pPath);
226 template <
typename T>
231 return boost::shared_ptr<T>(
new T(getProxy(name)));
241 #define getMemoryProxy() getSpecialisedProxy<AL::ALMemoryProxy>("ALMemory")
250 #define getLedsProxy() getSpecialisedProxy<AL::ALLedsProxy>("ALLeds")
259 #define getLoggerProxy() getSpecialisedProxy<AL::ALLoggerProxy>("ALLogger")
268 #define getMotionProxy() getSpecialisedProxy<AL::ALMotionProxy>("ALMotion")
277 #define getPreferencesProxy() getSpecialisedProxy<AL::ALPreferencesProxy>("ALPreferences")
286 #define getDcmProxy() getSpecialisedProxy<AL::DCMProxy>("DCM")
301 static boost::shared_ptr<ALBroker> createBroker(
const std::string &pName,
302 const std::string &pIP,
304 const std::string &pParentIP,
307 std::string pPath =
"",
308 bool pLoadLib =
true);
310 static boost::shared_ptr<ALBroker> createBroker(
const std::string &name, qi::SessionPtr session);
312 qi::SessionPtr session();
327 #endif // _LIBALCOMMON_ALCOMMON_ALBROKER_H_
ALBrokerManager is a class to manage brokers.
ALModuleCore is the superclass of user modules.
boost::weak_ptr< ALBroker > WeakPtr
Weak pointer to ALBroker.
boost::weak_ptr< ALBrokerManager > fBrokerManager
boost::shared_ptr< ALBroker > ALBrokerPtr
boost::shared_ptr< T > getSpecialisedProxy(const std::string &name=std::string())
ALBroker serves methods advertised by connected modules to clients participating in the network...
boost::shared_ptr< ALBroker > Ptr
Shared pointer to ALBroker.