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

A PeriodicTimeSpec is derived from the normal TimeSpec. More...

#include <TimeSpec.hxx>

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

Public Member Functions

 PeriodicTimeSpec (const PeriodicTimeSpec &)
 Copy constructor.
 
 PeriodicTimeSpec (const TimeSpec &)
 Constructor that creates a PeriodicTimeSpec from a TimeSpec.
 
 PeriodicTimeSpec (TimeTickType validity_start=0, TimeTickType period=1)
 Constructor.
 
bool complete ()
 Complete method, called after constructor and supply of parameters, has to check the validity of the parameters.
 
const chargetTypeName ()
 Type name information.
 
 ~PeriodicTimeSpec ()
 Destructor.
 
TimeSpecclone () const
 Clone method, re-implemented from TimeSpec.
 
bool advance (const TimeSpec &a)
 Advances the interval in the PeriodicTimeSpec with a value equal to the period specified in its creation, but only if the end time specified in the TimeSpec parameter is beyond the PeriodicTimeSpec's end time.
 
bool advance (const DataTimeSpec &a)
 Advance with a DataTimeSpec.
 
bool advance (const TimeTickType &validity_end=MAX_TIMETICK)
 Advance with an end time tick.
 
bool greedyAdvance (const DataTimeSpec &a)
 "Greedy" variant of the advance method.
 
bool forceAdvance (const TimeTickType &validity_point)
 Spool ahead fast (so forget all the intermediate intervals), to the time specified in the argument.
 
bool forceAdvance (const DataTimeSpec &t)
 Spool ahead fast.
 
void slideAdvance (const TimeTickType &t)
 Slide forward, can also change offset.
 
TimeTickType getPeriod () const
 Read back the period.
 
void setPeriod (TimeTickType p)
 Change the period.
 
ostreamprint (ostream &os) const
 Write to stream, mainly for debugging purposes.
 
- Public Member Functions inherited from dueca::TimeSpec
 TimeSpec (const TimeSpec &)
 Copy constructor.
 
 TimeSpec (TimeTickType validity_start, TimeTickType validity_end)
 Complete constructor, with the start and end time.
 
 TimeSpec (int validity_start, int validity_end)
 Complete constructor, with the start and end time.
 
 TimeSpec (TimeTickType validity_start)
 Constructor for a TimeSpec that starts and ends at the same time.
 
 TimeSpec (double validity_start, double validity_end)
 Constructor with double arguments.
 
 TimeSpec (float validity_start, float validity_end)
 Variation with float.
 
 TimeSpec (const DataTimeSpec &)
 Constructor with a DataTimeSpec as input.
 
 TimeSpec ()
 Default constructor.
 
virtual ~TimeSpec ()
 Destructor.
 
TimeTickType getValidityStart () const
 Returns the time at which the interval starts.
 
TimeTickType getValidityEnd () const
 Returns the time at which the interval has ended.
 
TimeTickType getValiditySpan () const
 Returns the size of the interval.
 
bool operator== (const TimeSpec &other) const
 Compare one interval to another.
 
bool operator!= (const TimeSpec &other) const
 Compare one interval to another, and return true when not equal.
 
TimeSpec operator+ (const int delta) const
 Move an interval up with a time delta.
 
TimeSpec operator+ (const unsigned int delta) const
 Move an interval up with a time delta.
 
TimeSpec operator+ (const double delta) const
 Move an interval up with a time in seconds.
 
TimeSpec operator+ (const float delta) const
 Move an interval up with a time in seconds.
 
TimeSpec operator- (const double delta) const
 Move an interval up with a time in seconds.
 
TimeSpec operator- (const float delta) const
 Move an interval up with a time in seconds.
 
TimeSpec operator- (const int delta) const
 Move an interval back with a time delta.
 
TimeSpec operator- (const unsigned int delta) const
 Move an interval back with a time delta.
 
int operator- (const TimeSpec &to) const
 Get the difference between two timespec's.
 
TimeSpecoperator= (const DataTimeSpec &o)
 Copy from a data timespec.
 
double getDtInSeconds () const
 Get the value of the interval in seconds.
 
