11 #ifndef _LIBALCOMMON_ALCOMMON_ALPROXY_H_
12 #define _LIBALCOMMON_ALCOMMON_ALPROXY_H_
16 # include <alcommon/detail/altaskinfo.h>
19 # include <alerror/alerror.h>
21 # include <boost/shared_ptr.hpp>
22 # include <boost/smart_ptr/enable_shared_from_this.hpp>
25 # pragma warning(disable:4996)
26 # pragma warning(disable:4800)
65 class ALProxy :
public ::boost::enable_shared_from_this<ALProxy>
73 typedef boost::shared_ptr<ALProxy>
Ptr;
81 typedef int (*onFinishedCallback)(
const char*, int,
const AL::ALValue &);
87 boost::shared_ptr<ALProxy>
getThis();
92 boost::shared_ptr<const ALProxy>
getThis()
const;
117 ALProxy(boost::shared_ptr<ALBroker> pBroker,
118 const std::string &pModuleName,
129 ALProxy(
const std::string &pModuleName,
130 const std::string &pIp,
143 ALProxy(
const std::string &pModuleName,
144 const std::string &pIp,
146 boost::shared_ptr<ALBroker> pBroker,
155 ALProxy(
const std::string &pModuleName,
201 onFinishedCallback pCallbackToCallOnFinished = NULL,
202 const char *pszCallerName = NULL);
214 boost::shared_ptr<ALModule>
getModule()
const;
248 boost::shared_ptr<ALFunctorBase>
getFunctor(
const std::string &pName,
249 const std::vector<std::string> &pParamTypes);
262 template <
typename R>
263 R call(
const std::string &pName);
265 template <
typename R,
typename P1>
266 R call(
const std::string &pName,
const P1 &p1);
268 template <
typename R,
typename P1,
typename P2>
269 R call(
const std::string &pName,
const P1 &p1,
const P2 &p2);
271 template <
typename R,
typename P1,
typename P2,
typename P3>
272 R call(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3);
274 template <
typename R,
typename P1,
typename P2,
typename P3,
typename P4>
275 R call(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4);
277 template <
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5>
278 R call(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5);
280 template <
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6>
281 R call(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5,
const P6 &p6);
283 inline void callVoid(
const std::string &pName);
285 template <
typename P1>
286 void callVoid(
const std::string &pName,
const P1 &p1);
288 template <
typename P1,
typename P2>
289 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2);
291 template <
typename P1,
typename P2,
typename P3>
292 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3);
294 template <
typename P1,
typename P2,
typename P3,
typename P4>
295 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4);
297 template <
typename P1,
typename P2,
typename P3,
typename P4,
typename P5>
298 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5);
300 template <
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6>
301 void callVoid(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5,
const P6 &p6);
303 inline int pCall(
const std::string &pName);
305 template <
typename P1>
306 int pCall(
const std::string &pName,
const P1 &p1);
308 template <
typename P1,
typename P2>
309 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2);
311 template <
typename P1,
typename P2,
typename P3>
312 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3);
314 template <
typename P1,
typename P2,
typename P3,
typename P4>
315 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4);
317 template <
typename P1,
typename P2,
typename P3,
typename P4,
typename P5>
318 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5);
320 template <
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6>
321 int pCall(
const std::string &pName,
const P1 &p1,
const P2 &p2,
const P3 &p3,
const P4 &p4,
const P5 &p5,
const P6 &p6);
334 bool wait(
const int &
id,
const int &timeoutPeriod);
341 void stop(
const int &
id);
357 int pCallNotify(
const std::string &name,
358 const std::string &key,
360 const ALValue &message = std::string());
363 void CALL_METHODS(
const std::string &szMethodName,
366 void PCALL_METHODSNoID(
const std::string &szMethodName,
369 void PCALL_METHODS(
const std::string &szMethodName,
382 void init(boost::shared_ptr<ALBroker> pBroker,
383 const std::string &pModuleName,
386 void init(
const std::string& pModuleName,
387 const std::string& pIpParam,
389 boost::shared_ptr<ALBroker> pBroker,
393 int xGetFreeTaskUID(
void);
394 std::string xCleanEndpointAddress(
const std::string &pEndpoint);
397 boost::shared_ptr<detail::ALTaskInfo> xCreateTaskInfo(
const std::string pMethodName);
398 void xAddTask(
const std::string &name, detail::PCallBase *pcall);
400 ALMethodInfo* xLookupMethod(
const std::string &pMethodName,
402 ALMethodInfo* xLookupMethod(
const std::string &pMethodName,
403 const std::vector<std::string> &pParams,
405 const std::string& xGetModuleName();
406 void xExecute(
const std::string &pMethod,
410 int xPCallScript(
const std::string &name,
415 ALProxyImpl *_private;
420 #include <alcommon/alproxy.hxx>
422 #endif // _LIBALCOMMON_ALCOMMON_ALPROXY_H_