libalcommon
2.5.7.1
|
ALModuleCore is the superclass of user modules. More...
#include "alcommon/almodulecore.h"
Public Types | |
enum | ModuleType { CPP = 0, PYTHON = 1, RUBY = 2, LUA = 3, MATLAB = 4, URBI } |
Module type (Ruby, lua, and matlab are not currently used) More... | |
typedef boost::shared_ptr < ALModuleCore > | Ptr |
Shared pointer to ALModuleCore. More... | |
typedef boost::weak_ptr < ALModuleCore > | WeakPtr |
Weak pointer to ALModuleCore. More... | |
Public Member Functions | |
ALModuleCore (boost::shared_ptr< ALBroker > pBroker, const std::string &pName) | |
Constructor. More... | |
virtual | ~ALModuleCore () |
Destructor. More... | |
ALMethodInfo & | getCurrentMethodDescription () |
Get a reference to a temporary object used to construct method help. More... | |
boost::shared_ptr< ALModuleCore > | getThis () |
Getter to the class. More... | |
boost::shared_ptr< const ALModuleCore > | getThis () const |
Getter to class. More... | |
bool | isClosing () |
Check if someone want to exit the module. More... | |
void | initModule (void) |
Register a module to a broker. More... | |
boost::shared_ptr< AL::ALProxy > | getProxy (const std::string &pModuleName) |
Get access to a module. More... | |
std::string | getBrokerName () |
Get the name of the registered broker. More... | |
ModuleType | getModuleType (void) |
Get the type of the module. More... | |
void | setModuleType (ModuleType pType) |
Set the type of the module. More... | |
virtual ALMethodInfo * | execute (const std::string &pMethod, const AL::ALValue &pParams, AL::ALValue &pResult) |
Execute a method with some arguments and store the result. More... | |
std::vector< std::string > | getMethodList () |
Get the module method list. More... | |
AL::ALValue | getMethodHelp (const std::string &pMethodName) |
Get a method's description string. More... | |
ALMethodInfo | getMethodHelpObject (const std::string &pMethodName) |
Get a method's description string. More... | |
AL::ALValue | moduleHelp () |
Get the module's description. More... | |
bool | ping (void) |
Just a ping. Used to test connectivity to a module. More... | |
virtual std::string | version () |
Get module's version. More... | |
virtual void | exit () |
Exit the module and unregister it. More... | |
const std::string & | getName () const |
Get the name of the module given when constructing. More... | |
boost::shared_ptr< ALModuleInfo > | getModuleInfo () |
Get information about the module. More... | |
ALMethodInfo * | getMethodInfoByNameMember (const std::string &pName, const std::vector< std::string > ¶mType, bool softCompare=true) |
Find method information by name and argument type not only by map key. More... | |
ALMethodInfo * | getMethodInfo (const std::string &pName) |
Call by a proxy to check function's parameter. More... | |
ALMethodInfo * | getMethodInfo (const std::string &pName, std::vector< std::string > pParamsType) |
Call by a proxy to check function's parameter. More... | |
ALMethodInfo * | getMethodInfo (const std::string &pName, const AL::ALValue &pParams) |
Call by a proxy to check function's parameter. More... | |
ALMethodInfo * | getFunctionDesc (const std::string &pName) |
deprecated More... | |
ALMethodInfo * | getFunctionDesc (const std::string &pName, std::vector< std::string > pParamsType) |
deprecated More... | |
ALMethodInfo * | getFunctionDesc (const std::string &pName, const AL::ALValue &pParams) |
deprecated More... | |
ALMethodInfo * | getFunctionDescByNameMember (const std::string &pName, const std::vector< std::string > ¶mType, bool softCompare=true) |
deprecated More... | |
boost::shared_ptr< ALBroker > | getParentBroker () const |
Get a pointer to the broker context. More... | |
void | functionStop (int pTaskID) |
Local stop. Use stop(id) for remote/local compatibility. More... | |
void | setModuleDescription (const std::string &pDesc) |
Set the description of the module. More... | |
std::string | getUsage (const std::string &methodName) |
Get the usage of a method as a string. More... | |
bool | isModuleStopped () |
Know if program or module termination is asked. More... | |
void | setModuleID (int id) |
Set the id of the module used to determine the shutdown order. More... | |
int | getModuleID () |
Get the module id given to it be the broker. More... | |
void | bindMethod (boost::shared_ptr< ALFunctorBase > pFunctor) |
Bind a method. More... | |
void | bindMethod (boost::shared_ptr< ALFunctorBase > pFunctor, const std::string &pName, const std::string &pClass, const std::string &pFunctionDescription, const ALMethodInfo &pMethodDescription) |
Bind a method. More... | |
void | bindMethodOverload (boost::shared_ptr< ALFunctorBase > pFunctor) |
Use to define a bound method. More... | |
void | functionName (const std::string &pName, const std::string &pClass, const std::string &pFunctionDescription, int pMask=0) |
Define the name of a bound method. More... | |
void | addParam (const std::string &pName, const std::string &pDesc) |
Add a documented parameter to a method. More... | |
void | addModuleExample (const std::string &pLanguage, const std::string &pExample) |
Add a module example. More... | |
void | addMethodExample (const std::string &pLanguage, const std::string &pExample) |
Add a method example. More... | |
void | setReturn (const std::string &pName, const std::string &pDesc) |
Sets the description of the return value. More... | |
virtual qi::Future < qi::AnyReference > | metaCall (qi::AnyObject context, unsigned int method, const qi::GenericFunctionParameters &in, qi::MetaCallType callType, qi::Signature returnSignature) |
qi::AnyObject | asObject () |
qi::DynamicObjectBuilder & | getBuilder () |
int | pCall (const qi::AnyArguments &args) |
Static Public Member Functions | |
template<class T > | |
static boost::shared_ptr< T > | createModuleCore (boost::shared_ptr< ALBroker > pBroker) |
Create a module core link to a broker. More... | |
template<class T > | |
static boost::shared_ptr< T > | createModuleCoreNoRegister (boost::shared_ptr< ALBroker > pBroker, const std::string &name) |
Create a module core, do not register on the broker. More... | |
template<class T > | |
static boost::shared_ptr< T > | createModuleCore (boost::shared_ptr< ALBroker > pBroker, const std::string &name) |
Create a module core link to a broker. More... | |
template<class T > | |
static boost::shared_ptr< T > | createUrbiModule (boost::shared_ptr< ALBroker > pBroker, const std::string &name) |
Create a URBI module core link to a broker. More... | |
Public Attributes | |
qi::GenericObject | _go |
ALModuleCorePrivate * | _p |
qi::MetaMethodBuilder | _mBuilder |
Protected Member Functions | |
virtual void | init (void) |
Call at every module creation. More... | |
Protected Attributes | |
qi::DynamicObjectBuilder | _builder |
Friends | |
class | baseModule |
ALModuleCore is the superclass of user modules.
It implements basic functions that enables communication with naoqi brokers, so that the distributed approach is painless for users who just want to come up with a simple module quickly, compile it and have it work, without having to deal with interprocess communication.
Definition at line 57 of file almodulecore.h.
Shared pointer to ALModuleCore.
Definition at line 65 of file almodulecore.h.
Weak pointer to ALModuleCore.
Definition at line 71 of file almodulecore.h.
Module type (Ruby, lua, and matlab are not currently used)
Enumerator | |
---|---|
CPP |
C++ type |
PYTHON |
python type |
RUBY |
ruby type (unused) |
LUA |
lua type (unused) |
MATLAB |
matlab type (unused) |
URBI |
urbi type |
Definition at line 78 of file almodulecore.h.
AL::ALModuleCore::ALModuleCore | ( | boost::shared_ptr< ALBroker > | pBroker, |
const std::string & | pName | ||
) |
Constructor.
An ALModule has a name, and is registered in a broker, so that its methods can be called by other modules, via a proxy constructed with module's name
pBroker | a pointer to the broker |
pName | name of the module |
|
virtual |
Destructor.
void AL::ALModuleCore::addMethodExample | ( | const std::string & | pLanguage, |
const std::string & | pExample | ||
) |
Add a method example.
pLanguage | the language of the example (c++, python, .net, etc) |
pExample | the example |
void AL::ALModuleCore::addModuleExample | ( | const std::string & | pLanguage, |
const std::string & | pExample | ||
) |
Add a module example.
pLanguage | the language of the example (c++, python, .net, etc) |
pExample | the example |
void AL::ALModuleCore::addParam | ( | const std::string & | pName, |
const std::string & | pDesc | ||
) |
Add a documented parameter to a method.
pName | the name of the parameter |
pDesc | the description of the parmeter |
qi::AnyObject AL::ALModuleCore::asObject | ( | ) |
void AL::ALModuleCore::bindMethod | ( | boost::shared_ptr< ALFunctorBase > | pFunctor | ) |
Bind a method.
pFunctor | pointer to a generic functor |
void AL::ALModuleCore::bindMethod | ( | boost::shared_ptr< ALFunctorBase > | pFunctor, |
const std::string & | pName, | ||
const std::string & | pClass, | ||
const std::string & | pFunctionDescription, | ||
const ALMethodInfo & | pMethodDescription | ||
) |
Bind a method.
pFunctor | pointer to a generic functor |
pName | the name of the method |
pClass | the name of your class |
pFunctionDescription | the description of the method |
pMethodDescription | the description method. |
void AL::ALModuleCore::bindMethodOverload | ( | boost::shared_ptr< ALFunctorBase > | pFunctor | ) |
Use to define a bound method.
pFunctor | pointer to a generic functor |
|
inlinestatic |
Create a module core link to a broker.
pBroker | to pointer the a broker |
ALError |
Definition at line 341 of file almodulecore.h.
|
inlinestatic |
Create a module core link to a broker.
pBroker | pointer to the a broker |
name | module's name |
ALError |
Definition at line 393 of file almodulecore.h.
|
inlinestatic |
Create a module core, do not register on the broker.
pBroker | to pointer the a broker | |
[in] | name | Name of the module core. |
ALError |
Definition at line 367 of file almodulecore.h.
|
inlinestatic |
Create a URBI module core link to a broker.
pBroker | pointer to the a broker |
name | module's name |
Definition at line 418 of file almodulecore.h.
|
virtual |
Execute a method with some arguments and store the result.
pMethod | method to execute |
pParams | set of arguments for the method |
pResult | result of the method execution |
|
virtual |
Exit the module and unregister it.
Reimplemented in AL::ALModule.
void AL::ALModuleCore::functionName | ( | const std::string & | pName, |
const std::string & | pClass, | ||
const std::string & | pFunctionDescription, | ||
int | pMask = 0 |
||
) |
Define the name of a bound method.
pName | the name of the method |
pClass | the name of your class |
pFunctionDescription | the description of the method |
pMask | optional Mask, default 0. see almethodinfo.h for more information |
void AL::ALModuleCore::functionStop | ( | int | pTaskID | ) |
Local stop. Use stop(id) for remote/local compatibility.
pTaskID | the ID of the task you want to stop |
std::string AL::ALModuleCore::getBrokerName | ( | ) |
Get the name of the registered broker.
|
inline |
Used only for naoqi1/naoqi2 compatibility layers. Do not use unless you know what you are doing
Definition at line 524 of file almodulecore.h.
ALMethodInfo& AL::ALModuleCore::getCurrentMethodDescription | ( | ) |
Get a reference to a temporary object used to construct method help.
ALMethodInfo* AL::ALModuleCore::getFunctionDesc | ( | const std::string & | pName | ) |
deprecated
ALMethodInfo* AL::ALModuleCore::getFunctionDesc | ( | const std::string & | pName, |
std::vector< std::string > | pParamsType | ||
) |
deprecated
ALMethodInfo* AL::ALModuleCore::getFunctionDesc | ( | const std::string & | pName, |
const AL::ALValue & | pParams | ||
) |
deprecated
ALMethodInfo* AL::ALModuleCore::getFunctionDescByNameMember | ( | const std::string & | pName, |
const std::vector< std::string > & | paramType, | ||
bool | softCompare = true |
||
) |
deprecated
AL::ALValue AL::ALModuleCore::getMethodHelp | ( | const std::string & | pMethodName | ) |
Get a method's description string.
pMethodName | method's name. |
ALMethodInfo AL::ALModuleCore::getMethodHelpObject | ( | const std::string & | pMethodName | ) |
Get a method's description string.
pMethodName | method's name. |
ALMethodInfo* AL::ALModuleCore::getMethodInfo | ( | const std::string & | pName | ) |
Call by a proxy to check function's parameter.
pName | function Name |
ALMethodInfo* AL::ALModuleCore::getMethodInfo | ( | const std::string & | pName, |
std::vector< std::string > | pParamsType | ||
) |
Call by a proxy to check function's parameter.
pName | function Name |
pParamsType | parameters type |
ALMethodInfo* AL::ALModuleCore::getMethodInfo | ( | const std::string & | pName, |
const AL::ALValue & | pParams | ||
) |
Call by a proxy to check function's parameter.
pName | function Name |
pParams | method parameters |
ALMethodInfo* AL::ALModuleCore::getMethodInfoByNameMember | ( | const std::string & | pName, |
const std::vector< std::string > & | paramType, | ||
bool | softCompare = true |
||
) |
Find method information by name and argument type not only by map key.
pName | method name |
paramType | list of parameters |
softCompare | true mean ALValue can be anyType (use it for all type compare except local call) |
std::vector<std::string> AL::ALModuleCore::getMethodList | ( | ) |
Get the module method list.
int AL::ALModuleCore::getModuleID | ( | ) |
Get the module id given to it be the broker.
boost::shared_ptr<ALModuleInfo> AL::ALModuleCore::getModuleInfo | ( | ) |
Get information about the module.
ModuleType AL::ALModuleCore::getModuleType | ( | void | ) |
Get the type of the module.
const std::string& AL::ALModuleCore::getName | ( | ) | const |
Get the name of the module given when constructing.
boost::shared_ptr<ALBroker> AL::ALModuleCore::getParentBroker | ( | ) | const |
Get a pointer to the broker context.
boost::shared_ptr<AL::ALProxy> AL::ALModuleCore::getProxy | ( | const std::string & | pModuleName | ) |
Get access to a module.
ex: getProxy("ALMotion")
pModuleName | module name |
boost::shared_ptr<ALModuleCore> AL::ALModuleCore::getThis | ( | ) |
Getter to the class.
boost::shared_ptr<const ALModuleCore> AL::ALModuleCore::getThis | ( | ) | const |
Getter to class.
std::string AL::ALModuleCore::getUsage | ( | const std::string & | methodName | ) |
Get the usage of a method as a string.
methodName | the name of the method |
|
inlineprotectedvirtual |
Call at every module creation.
User can overload it
Reimplemented in AL::ALModule.
Definition at line 538 of file almodulecore.h.
void AL::ALModuleCore::initModule | ( | void | ) |
Register a module to a broker.
Automatically called when loading a module from autoload.ini
bool AL::ALModuleCore::isClosing | ( | ) |
Check if someone want to exit the module.
bool AL::ALModuleCore::isModuleStopped | ( | ) |
Know if program or module termination is asked.
|
virtual |
AL::ALValue AL::ALModuleCore::moduleHelp | ( | ) |
Get the module's description.
int AL::ALModuleCore::pCall | ( | const qi::AnyArguments & | args | ) |
Used for simulating old naoqi1 post behavior that return an id
bool AL::ALModuleCore::ping | ( | void | ) |
Just a ping. Used to test connectivity to a module.
void AL::ALModuleCore::setModuleDescription | ( | const std::string & | pDesc | ) |
Set the description of the module.
pDesc | a description of the module |
void AL::ALModuleCore::setModuleID | ( | int | id | ) |
Set the id of the module used to determine the shutdown order.
id | the id given to it by the broker |
void AL::ALModuleCore::setModuleType | ( | ModuleType | pType | ) |
Set the type of the module.
pType | type of the module |
void AL::ALModuleCore::setReturn | ( | const std::string & | pName, |
const std::string & | pDesc | ||
) |
Sets the description of the return value.
pName | the name of the return item (used in autogeneration) |
pDesc | the description of the return item |
|
virtual |
Get module's version.
|
friend |
Definition at line 545 of file almodulecore.h.
|
protected |
Definition at line 544 of file almodulecore.h.
qi::GenericObject AL::ALModuleCore::_go |
Definition at line 547 of file almodulecore.h.
qi::MetaMethodBuilder AL::ALModuleCore::_mBuilder |
Definition at line 549 of file almodulecore.h.
ALModuleCorePrivate* AL::ALModuleCore::_p |
Definition at line 548 of file almodulecore.h.