|
| Clock (int period, time_t start=0) |
| Constructor for Clock. Takes a period and offset time. More...
|
|
std::string | name () |
|
void | setName (std::string name) |
|
virtual bool | isCompatibleWith (Clock::sharedPointer clock) |
| Test for compatibility (passed clock parameter may be faster, but must fall on even steps) More...
|
|
virtual bool | isValid (time_t time) |
| Test for validity of time value (if the passed value falls on this clock's regular steps) More...
|
|
virtual time_t | validTime (time_t time) |
|
virtual time_t | timeAfter (time_t time) |
| The next time step in this clock's regular pattern. More...
|
|
virtual time_t | timeBefore (time_t time) |
| The previous time step in this clock's regular pattern. More...
|
|
bool | isRegular () |
| Test for regularity (period greater than zero) More...
|
|
int | period () |
| The period of the time series. More...
|
|
void | setPeriod (int p) |
|
time_t | start () |
| The starting point for the clock. More...
|
|
void | setStart (time_t startTime) |
|
virtual std::vector< time_t > | timeValuesInRange (time_t start, time_t end) |
| Get a list of time values that are valid within a range. More...
|
|
virtual std::ostream & | toStream (std::ostream &stream) |
|
A simple clock class for keeping time synchronized.
Provides methods for comparing clocks to eachother for compatibility and testing the validity of a time value (e.g., if it falls on the regular intervals described by Clock. This class is meant to work with the TimeSeries class family to ensure that regular time series can be linked to eachother properly, and that irregular time series are only connected to TimeSeries classes that can resample (like Resampler).
Every Time Series object needs a clock. Whether the clock is based on an (offset,period) or based on a PointRecord, this clock needs to exist. By default, a TimeSeries' clock is irregular, and gets its pattern from the TS's PointRecord - the result of this is that the clock will show a valid time only for points that exist in the record. The other way to do this is to set a (offset,period) for the clock, and the result will be that the TimeSeries will only retrieve / store points on valid regular timesteps. In the first case, the PointRecord is the master synchronizer, and in the second case the Clock is the master synchronizer.
A reason for structuring it this (perhaps confusing) way is that it simplifies the implementation of TimeSeries, which is already quite complex. A TimeSeries-derived class can just depend on its clock to help it retrieve points. Whether the clock is synchronized manually or by a PointRecord is transparent to the user.