11 #ifndef _LIBALCOMMON_ALCOMMON_ALMODULE_H_
12 #define _LIBALCOMMON_ALCOMMON_ALMODULE_H_
15 # include <qi/macro.hpp>
17 # include <boost/signals2.hpp>
47 return fPreProcess.connect(subscriber, pos);
55 return fPostProcess.connect(subscriber, pos);
59 fPreProcess.disconnect_all_slots();
63 fPostProcess.disconnect_all_slots();
107 friend class baseModule;
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);
186 virtual void stop(
const int &taskId);
193 bool isStopRequired(
const int &taskId = -1);
202 bool wait(
const int &taskId,
const int &timeout);
210 qi::FutureSync<void> wait(
const int &taskId);
217 bool isRunning(
const int &taskId);
226 int getMethodID(
void);
249 QI_API_DEPRECATED
void functionStop(
int pIDTask);
258 #endif // _LIBALCOMMON_ALCOMMON_ALMODULE_H_
ProcessSignalConnection atPostProcess(ProcessSignalSlot subscriber, ProcessSignalPosition pos=boost::signals2::at_back)
Connect to the postProcess signal.
ProcessSignal fPostProcess
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...
ProcessSignal fPreProcess
ALModuleCore is the superclass of user modules.
virtual ~ALProcessSignals()
boost::signals2::signal< void()>::slot_function_type ProcessSignalSlot
void removeAllPostProcess(void)
boost::signals2::connection ProcessSignalConnection
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.
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)