ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::threadmodel::Triggered Class Referenceabstract

Description:

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.

See also
Chapter 4. Class Trigger and Interface class Triggered of this module's Programmer's Manual provides a quick source code sample that demonstrates the use this class.

Definition at line 26 of file trigger.inl.

Inheritance diagram for alib::threadmodel::Triggered:
[legend]
Collaboration diagram for alib::threadmodel::Triggered:
[legend]

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
 

Friends And Related Entity Details:

◆ Trigger

friend class Trigger
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 31 of file trigger.inl.

Field Details:

◆ Name

const String alib::threadmodel::Triggered::Name
protected

The name of the triggered object. This is mainly used for log output and some convenience methods.

Availability
This field is available only if the module ALib Strings is included in the ALib Build.

Definition at line 38 of file trigger.inl.

Constructor(s) / Destructor Details:

◆ Triggered()

alib::threadmodel::Triggered::Triggered ( const String & pName)
inlineprotected

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.

Parameters
pNameThe name of this object.

Definition at line 44 of file trigger.inl.

◆ ~Triggered()

virtual alib::threadmodel::Triggered::~Triggered ( )
inlineprotectedvirtual

Virtual empty destructor. Needed with any virtual class.

Definition at line 50 of file trigger.inl.

Method Details:

◆ trigger()

virtual void alib::threadmodel::Triggered::trigger ( )
protectedpure virtual

Implementations need to implement this function and perform their trigger actions here.

Implemented in alib::threadmodel::DedicatedWorker.

◆ triggerPeriod()

virtual Ticks::Duration alib::threadmodel::Triggered::triggerPeriod ( )
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.

Returns
The desired sleep time between two trigger events.

Implemented in alib::threadmodel::DedicatedWorker.


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