DUECA/DUSIME
|
Make triggering (more) regular. More...
#include <TriggerRegulator.hxx>
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< TargetData > | targetlist_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_MANAGERS > | activitylevels |
Index of activitymanager levels. | |
std::string | name |
Name, for debugging purposes. | |
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:
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.
dueca::TriggerRegulator::TriggerRegulator | ( | TriggerPuller & | base, |
const TimeSpec & | ts = TimeSpec(0, 1) ) |
Constructor.
base | The base triggering object |
ts | Time offset and period for triggering |
dueca::TriggerRegulator::TriggerRegulator | ( | boost::intrusive_ptr< TargetAndPuller > | base, |
const TimeSpec & | ts = TimeSpec(0, 1) ) |
Constructor with a ref-counter object as trigger.
base | The base triggering object |
ts | Time offset and period for triggering |
Constructor without triggering base, use TriggerTarget::setTrigger to specify the trigger.
ts | Time offset and period for triggering |
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.
ts | Time specification defining new period and offset. |
Set the period and offset.
Note that this is not thread-safe, and should only be done before running.
ts | Time specification defining new period and offset. |