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

Make triggering (more) regular. More...

#include <TriggerRegulator.hxx>

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

Public Member Functions

 TriggerRegulator (TriggerPuller &base, const TimeSpec &ts=TimeSpec(0, 1))
 Constructor.
 
 TriggerRegulator (boost::intrusive_ptr< TargetAndPuller > base, const TimeSpec &ts=TimeSpec(0, 1))
 Constructor with a ref-counter object as trigger.
 
 TriggerRegulator (const TimeSpec &ts=TimeSpec(0, 1))
 Constructor without triggering base, use TriggerTarget::setTrigger to specify the trigger.
 
 ~TriggerRegulator ()
 Destructor.
 
bool changePeriodAndOffset (const TimeSpec &ts)
 Change the period and offset.
 
void setPeriodAndOffset (const TimeSpec &ts)
 Set the period and offset.
 
const std::string & getTargetName () const
 Name of the regulator.
 
- 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.
 
- 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

Make triggering (more) regular.

A TriggerRegulator accepts a trigger and a time specification. Using the time specification, the triggering will be made regular. This only works with incoming spans. If a span starts (after a gap in data on a channel for example), one shorter trigger may be passed, and after this regular triggers are supplied again.

Example:

myActivity.setTrigger(
boost::intrusive_ptr<TriggerRegulator>(
This is a "light weight object" that enables you to read the latest set of data on a StreamChannelEnd...
Definition StreamReaderLatest.hxx:43
A TimeSpec is a specification for a time interval.
Definition TimeSpec.hxx:71
Make triggering (more) regular.
Definition TriggerRegulator.hxx:50

If now a triggering is provided by my_token for (150,200), (200,250), the regulator will deliver triggers (150,160), (160,180), (180,200) etc. If there is a gap in triggering, a last remaining bit of span may not be triggered.

This TriggerRegulator is not greedy, i.e., it will wait until the whole incoming span is present before providing another trigger. dueca::TriggerRegulatorGreedy will do greedy triggering, meaning that it will provide triggering as soon as a part of a new time stretch is present.

Constructor & Destructor Documentation

◆ TriggerRegulator() [1/3]

dueca::TriggerRegulator::TriggerRegulator ( TriggerPuller & base,
const TimeSpec & ts = TimeSpec(0, 1) )

Constructor.

Parameters
baseThe base triggering object
tsTime offset and period for triggering

◆ TriggerRegulator() [2/3]

dueca::TriggerRegulator::TriggerRegulator ( boost::intrusive_ptr< TargetAndPuller > base,
const TimeSpec & ts = TimeSpec(0, 1) )

Constructor with a ref-counter object as trigger.

Parameters
baseThe base triggering object
tsTime offset and period for triggering

◆ TriggerRegulator() [3/3]

dueca::TriggerRegulator::TriggerRegulator ( const TimeSpec & ts = TimeSpec(0, 1))

Constructor without triggering base, use TriggerTarget::setTrigger to specify the trigger.

Parameters
tsTime offset and period for triggering

Member Function Documentation

◆ changePeriodAndOffset()

bool dueca::TriggerRegulator::changePeriodAndOffset ( const TimeSpec & ts)

Change the period and offset.

Prepare a new period and offset. Through triggering, the so prepared object should be "picked up". Returns false if not possible.

Parameters
tsTime specification defining new period and offset.
Returns
true if the change is accepted.

◆ setPeriodAndOffset()

void dueca::TriggerRegulator::setPeriodAndOffset ( const TimeSpec & ts)
inline

Set the period and offset.

Note that this is not thread-safe, and should only be done before running.

Parameters
tsTime specification defining new period and offset.

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