11 #ifndef _LIBALCOMMON_ALCOMMON_ALMODULE_H_
12 #define _LIBALCOMMON_ALCOMMON_ALMODULE_H_
15 # include <qi/macro.hpp>
17 # include <boost/signals2.hpp>
117 static boost::shared_ptr<T>
createModule(boost::shared_ptr<ALBroker> pBroker)
119 boost::shared_ptr<T> module(
new T(pBroker));
120 module->initModule();
125 (boost::static_pointer_cast<
ALModule>(module))->init();
127 catch(
const ALError& e)
142 template <
class T,
typename P1>
143 static boost::shared_ptr<T>
createModule(boost::shared_ptr<ALBroker> pBroker, P1 p1)
145 boost::shared_ptr<T> module(
new T(pBroker, p1));
146 module->initModule();
151 (boost::static_pointer_cast<
ALModule>(module))->init();
153 catch(
const ALError& e)
171 ALModule(boost::shared_ptr<ALBroker> pBroker,
const std::string& pName);
194 virtual void stop(
const int &taskId);
210 bool wait(
const int &taskId,
const int &timeout);
218 qi::FutureSync<void>
wait(
const int &taskId);
266 #endif // _LIBALCOMMON_ALCOMMON_ALMODULE_H_
ProcessSignalConnection atPostProcess(ProcessSignalSlot subscriber, ProcessSignalPosition pos=boost::signals2::at_back)
Connect to the postProcess signal.
ProcessSignal fPostProcess
virtual std::string httpGet()
Called by the broker webpage to detail the module. This can be overriden to provide information speci...
void preProcess(void)
Trigger methods attached to preProcess.
ALModule can be used as a base class for user modules to help serve and advertise their methods...
ALModule(boost::shared_ptr< ALBroker > pBroker, const std::string &pName)
Creates an ALModule.
bool wait(const int &taskId, const int &timeout)
Waits until the end of a long running method using the ID that was returned from a method started wit...
int getMethodID(void)
Return unique ID if method call.
ProcessSignal fPreProcess
virtual ~ALModule()
Destructor.
ALModuleCore is the superclass of user modules.
virtual ~ALProcessSignals()
boost::signals2::signal< void()>::slot_function_type ProcessSignalSlot
void removeAllPostProcess(void)
virtual void stop(const int &taskId)
Stops a module's method using the ID given returned by a 'post' call. Module authors are encouraged t...
boost::signals2::connection ProcessSignalConnection
bool isPCalled()
Check if the module is pcalled.
virtual void init(void)
It will be called at every module creation, user can overload it.
static boost::shared_ptr< T > createModule(boost::shared_ptr< ALBroker > pBroker)
Create a module and link it to a broker.
virtual void exit()
Exit the module and unregister it.
static boost::shared_ptr< T > createModule(boost::shared_ptr< ALBroker > pBroker, P1 p1)
Create a module and link it to a broker.
boost::signals2::connect_position ProcessSignalPosition
ProcessSignalConnection atPreProcess(ProcessSignalSlot subscriber, ProcessSignalPosition pos=boost::signals2::at_back)
boost::signals2::signal< void()> ProcessSignal
void postProcess(void)
Trigger methods attached to postProcess.
void removeAllPreProcess(void)
QI_API_DEPRECATED void functionStop(int pIDTask)
deprecated
bool isRunning(const int &taskId)
Determines if the method created with a 'post' is still running.
bool isStopRequired(const int &taskId=-1)
Check if the user call stop.