This class declares a simple virtual interface for objects that allow to be triggered periodically. The use of this class is recommended to avoid to either creating a dedicated thread for simple, periodic tasks, or to add invocations to perform such tasks to other threads of the application.
Instead, class Trigger will be the only responsible entity to trigger such actions within its own execution thread.
Definition at line 39 of file trigger.hpp.
#include <trigger.hpp>
Protected Field Index: | |
const String | Name |
Protected Method Index: | |
Triggered (const String &pName) | |
virtual | ~Triggered () |
Virtual empty destructor. Needed with any virtual class. | |
virtual void | trigger ()=0 |
virtual Ticks::Duration | triggerPeriod ()=0 |
|
friend |
Type alias in namespace alib.
Class Trigger is the only one that will trigger us and hence has access to our protected functions.
Definition at line 44 of file trigger.hpp.
|
protected |
The name of the triggered object. This is mainly used for log output and some convenience methods.
Definition at line 48 of file trigger.hpp.
Constructor. Stores the name in constant member Name. Usually these names are hard-coded C++ character arrays. If programmatically created, it has to be assured that the life-cycle of the string supersedes the lifecycle of the instnace of this class.
pName | The name of this object. |
Definition at line 54 of file trigger.hpp.
|
inlineprotectedvirtual |
Virtual empty destructor. Needed with any virtual class.
Definition at line 57 of file trigger.hpp.
|
protectedpure virtual |
Implementations need to implement this function and perform their trigger actions here.
Implemented in DedicatedWorker.
|
protectedpure virtual |
Implementations need to return the sleep time, between two trigger events. Precisely, this method is called after trigger has been executed and defines the next sleep time.
Implemented in DedicatedWorker.