int getUsecsElapsed () const
 Find out how many microseconds elapsed since the formal start of this time.
 
ostreamprint (ostream &os) const
 Write to stream, mainly for debugging purposes.
 

Static Public Member Functions

static const ParameterTablegetParameterTable ()
 Obtain a pointer to the parameter table.
 
- Static Public Member Functions inherited from dueca::TimeSpec
static const TimeSpecendOfTime ()
 The time spec at the end of time.
 
static const TimeSpecstartOfTime ()
 The time spec at the beginning of time.
 

Static Public Attributes

static const charclassname
 Class name, for error messages.
 
- Static Public Attributes inherited from dueca::TimeSpec
static const TimeSpec end_of_time
 A special time spec at the end of time.
 
static const TimeSpec start_of_time
 Timespec at the start of time.
 

Additional Inherited Members

- Protected Attributes inherited from dueca::TimeSpec
TimeTickType validity_start
 The time interval starts here.
 
TimeTickType validity_end
 The time interval ends before this.
 

Detailed Description

A PeriodicTimeSpec is derived from the normal TimeSpec.

It behaves differently, in that it tries to enforce the period specified at its creation in the "advance" updates.

Constructor & Destructor Documentation

◆ PeriodicTimeSpec() [1/2]

dueca::PeriodicTimeSpec::PeriodicTimeSpec ( const TimeSpec & )

Constructor that creates a PeriodicTimeSpec from a TimeSpec.

The interval between the end and start times is taken as the period.

◆ PeriodicTimeSpec() [2/2]

dueca::PeriodicTimeSpec::PeriodicTimeSpec ( TimeTickType validity_start = 0,
TimeTickType period = 1 )

Constructor.

Acts like a normal TimeSpec constructor, and makes a TimeSpec initially equal to [validity_start, validity_start+period).

Member Function Documentation

◆ clone()

TimeSpec * dueca::PeriodicTimeSpec::clone ( ) const
virtual

Clone method, re-implemented from TimeSpec.

Reimplemented from dueca::TimeSpec.

◆ advance() [1/3]

bool dueca::PeriodicTimeSpec::advance ( const TimeSpec & a)
virtual

Advances the interval in the PeriodicTimeSpec with a value equal to the period specified in its creation, but only if the end time specified in the TimeSpec parameter is beyond the PeriodicTimeSpec's end time.

if the method returns false, no advance was made, if the method returns true, and advance was made. This is central to the frequency step-up and step-down method used in DUECA.

Reimplemented from dueca::TimeSpec.

◆ advance() [2/3]

bool dueca::PeriodicTimeSpec::advance ( const DataTimeSpec & a)
virtual

Advance with a DataTimeSpec.

Reimplemented from dueca::TimeSpec.

◆ advance() [3/3]

bool dueca::PeriodicTimeSpec::advance ( const TimeTickType & validity_end = MAX_TIMETICK)
virtual

Advance with an end time tick.

Reimplemented from dueca::TimeSpec.

◆ greedyAdvance()

bool dueca::PeriodicTimeSpec::greedyAdvance ( const DataTimeSpec & a)

"Greedy" variant of the advance method.

Advances until the a.validity_end is no longer past the current time spec start

Parameters
aTime span to cover.

◆ forceAdvance() [1/2]

bool dueca::PeriodicTimeSpec::forceAdvance ( const TimeTickType & validity_point)
virtual

Spool ahead fast (so forget all the intermediate intervals), to the time specified in the argument.

The PeriodicTimeSpec will not forget its offset+period when doing this, so the actual time to which it spools may be rounded off downwards.

Reimplemented from dueca::TimeSpec.

◆ forceAdvance() [2/2]

bool dueca::PeriodicTimeSpec::forceAdvance ( const DataTimeSpec & t)
virtual

Spool ahead fast.

Reimplemented from dueca::TimeSpec.

Member Data Documentation

◆ classname

const char* dueca::PeriodicTimeSpec::classname
static

Class name, for error messages.

A white lie, actually PeriodicTimeSpec, but this timespec doubles for all in the script creation


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