Modules

Modules are both class and library. A library loaded from autoload.ini will automatically instantiate the module main class.

The module generator - see the SDK section - creates a class that will be understood by the broker: load a module, see module function API...

ALModule

Function Description
virtual void init(void); This virtual reset function is automatically called when loading a module.
ALPtr<AL::ALProxy> getProxy(const std::string& pModuleName); Get access to another module.
inline ALPtr<ALBroker> getParentBroker () Get parent broker pointer/smart pointer. See broker
virtual void dataChanged (const std::string& pDataName, const AL::ALValue& pValue, const std::string& pMessage)=0; Default callback name when a variable from ALMemory changes
bool ping( void ); Ping a module
virtual void exit( ); Exit a module. If you redefine it, always call ALModule::exit() or the module won't be destroyed properly.
std::string getName() Get module name
inline ALPtr<ALModuleInfo> getModuleInfo (){ return fModuleInfo;}; Get module information
virtual std::string httpGet () const{ return "";}; Module information displayed on the web page.

ALModule API creation

Function Description
#define BIND_METHOD( x ) Add method x in module API. API (bound function) can be called locally or remotely
void functionName ( const std::string& pName, const std::string& pClass, const std::string& pFunctionDescription ); Used to define the bound method name.
void addParam (const std::string& pName, const std::string& pDesc); Help to describe a method's parameter.
virtual AL::ALValue getMethodHelp ( const std::string& pMethodName ); Get methodName description
AL::ALValue moduleHelp(); Get Module description





Copyright © 2010 Aldebaran-Robotics - All rights reserved