SmartSoft Component-Developer API
Public Member Functions | Protected Member Functions | List of all members
Smart::IManagedTask Class Referenceabstract

#include <smartIManagedTask.h>

Inheritance diagram for Smart::IManagedTask:
Smart::ITask Smart::TaskTriggerObserver Smart::IShutdownObserver

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
TaskTriggerSubjectsubject
 

Constructor & Destructor Documentation

◆ IManagedTask()

Smart::IManagedTask::IManagedTask ( IComponent component,
TaskTriggerSubject trigger = nullptr 
)
inline

◆ ~IManagedTask()

virtual Smart::IManagedTask::~IManagedTask ( )
virtualdefault

Member Function Documentation

◆ execute_protected_region()

virtual int Smart::IManagedTask::execute_protected_region ( )
inlineprotectedvirtual

indirection of the execution method, can be overloaded in derived classes to extend default behavior

◆ on_entry()

virtual int Smart::IManagedTask::on_entry ( )
pure virtual

user hook that is called once at the beginning of the internal thread

◆ on_execute()

virtual int Smart::IManagedTask::on_execute ( )
pure virtual

user hook that is called periodically in the thread (must be implemented in derived classes)

◆ on_exit()

virtual int Smart::IManagedTask::on_exit ( )
pure virtual

user hook that is called once at the end of the thread

◆ on_shutdown()

virtual void Smart::IManagedTask::on_shutdown ( )
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.

◆ task_execution()

virtual int Smart::IManagedTask::task_execution ( )
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.

Returns
0 for all OK or -1 otherwise

Implements Smart::ITask.


The documentation for this class was generated from the following file: