SmartSoft Component-Developer API
|
#include <smartIManagedTask.h>
Public Member Functions | |
IManagedTask (IComponent *component, TaskTriggerSubject *trigger=nullptr) | |
virtual | ~IManagedTask ()=default |
virtual int | on_entry ()=0 |
user hook that is called once at the beginning of the internal thread More... | |
virtual int | on_execute ()=0 |
user hook that is called periodically in the thread (must be implemented in derived classes) More... | |
virtual int | on_exit ()=0 |
user hook that is called once at the end of the thread More... | |
Public Member Functions inherited from Smart::ITask | |
ITask (IComponent *component=nullptr) | |
Default constructor. More... | |
virtual | ~ITask ()=default |
Default destructor. More... | |
virtual int | start ()=0 |
Creates and starts a new thread (if not yet started) More... | |
virtual int | stop (const bool wait_till_stopped=true)=0 |
Stops the currently active thread (if it was started before) More... | |
Public Member Functions inherited from Smart::IShutdownObserver | |
IShutdownObserver (ShutdownSubject *subject=nullptr) | |
The default constructor. More... | |
virtual | ~IShutdownObserver () |
The default destructor. More... | |
Public Member Functions inherited from Smart::TaskTriggerObserver | |
TaskTriggerObserver (TaskTriggerSubject *subject, const unsigned int &prescaleFactor=1) | |
virtual | ~TaskTriggerObserver () |
virtual StatusCode | waitOnTrigger () |
virtual StatusCode | waitOnTrigger (const Duration &timeout) |
Protected Member Functions | |
virtual void | on_shutdown () |
Default implementation of the IShutdownObserver interface. More... | |
virtual int | task_execution () |
Method which runs in a separate thread if activated. More... | |
virtual int | execute_protected_region () |
indirection of the execution method, can be overloaded in derived classes to extend default behavior More... | |
Protected Member Functions inherited from Smart::ITask | |
virtual bool | test_canceled ()=0 |
Tests whether the thread has been signaled to stop. More... | |
virtual void | sleep_for (const Duration &duration)=0 |
Blocks execution of the calling thread during the span of time specified by rel_time. More... | |
Protected Member Functions inherited from Smart::IShutdownObserver | |
void | attach_self_to (ShutdownSubject *subject) |
call this method from within the constructor of derived classes More... | |
void | detach_self_from (ShutdownSubject *subject) |
this method is called within the destructor More... | |
Protected Member Functions inherited from Smart::TaskTriggerObserver | |
void | setSubject (TaskTriggerSubject *subject) |
virtual void | signalTrigger () |
virtual void | cancelTrigger () |
Additional Inherited Members | |
Protected Attributes inherited from Smart::TaskTriggerObserver | |
TaskTriggerSubject * | subject |
|
inline |
|
virtualdefault |
|
inlineprotectedvirtual |
indirection of the execution method, can be overloaded in derived classes to extend default behavior
|
pure virtual |
user hook that is called once at the beginning of the internal thread
|
pure virtual |
user hook that is called periodically in the thread (must be implemented in derived classes)
|
pure virtual |
user hook that is called once at the end of the thread
|
inlineprotectedvirtual |
Default implementation of the IShutdownObserver interface.
The default shutdown procedure is to call the stop() method which triggers the thread to stop and awaits until it is closed using the internal join method.
Reimplemented from Smart::ITask.
|
inlineprotectedvirtual |
Method which runs in a separate thread if activated.
The task_execution() method has to be provided (i.e. overloaded) by the user and it implements the activity of the task object.
Implements Smart::ITask.