libalcommon
2.1.0.18
|
ALProxy is a client to the served methods of a module. More...
#include <alcommon/alproxy.h>
Public Types | |
enum | pProxyOption { NO_OPTION = 0, FORCED_LOCAL = 1, NO_LOAD_DEPENDS = 2, MAIN_PROXY = 4 } |
Different options for the ALProxy. More... | |
typedef boost::shared_ptr < ALProxy > | Ptr |
Shared pointer to ALProxy. | |
typedef boost::weak_ptr< ALProxy > | WeakPtr |
Weak pointer to ALProxy. | |
typedef int(* | onFinishedCallback )(const char *, int, const AL::ALValue &) |
Public Member Functions | |
boost::shared_ptr< ALProxy > | getThis () |
Get a pointer to this ALProxy. | |
boost::shared_ptr< const ALProxy > | getThis () const |
Get a pointer to this ALProxy. | |
ALProxy (const ALProxy &rhs) | |
ALProxy (boost::shared_ptr< ALBroker > pBroker, const std::string &pModuleName, int pProxyMask=0, int timeout=0) | |
Constructor. | |
ALProxy (qi::AnyObject pObject, const std::string &pModuleName) | |
Constructor. | |
ALProxy (const std::string &pModuleName, const std::string &pIp, int pPort, int pProxyMask=0, int timeout=0) | |
Constructor allowing to use proxy without instancing a broker. | |
ALProxy (const std::string &pModuleName, const std::string &pIp, int pPort, boost::shared_ptr< ALBroker > pBroker, int pProxyMask=0, int timeout=0) | |
Constructor. | |
ALProxy (const std::string &pModuleName, int pProxyOption, int pTimeout) | |
Constructor. | |
virtual | ~ALProxy (void) |
Destructor. | |
std::string | remoteBrokerName () |
return the name of the remote broker | |
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). | |
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). | |
std::string | version () |
Get the version. | |
boost::shared_ptr< ALModule > | getModule () const |
Get the module. | |
boost::shared_ptr< ALModuleCore > | getModuleCore () const |
Get the moduleCore. | |
int | getInfo (ALModuleInfo &pModuleInfo) |
Get information about the module stored into pModuleInfo. | |
bool | isLocal () |
Check if the module is in the same process than the proxy. | |
bool | isValid () |
Make sure that we notice that someone has invalidated our module. | |
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. | |
boost::shared_ptr< ALBroker > | getParentBroker (void) const |
Get the parent broker. | |
void | destroyConnection (void) |
Destroy a proxy to clean each shared_ptr of the class. | |
template<typename R > | |
R | call (const std::string &pName) |
template<typename R , typename P1 > | |
R | call (const std::string &pName, const P1 &p1) |
template<typename R , typename P1 , typename P2 > | |
R | call (const std::string &pName, const P1 &p1, const P2 &p2) |
template<typename R , typename P1 , typename P2 , typename P3 > | |
R | call (const std::string &pName, const P1 &p1, const P2 &p2, const P3 &p3) |
template<typename R , typename P1 , typename P2 , typename P3 , typename P4 > | |
R | call (const std::string &pName, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4) |
template<typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 > | |
R | call (const std::string &pName, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5) |
template<typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 > | |
R | call (const std::string &pName, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6) |
void | callVoid (const std::string &pName) |
template<typename P1 > | |
void | callVoid (const std::string &pName, const P1 &p1) |
template<typename P1 , typename P2 > | |
void | callVoid (const std::string &pName, const P1 &p1, const P2 &p2) |
template<typename P1 , typename P2 , typename P3 > | |
void | callVoid (const std::string &pName, const P1 &p1, const P2 &p2, const P3 &p3) |
template<typename P1 , typename P2 , typename P3 , typename P4 > | |
void | callVoid (const std::string &pName, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4) |
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 > | |
void | callVoid (const std::string &pName, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5) |
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 > | |
void | callVoid (const std::string &pName, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6) |
int | pCall (const std::string &pName) |
template<typename P1 > | |
int | pCall (const std::string &pName, const P1 &p1) |
template<typename P1 , typename P2 > | |
int | pCall (const std::string &pName, const P1 &p1, const P2 &p2) |
template<typename P1 , typename P2 , typename P3 > | |
int | pCall (const std::string &pName, const P1 &p1, const P2 &p2, const P3 &p3) |
template<typename P1 , typename P2 , typename P3 , typename P4 > | |
int | pCall (const std::string &pName, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4) |
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 > | |
int | pCall (const std::string &pName, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5) |
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 > | |
int | pCall (const std::string &pName, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6) |
bool | wait (const int &id, const int &timeoutPeriod) |
Wait for the end of a long running method that was called using 'post'. | |
void | stop (const int &id) |
Stop a long running method that was called using 'post'. | |
bool | isRunning (const int &id) |
Check if the method is running. | |
template<typename P0 > | |
int | pCall (const std::string &pName, const P0 &p0) |
template<typename P0 , typename P1 > | |
int | pCall (const std::string &pName, const P0 &p0, const P1 &p1) |
template<typename P0 , typename P1 , typename P2 > | |
int | pCall (const std::string &pName, const P0 &p0, const P1 &p1, const P2 &p2) |
template<typename P0 , typename P1 , typename P2 , typename P3 > | |
int | pCall (const std::string &pName, const P0 &p0, const P1 &p1, const P2 &p2, const P3 &p3) |
template<typename P0 , typename P1 , typename P2 , typename P3 , typename P4 > | |
int | pCall (const std::string &pName, const P0 &p0, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4) |
template<typename P0 , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 > | |
int | pCall (const std::string &pName, const P0 &p0, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5) |
ALProxy is a client to the served methods of a module.
It gives access to the methods of a module without needing to know if the module that provides a service is in the same process, on the same machine, or on the same tcp network.
ALProxy is a generic client in that it can be constructed using just the name of the module that you wish to connect to. Once connected, methods are availble via templated calls. While generic and flexible, these provide no checking on the availabilty or signature of a method until runtime.
All Aldebaran provided modules have classes called 'specific' proxies built around this generic proxy. When using a specific proxy, explicit method signatures are provided which allows correctness to be validated at runtime. In addition, specific proxies include optimisations for local calls that are easily available in the generic proxy. e.g. #include <alproxies/altexttospeechproxy> ... AL::ALTextToSpeechProxy tts; tts.say("hello world");
Lifetime: The broker own a private qi::object, proxies own a weak pointer on the object. If the object is destroyed (because the module do not exist anymore, the weak_ptr wont work anymore). once there is no weak_ptr on the object the object could be deleted from broker.
typedef int(* AL::ALProxy::onFinishedCallback)(const char *, int, const AL::ALValue &) |
Shared pointer to ALProxy.
Weak pointer to ALProxy.
AL::ALProxy::ALProxy | ( | const ALProxy & | rhs | ) |
AL::ALProxy::ALProxy | ( | boost::shared_ptr< ALBroker > | pBroker, |
const std::string & | pModuleName, | ||
int | pProxyMask = 0 , |
||
int | timeout = 0 |
||
) |
Constructor.
pBroker | pointer to a broker |
pModuleName | module's name |
pProxyMask | |
timeout |
AL::ALProxy::ALProxy | ( | qi::AnyObject | pObject, |
const std::string & | pModuleName | ||
) |
Constructor.
pObject | pointer to a service object be careful this pointer wont be owned by ALProxy |
pModuleName | module's name |
AL::ALProxy::ALProxy | ( | const std::string & | pModuleName, |
const std::string & | pIp, | ||
int | pPort, | ||
int | pProxyMask = 0 , |
||
int | timeout = 0 |
||
) |
Constructor allowing to use proxy without instancing a broker.
pModuleName | module's name |
pIp | |
pPort | |
pProxyMask | |
timeout |
AL::ALProxy::ALProxy | ( | const std::string & | pModuleName, |
const std::string & | pIp, | ||
int | pPort, | ||
boost::shared_ptr< ALBroker > | pBroker, | ||
int | pProxyMask = 0 , |
||
int | timeout = 0 |
||
) |
Constructor.
pModuleName | module's name |
pIp | |
pPort | |
pBroker | |
pProxyMask | |
timeout |
AL::ALProxy::ALProxy | ( | const std::string & | pModuleName, |
int | pProxyOption, | ||
int | pTimeout | ||
) |
Constructor.
pModuleName | module's name |
pProxyOption | |
pTimeout |
virtual AL::ALProxy::~ALProxy | ( | void | ) | [virtual] |
Destructor.
R AL::ALProxy::call | ( | const std::string & | pName | ) |
R AL::ALProxy::call | ( | const std::string & | pName, |
const P1 & | p1 | ||
) |
R AL::ALProxy::call | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2 | ||
) |
R AL::ALProxy::call | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3 | ||
) |
R AL::ALProxy::call | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3, | ||
const P4 & | p4 | ||
) |
R AL::ALProxy::call | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3, | ||
const P4 & | p4, | ||
const P5 & | p5 | ||
) |
R AL::ALProxy::call | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3, | ||
const P4 & | p4, | ||
const P5 & | p5, | ||
const P6 & | p6 | ||
) |
void AL::ALProxy::callVoid | ( | const std::string & | pName | ) | [inline] |
void AL::ALProxy::callVoid | ( | const std::string & | pName, |
const P1 & | p1 | ||
) |
void AL::ALProxy::callVoid | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2 | ||
) |
void AL::ALProxy::callVoid | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3 | ||
) |
void AL::ALProxy::callVoid | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3, | ||
const P4 & | p4 | ||
) |
void AL::ALProxy::callVoid | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3, | ||
const P4 & | p4, | ||
const P5 & | p5 | ||
) |
void AL::ALProxy::callVoid | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3, | ||
const P4 & | p4, | ||
const P5 & | p5, | ||
const P6 & | p6 | ||
) |
void AL::ALProxy::destroyConnection | ( | void | ) |
Destroy a proxy to clean each shared_ptr of the class.
AL::ALValue AL::ALProxy::genericCall | ( | const std::string & | strMethodName, |
const AL::ALValue & | listParams | ||
) |
A generic call, without type optimisation, using AL::ALValue for each call... (local or not).
Used from a C++ code not knowing the signature of the called method
strMethodName | the name of the method to call |
listParams | the list of parameters (possibly no params) |
int AL::ALProxy::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).
Used from a C++ code not knowing the signature of the called method
strMethodName | the name of the method to call |
listParams | the list of parameters (possibly no params) |
pCallbackToCallOnFinished | a callback to call when task is finished (NULL if no callback) DEPRECATED |
pszCallerName | the name of the caller (proxy name or module name, dependings on langage, script, caller...) DEPRECATED |
boost::shared_ptr<ALFunctorBase> AL::ALProxy::getFunctor | ( | const std::string & | pName, |
const std::vector< std::string > & | pParamTypes | ||
) |
Get a pointer to a method form its name and its parameters.
pName | name of the method |
pParamTypes | parameters' list |
int AL::ALProxy::getInfo | ( | ALModuleInfo & | pModuleInfo | ) |
Get information about the module stored into pModuleInfo.
pModuleInfo | reference to the module information found |
boost::shared_ptr<ALModule> AL::ALProxy::getModule | ( | ) | const |
Get the module.
boost::shared_ptr<ALModuleCore> AL::ALProxy::getModuleCore | ( | ) | const |
Get the moduleCore.
boost::shared_ptr<ALBroker> AL::ALProxy::getParentBroker | ( | void | ) | const |
Get the parent broker.
boost::shared_ptr<ALProxy> AL::ALProxy::getThis | ( | ) |
Get a pointer to this ALProxy.
boost::shared_ptr<const ALProxy> AL::ALProxy::getThis | ( | ) | const |
Get a pointer to this ALProxy.
bool AL::ALProxy::isLocal | ( | ) |
Check if the module is in the same process than the proxy.
bool AL::ALProxy::isRunning | ( | const int & | id | ) |
Check if the method is running.
id | the ID of the method that was returned when calling the method using 'post' |
bool AL::ALProxy::isValid | ( | ) |
Make sure that we notice that someone has invalidated our module.
This check is done before each specialized proxy's use of a method ptr.
int AL::ALProxy::pCall | ( | const std::string & | pName, |
const P0 & | p0 | ||
) |
Definition at line 74 of file alproxy.hxx.
int AL::ALProxy::pCall | ( | const std::string & | pName, |
const P0 & | p0, | ||
const P1 & | p1 | ||
) |
Definition at line 85 of file alproxy.hxx.
int AL::ALProxy::pCall | ( | const std::string & | pName, |
const P0 & | p0, | ||
const P1 & | p1, | ||
const P2 & | p2 | ||
) |
Definition at line 97 of file alproxy.hxx.
int AL::ALProxy::pCall | ( | const std::string & | pName, |
const P0 & | p0, | ||
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3 | ||
) |
Definition at line 110 of file alproxy.hxx.
int AL::ALProxy::pCall | ( | const std::string & | pName, |
const P0 & | p0, | ||
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3, | ||
const P4 & | p4 | ||
) |
Definition at line 124 of file alproxy.hxx.
int AL::ALProxy::pCall | ( | const std::string & | pName, |
const P0 & | p0, | ||
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3, | ||
const P4 & | p4, | ||
const P5 & | p5 | ||
) |
Definition at line 139 of file alproxy.hxx.
int AL::ALProxy::pCall | ( | const std::string & | pName | ) | [inline] |
Definition at line 64 of file alproxy.hxx.
int AL::ALProxy::pCall | ( | const std::string & | pName, |
const P1 & | p1 | ||
) |
int AL::ALProxy::pCall | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2 | ||
) |
int AL::ALProxy::pCall | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3 | ||
) |
int AL::ALProxy::pCall | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3, | ||
const P4 & | p4 | ||
) |
int AL::ALProxy::pCall | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3, | ||
const P4 & | p4, | ||
const P5 & | p5 | ||
) |
int AL::ALProxy::pCall | ( | const std::string & | pName, |
const P1 & | p1, | ||
const P2 & | p2, | ||
const P3 & | p3, | ||
const P4 & | p4, | ||
const P5 & | p5, | ||
const P6 & | p6 | ||
) |
std::string AL::ALProxy::remoteBrokerName | ( | ) |
return the name of the remote broker
void AL::ALProxy::stop | ( | const int & | id | ) |
Stop a long running method that was called using 'post'.
id | the ID of the method that was returned when calling the method using 'post' |
std::string AL::ALProxy::version | ( | ) |
Get the version.
bool AL::ALProxy::wait | ( | const int & | id, |
const int & | timeoutPeriod | ||
) |
Wait for the end of a long running method that was called using 'post'.
id | the ID of the method that was returned when calling the method using 'post' |
timeoutPeriod | the timeout period in ms. To wait indefinately, use a timeoutPeriod of zero |