DUECA/DUSIME
|
A TimeSpec is a specification for a time interval. More...
#include <TimeSpec.hxx>
Public Member Functions | |
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. | |
virtual TimeSpec * | clone () const |
This clones a TimeSpec, giving back a pointer to an identical copy. | |
virtual bool | advance (const TimeSpec &a) |
Move the time forward with the data given in another TimeSpec. | |
virtual bool | advance (const DataTimeSpec &a) |
Move the time forward with the data given in a DataTimeSpec. | |
virtual bool | advance (const TimeTickType &validity_end=MAX_TIMETICK) |
Move the time to the next contiguous interval, that ends at the end tick specified in the parameter. | |
virtual bool | forceAdvance (const TimeTickType &validity_point) |
Jump ahead in time, possibly leaving a gap. | |
virtual bool | forceAdvance (const DataTimeSpec &t) |
Jump ahead in time, possibly leaving a gap. | |
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. | |
TimeSpec & | operator= (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. | |
ostream & | print (ostream &os) const |
Write to stream, mainly for debugging purposes. | |
Static Public Member Functions | |
static const TimeSpec & | endOfTime () |
The time spec at the end of time. | |
static const TimeSpec & | startOfTime () |
The time spec at the beginning of time. | |
Static Public Attributes | |
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. | |
Protected Attributes | |
TimeTickType | validity_start |
The time interval starts here. | |
TimeTickType | validity_end |
The time interval ends before this. | |
Friends | |
struct | DataTimeSpec |
class | PeriodicTimeSpec |
A TimeSpec is a specification for a time interval.
It is given in integer time steps, and defines the step from which the time interval is valid, and the step from which it is no longer valid.
dueca::TimeSpec::TimeSpec | ( | TimeTickType | validity_start, |
TimeTickType | validity_end ) |
Complete constructor, with the start and end time.
validity_start | time tick at which data becomes valid |
validity_end | time tick at which data (calc, etc.) becomes invalid. |
Complete constructor, with the start and end time.
This time an integer variation, since often simply integer arguments are given.
validity_start | time tick at which data becomes valid |
validity_end | time tick at which data (calc, etc.) becomes invalid. |
dueca::TimeSpec::TimeSpec | ( | TimeTickType | validity_start | ) |
Constructor for a TimeSpec that starts and ends at the same time.
For example events are like this.
Constructor with double arguments.
Note that the argument will be converted to time ticks, and that rounding off may occur.
If start and end are not exactly (as in floating point exactly) equal, the integer end time tick will always be at least one higher than the start time tick. This is to prevent creation of 0 timespans, which can produce infinite loops in clocks.
validity_start | time (in s!) at which data becomes valid |
validity_end | time (in s!) at which data (calc, etc.) becomes invalid. |
Variation with float.
Note that the argument will be converted to time ticks, and that rounding off may occur.
If start and end are not exactly (as in floating point exactly) equal, the integer end time tick will always be at least one higher than the start time tick. This is to prevent creation of 0 timespans, which can produce infinite loops in clocks.
validity_start | time (in s!) at which data becomes valid |
validity_end | time (in s!) at which data (calc, etc.) becomes invalid. |
This clones a TimeSpec, giving back a pointer to an identical copy.
Also clones the derived classes.
Reimplemented in dueca::PeriodicTimeSpec.
Move the time forward with the data given in another TimeSpec.
a | TimeSpec with new times. |
Reimplemented in dueca::PeriodicTimeSpec.
|
virtual |
Move the time forward with the data given in a DataTimeSpec.
a | TimeSpec with new times. |
Reimplemented in dueca::PeriodicTimeSpec.
Move the time to the next contiguous interval, that ends at the end tick specified in the parameter.
Reimplemented in dueca::PeriodicTimeSpec.
Jump ahead in time, possibly leaving a gap.
This does not do great wonders for a TimeSpec, but a PeriodicTimeSpec (one of the derived classes) has different behaviour to an advance and a forceAdvance.
Reimplemented in dueca::PeriodicTimeSpec.
|
virtual |
Jump ahead in time, possibly leaving a gap.
Reimplemented in dueca::PeriodicTimeSpec.