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>
25 # pragma warning(disable:4996)
26 # pragma warning(disable:4800)
70 class ALProxy :
public ::boost::enable_shared_from_this<ALProxy>
78 typedef boost::shared_ptr<ALProxy>
Ptr;
92 boost::shared_ptr<ALProxy>
getThis();
97 boost::shared_ptr<const ALProxy>
getThis()
const;
123 ALProxy(boost::shared_ptr<ALBroker> pBroker,
124 const std::string &pModuleName,
134 ALProxy(qi::AnyObject pObject,
const std::string &pModuleName);
144 ALProxy(
const std::string &pModuleName,
145 const std::string &pIp,
159 ALProxy(
const std::string &pModuleName,
160 const std::string &pIp,
162 boost::shared_ptr<ALBroker> pBroker,
211 const char *pszCallerName = NULL);
223 boost::shared_ptr<ALModule>
getModule()
const;
257 boost::shared_ptr<ALFunctorBase>
getFunctor(
const std::string &pName,
258 const std::vector<std::string> &pParamTypes);
271 template <
typename R>
272 R
call(
const std::string &pName);
274 template <
typename R,
typename P1>
275 R
call(
const std::string &pName,
const P1 &p1);
277 template <
typename R,
typename P1,
typename P2>
278 R
call(
const std::string &pName,
const P1 &p1,
const P2 &p2);
280 template <
typename R,
typename P1,
typename P2,
typename P3>
281 R
call(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3);
283 template <
typename R,
typename P1,
typename P2,
typename P3,
typename P4>
284 R
call(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4);
286 template <
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5>
287 R
call(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5);
289 template <
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6>
290 R
call(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5,
const P6 &p6);
292 inline void callVoid(
const std::string &pName);
294 template <
typename P1>
295 void callVoid(
const std::string &pName,
const P1 &p1);
297 template <
typename P1,
typename P2>
298 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2);
300 template <
typename P1,
typename P2,
typename P3>
301 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3);
303 template <
typename P1,
typename P2,
typename P3,
typename P4>
304 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4);
306 template <
typename P1,
typename P2,
typename P3,
typename P4,
typename P5>
307 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5);
309 template <
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6>
310 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5,
const P6 &p6);
312 inline int pCall(
const std::string &pName);
314 template <
typename P1>
315 int pCall(
const std::string &pName,
const P1 &p1);
317 template <
typename P1,
typename P2>
318 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2);
320 template <
typename P1,
typename P2,
typename P3>
321 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3);
323 template <
typename P1,
typename P2,
typename P3,
typename P4>
324 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4);
326 template <
typename P1,
typename P2,
typename P3,
typename P4,
typename P5>
327 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5);
329 template <
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6>
330 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5,
const P6 &p6);
342 bool wait(
const int &
id,
const int &timeoutPeriod);
350 qi::FutureSync<void>
wait(
const int &
id);
357 void stop(
const int &
id);
373 int pCallNotify(
const std::string &name,
374 const std::string &key,
376 const ALValue &message = std::string(),
377 std::pair<int, int>* cache = 0);
379 std::string moduleName()
const;
384 qi::AnyObject asObject();
387 qi::AnyWeakObject _object;
389 int xMetaPCall(
const std::string &signature,
const qi::GenericFunctionParameters &in);
400 #endif // _LIBALCOMMON_ALCOMMON_ALPROXY_H_
std::string version()
Get the version.
int genericPCall(const std::string &strMethodName, const AL::ALValue &listParams, onFinishedCallback pCallbackToCallOnFinished=NULL, const char *pszCallerName=NULL)
A generic post-call, without type optimisation, using AL::ALValue for each call... (local or not).
boost::shared_ptr< ALProxy > Ptr
Shared pointer to ALProxy.
ALProxy is a client to the served methods of a module.
void callVoid(const std::string &pName)
boost::shared_ptr< ALFunctorBase > getFunctor(const std::string &pName, const std::vector< std::string > &pParamTypes)
Get a pointer to a method form its name and its parameters.
ALProxy(const ALProxy &rhs)
void destroyConnection(void)
Destroy a proxy to clean each shared_ptr of the class.
ALModuleInfo is the class of information about user modules.
ALModuleCore is the superclass of user modules.
R call(const std::string &pName)
virtual ~ALProxy(void)
Destructor.
bool isRunning(const int &id)
Check if the method is running.
bool isValid()
Make sure that we notice that someone has invalidated our module.
int pCall(const std::string &pName)
boost::shared_ptr< ALProxy > getThis()
Get a pointer to this ALProxy.
bool wait(const int &id, const int &timeoutPeriod)
Wait for the end of a long running method that was called using 'post'.
int(* onFinishedCallback)(const char *, int, const AL::ALValue &)
void stop(const int &id)
Stop a long running method that was called using 'post'.
boost::shared_ptr< ALModule > getModule() const
Get the module.
AL::ALValue genericCall(const std::string &strMethodName, const AL::ALValue &listParams)
A generic call, without type optimisation, using AL::ALValue for each call... (local or not)...
std::string remoteBrokerName()
return the name of the remote broker
bool isLocal()
Check if the module is in the same process than the proxy.
int getInfo(ALModuleInfo &pModuleInfo)
Get information about the module stored into pModuleInfo.
boost::weak_ptr< ALProxy > WeakPtr
Weak pointer to ALProxy.
boost::shared_ptr< ALModuleCore > getModuleCore() const
Get the moduleCore.
pProxyOption
Different options for the ALProxy.
boost::shared_ptr< ALBroker > getParentBroker(void) const
Get the parent broker.
boost::shared_ptr< ALProxy > ALProxyPtr