DUECA/DUSIME
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dueca::AperiodicAlarm Class Reference

This is a triggering device that can provide your activity with user-controlled, a-periodic triggering. More...

#include <AperiodicAlarm.hxx>

Inheritance diagram for dueca::AperiodicAlarm:
Inheritance graph
[legend]
Collaboration diagram for dueca::AperiodicAlarm:
Collaboration graph
[legend]

Public Member Functions

 AperiodicAlarm (const std::string &name=std::string("AperiodicAlarm()"))
 Constructor.
 
 ~AperiodicAlarm ()
 Destructor.
 
const std::string & getTargetName () const
 And a target name too.
 
bool requestAlarm (TimeTickType time)
 Request a tick from the alarm.
 
void requestAlarm ()
 Request the earliest next alarm.
 
- Public Member Functions inherited from dueca::TargetAndPuller
void addTerm (TriggerPuller &p)
 Add another puller to this (and, or) combination of triggers.
 
void addTerm (const boost::intrusive_ptr< TargetAndPuller > &p)
 Add another puller to this combination.
 
bool removeTerm (TriggerPuller &p)
 Remove a term from this TriggerAnd or TriggerOr object.
 
- Public Member Functions inherited from dueca::TriggerPuller
const std::string & getTriggerName () const
 Find a name.
 

Additional Inherited Members

- Protected Types inherited from dueca::TriggerPuller
typedef list< TargetDatatargetlist_type
 Combination of a target, someone to pull if requested, and the index that target needs to identify this puller.
 
- Protected Member Functions inherited from dueca::TargetAndPuller
 TargetAndPuller (const std::string &name=std::string())
 Constructor.
 
virtual ~TargetAndPuller ()
 Destructor.
 
- Protected Member Functions inherited from dueca::TriggerPuller
void pull (const DataTimeSpec &ts)
 activate and notify the targets
 
 TriggerPuller (const std::string &name=std::string())
 Constructor.
 
virtual ~TriggerPuller ()
 Destructor.
 
virtual void addTarget (const boost::intrusive_ptr< TriggerTarget > &target, unsigned id)
 Add a target to this puller, only called by TriggerTarget's setTrigger.
 
virtual void removeTarget (const TriggerTarget *target)
 Remove a target from the puller, only called by destructor.
 
virtual void setTriggerName ()
 Update the name, used by ConditionAnd and ConditionOr.
 
- Protected Attributes inherited from dueca::TargetAndPuller
unsigned name_psize
 Number of pullers when name calculated.
 
- Protected Attributes inherited from dueca::TriggerPuller
targetlist_type targets
 List of targets and indices.
 
std::bitset< MAX_MANAGERSactivitylevels
 Index of activitymanager levels.
 
std::string name
 Name, for debugging purposes.
 

Detailed Description

This is a triggering device that can provide your activity with user-controlled, a-periodic triggering.

Create an a-periodic alarm, e.g. as one of the objects in your module class, and request to be triggered at some time.

Triggering will take place at the clock time specified for the alarm, or with the next available clock tick if that time has already passed.

Member Function Documentation

◆ requestAlarm() [1/2]

bool dueca::AperiodicAlarm::requestAlarm ( TimeTickType time)

Request a tick from the alarm.

This will fail and return false if the ticks are not in chronological order!.

Parameters
timefor which the alarm should "sound".
Returns
True if the alarm could be implemented, false if not. The only reason for failure of implementation of an alarm is that the time requested is smaller (earlier) than a time requested earlier. In other words, alarms only stack up at the end.

◆ requestAlarm() [2/2]

void dueca::AperiodicAlarm::requestAlarm ( )

Request the earliest next alarm.

The AperiodicAlarm class keeps a record of the triggering time, which is updated with the time you feed to the requestAlarm(TimeTickType time) call, or, when you use this call, it is incremented by one.

If you only use this alarm, you get triggers at 0, 1, 2 etc. However, an activity only runs when it is switched on. If you switch on your activity later, it usually gets a switch-on time in the thousands, and all these initial triggers are lost. To prevent this, in this case switch on your activity from the "beginning of time",

my_activity.switchOn(0);

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