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
72 class ALBrokerPrivate;
73 class ALCOMMON_API ALBroker :
public ::boost::enable_shared_from_this<ALBroker>,
public ::boost::noncopyable
81 typedef boost::shared_ptr<ALBroker>
Ptr;
87 typedef boost::weak_ptr<ALBroker>
WeakPtr;
93 boost::shared_ptr<ALBroker> getThis();
98 boost::shared_ptr<const ALBroker> getThis()
const;
114 void setBrokerManagerInstance(boost::shared_ptr<ALBrokerManager> pBrokerManager);
121 boost::shared_ptr<ALModuleCore> getModuleByName(
const std::string &pModuleName);
131 int unregisterModule(
const std::string &pModuleName);
139 bool isModulePresent(
const std::string &pModuleName);
146 int getModuleList(boost::shared_ptr<std::vector<ALModuleInfo> > pModuleList);
153 int getBrokerList(std::vector<ALModuleInfo> &pBrokerList);
160 int getGlobalModuleList(boost::shared_ptr<std::vector<ALModuleInfo> > pModuleList);
167 bool isExiting()
const;
185 std::string getName()
const;
191 std::string getIP()
const;
202 std::string getParentIP()
const;
207 int getParentPort()
const;
215 boost::shared_ptr<ALProxy> getProxy(
const std::string &pProxyName,
int deprecated = 0);
217 template <
typename T>
222 return boost::shared_ptr<T>(
new T(getProxy(name)));
232 #define getMemoryProxy() getSpecialisedProxy<AL::ALMemoryProxy>("ALMemory")
241 #define getLedsProxy() getSpecialisedProxy<AL::ALLedsProxy>("ALLeds")
250 #define getLoggerProxy() getSpecialisedProxy<AL::ALLoggerProxy>("ALLogger")
259 #define getMotionProxy() getSpecialisedProxy<AL::ALMotionProxy>("ALMotion")
268 #define getPreferencesProxy() getSpecialisedProxy<AL::ALPreferencesProxy>("ALPreferences")
277 #define getDcmProxy() getSpecialisedProxy<AL::DCMProxy>("DCM")
292 static boost::shared_ptr<ALBroker> createBroker(
const std::string &pName,
293 const std::string &pIP,
295 const std::string &pParentIP,
298 std::string pPath =
"",
299 bool pLoadLib =
true);
301 static boost::shared_ptr<ALBroker> createBroker(
const std::string &name, qi::SessionPtr session);
303 qi::SessionPtr session();
318 #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.