ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
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 39 of file trigger.hpp.

#include <trigger.hpp>

Inheritance diagram for Triggered:
[legend]
Collaboration diagram for 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 44 of file trigger.hpp.

Field Details:

◆ Name

const String Name
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(s) / Destructor Details:

◆ 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 54 of file trigger.hpp.

◆ ~Triggered()

virtual ~Triggered ( )
inlineprotectedvirtual

Virtual empty destructor. Needed with any virtual class.

Definition at line 57 of file trigger.hpp.

Method Details:

◆ trigger()

virtual void trigger ( )
protectedpure virtual

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

Implemented in DedicatedWorker.

◆ triggerPeriod()

virtual Ticks::Duration 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 DedicatedWorker.


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