Returns the time series within the (optional) time range.
| 84 | |
| 85 | // Returns the time series within the (optional) time range. |
| 86 | std::vector<Value> get( |
| 87 | const Option<Time>& start = None(), |
| 88 | const Option<Time>& stop = None()) const |
| 89 | { |
| 90 | // Ignore invalid ranges. |
| 91 | if (start.isSome() && stop.isSome() && start.get() > stop.get()) { |
| 92 | return std::vector<Value>(); |
| 93 | } |
| 94 | |
| 95 | typename std::map<Time, T>::const_iterator lower = values.lower_bound( |
| 96 | start.isSome() ? start.get() : Time::epoch()); |
| 97 | |
| 98 | typename std::map<Time, T>::const_iterator upper = values.upper_bound( |
| 99 | stop.isSome() ? stop.get() : Time::max()); |
| 100 | |
| 101 | std::vector<Value> values; |
| 102 | while (lower != upper) { |
| 103 | values.push_back(Value(lower->first, lower->second)); |
| 104 | ++lower; |
| 105 | } |
| 106 | return values; |
| 107 | } |
| 108 | |
| 109 | Option<Value> latest() const |
| 110 | { |