Class SampleTimes
Defined in File sample_times.hpp
Class Documentation
-
class SampleTimes
The times a range of samples was taken at, as a closed form.
Sampling returns values only, because the times they were taken at are fully described by a start, a step and a count — storing them would double the memory for no information. This holds those three numbers and computes a time on demand, so indexing it costs a multiply and an add and nothing is allocated.
Obtain one from Channel::sample_times(), Channel::sample_times_by_rate(), or the free functions of the same names for an arbitrary range. Those apply the same step rule the matching evaluate_range() call does, so element
iis exactly the time elementiof the returned values was evaluated at.Public Functions
-
inline SampleTimes(double start, double step, size_t count)
Constructs a sequence of
counttimes fromstart,stepapart.Prefer the sample_times() functions, which derive
stepfrom a range and a RangeEnd rather than leaving it to the caller to restate that rule.
-
inline double operator[](size_t index) const
The time of sample
index. Not bounds-checked; see at().
-
inline double at(size_t index) const
The time of sample
index.- Throws:
std::out_of_range – if out of range.
-
inline size_t size() const
Number of samples described.
-
inline bool empty() const
Whether there are no samples.
-
inline double front() const
Time of the first sample.
-
inline double step() const
Spacing between consecutive samples.
-
inline bool operator==(const SampleTimes &other) const
-
inline bool operator!=(const SampleTimes &other) const
-
inline SampleTimes(double start, double step, size_t count)