11 #ifndef _LIBALCOMMON_ALCOMMON_ALPROXY_H_
12 #define _LIBALCOMMON_ALCOMMON_ALPROXY_H_
18 # include <alerror/alerror.h>
20 # include <boost/shared_ptr.hpp>
21 # include <boost/smart_ptr/enable_shared_from_this.hpp>
22 # include <qi/anyobject.hpp>
23 # include <qi/session.hpp>
26 # pragma warning(disable:4996)
27 # pragma warning(disable:4800)
79 typedef boost::shared_ptr<ALProxy>
Ptr;
87 typedef int (*onFinishedCallback)(
const char*, int,
const AL::ALValue &);
93 boost::shared_ptr<ALProxy> getThis();
98 boost::shared_ptr<const ALProxy> getThis()
const;
119 ALProxy(boost::shared_ptr<ALBroker> pBroker,
120 const std::string &pModuleName,
129 ALProxy(
const qi::SessionPtr& session,
const std::string &serviceName);
136 ALProxy(qi::AnyObject pObject,
const std::string &pModuleName);
146 ALProxy(
const std::string &pModuleName,
147 const std::string &pIp,
161 ALProxy(
const std::string &pModuleName,
162 const std::string &pIp,
164 boost::shared_ptr<ALBroker> pBroker,
183 std::string remoteBrokerName();
196 AL::ALValue genericCall(
const std::string &strMethodName,
217 int genericPCall(
const std::string &strMethodName,
219 onFinishedCallback pCallbackToCallOnFinished = NULL,
220 const char *pszCallerName = NULL);
226 std::string version();
232 boost::shared_ptr<ALModule> getModule()
const;
237 boost::shared_ptr<ALModuleCore> getModuleCore()
const;
266 boost::shared_ptr<ALFunctorBase> getFunctor(
const std::string &pName,
267 const std::vector<std::string> &pParamTypes);
273 boost::shared_ptr<ALBroker> getParentBroker(
void)
const;
278 void destroyConnection(
void);
280 template <
typename R>
281 R call(
const std::string &pName);
283 template <
typename R,
typename P1>
284 R call(
const std::string &pName,
const P1 &p1);
286 template <
typename R,
typename P1,
typename P2>
287 R call(
const std::string &pName,
const P1 &p1,
const P2 &p2);
289 template <
typename R,
typename P1,
typename P2,
typename P3>
290 R call(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3);
292 template <
typename R,
typename P1,
typename P2,
typename P3,
typename P4>
293 R call(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4);
295 template <
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5>
296 R call(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5);
298 template <
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6>
299 R call(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5,
const P6 &p6);
301 inline void callVoid(
const std::string &pName);
303 template <
typename P1>
304 void callVoid(
const std::string &pName,
const P1 &p1);
306 template <
typename P1,
typename P2>
307 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2);
309 template <
typename P1,
typename P2,
typename P3>
310 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3);
312 template <
typename P1,
typename P2,
typename P3,
typename P4>
313 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4);
315 template <
typename P1,
typename P2,
typename P3,
typename P4,
typename P5>
316 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5);
318 template <
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6>
319 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5,
const P6 &p6);
321 inline int pCall(
const std::string &pName);
323 template <
typename P1>
324 int pCall(
const std::string &pName,
const P1 &p1);
326 template <
typename P1,
typename P2>
327 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2);
329 template <
typename P1,
typename P2,
typename P3>
330 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3);
332 template <
typename P1,
typename P2,
typename P3,
typename P4>
333 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4);
335 template <
typename P1,
typename P2,
typename P3,
typename P4,
typename P5>
336 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5);
338 template <
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6>
339 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5,
const P6 &p6);
351 bool wait(
const int &
id,
const int &timeoutPeriod);
359 qi::FutureSync<void> wait(
const int &
id);
366 void stop(
const int &
id);
374 bool isRunning(
const int &
id);
382 int pCallNotify(
const std::string &name,
383 const std::string &key,
385 const ALValue &message = std::string(),
386 std::pair<int, int>* cache = 0);
388 std::string moduleName()
const;
393 qi::AnyObject asObject();
395 std::unique_ptr<ALProxyPrivate> _p;
396 qi::AnyWeakObject _object;
398 int xMetaPCall(
const std::string &signature,
const qi::GenericFunctionParameters &in);
411 template<
typename ProxyType>
413 const qi::SessionPtr& session,
414 const std::string& serviceName)
416 return boost::make_shared<ProxyType>(boost::make_shared<ALProxy>(session, serviceName));
422 #endif // _LIBALCOMMON_ALCOMMON_ALPROXY_H_
boost::shared_ptr< ALProxy > Ptr
Shared pointer to ALProxy.
ALProxy is a client to the served methods of a module.
ALModuleInfo is the class of information about user modules.
ALModuleCore is the superclass of user modules.
boost::shared_ptr< ProxyType > makeProxy(const qi::SessionPtr &session, const std::string &serviceName)
boost::weak_ptr< ALProxy > WeakPtr
Weak pointer to ALProxy.
pProxyOption
Different options for the ALProxy.
boost::shared_ptr< ALProxy > ALProxyPtr