An Interval defines a time duration which contains a start timestamp and an end timestamp. More...
#include <interval.hpp>
Classes | |
| class | Error |
| Interval.Error extends std::exception for errors using Interval methods. More... | |
Public Member Functions | |
| Interval (bool isValid=false) | |
| Create an Interval with the given validity value. More... | |
| Interval (MillisecondsSince1970 startTime, MillisecondsSince1970 endTime) | |
| Create a valid Interval with the given start and end times. More... | |
| void | set (const Interval &interval) |
| Set this interval to have the same values as the other interval. More... | |
| bool | covers (MillisecondsSince1970 timePoint) const |
| Check if the time point is in this interval. More... | |
| Interval & | intersectWith (const Interval &interval) |
| Set this Interval to the intersection of this and the other interval. More... | |
| Interval & | unionWith (const Interval &interval) |
| Set this Interval to the union of this and the other interval. More... | |
| MillisecondsSince1970 | getStartTime () const |
| Get the start time. More... | |
| MillisecondsSince1970 | getEndTime () const |
| Get the end time. More... | |
| bool | isValid () const |
| Check if this Interval is valid. More... | |
| bool | isEmpty () const |
| Check if this Interval is empty. More... | |
An Interval defines a time duration which contains a start timestamp and an end timestamp.
| ndn::Interval::Interval | ( | bool | isValid = false | ) |
Create an Interval with the given validity value.
| isValid | (optional) True to create a valid empty interval, false to create an invalid interval. If omitted, create an invalid interval. |
| ndn::Interval::Interval | ( | MillisecondsSince1970 | startTime, |
| MillisecondsSince1970 | endTime | ||
| ) |
Create a valid Interval with the given start and end times.
The start time must be less than the end time. To create an empty interval (start time equals end time), use the constructor Interval(true).
| startTime | The start time as milliseconds since Jan 1, 1970 UTC. |
| endTime | The end time as milliseconds since Jan 1, 1970 UTC. |
| bool ndn::Interval::covers | ( | MillisecondsSince1970 | timePoint | ) | const |
Check if the time point is in this interval.
| timePoint | The time point to check as milliseconds since Jan 1, 1970 UTC. |
| MillisecondsSince1970 ndn::Interval::getEndTime | ( | ) | const |
Get the end time.
| MillisecondsSince1970 ndn::Interval::getStartTime | ( | ) | const |
Get the start time.
| bool ndn::Interval::isEmpty | ( | ) | const |
|
inline |
Check if this Interval is valid.
|
inline |
Set this interval to have the same values as the other interval.
| interval | The other Interval with values to copy. |
Set this Interval to the union of this and the other interval.
This and the other interval should be valid but either can be empty. This and the other interval should have an intersection. (Contiguous intervals are not allowed.)
| interval | The other Interval to union with. |
| Interval::Error | if the two intervals do not have an intersection. |
1.8.6