meos::Period class

Time interval with either inclusive or exlusive bounds.

  • Empty periods are not allowed.
  • Periods with lower == upper are called instant periods.
  • Instant periods can only have inclusive bounds.

Constructors, destructors, conversion operators

Period()
Period(time_point const lower, time_point const upper, bool const lower_inc = true, bool const upper_inc = false)
Period(std::string const& lower, std::string const& upper, bool const lower_inc = true, bool const upper_inc = false)
Period(std::string const& serialized)

Public functions

auto clone() -> std::unique_ptr<Period>
auto lower() const -> time_point
auto upper() const -> time_point
auto lower_inc() const -> bool
auto upper_inc() const -> bool
auto timespan() const -> duration_ms
auto shift(duration_ms const timedelta) const -> std::unique_ptr<Period>
auto overlap(Period const& period) const -> bool
auto contains_timestamp(time_point const timestamp) const -> bool

Friends

auto operator==(Period const& lhs, Period const& rhs) -> bool
auto operator!=(Period const& lhs, Period const& rhs) -> bool
auto operator<(Period const& lhs, Period const& rhs) -> bool
auto operator>(Period const& lhs, Period const& rhs) -> bool
auto operator>=(Period const& lhs, Period const& rhs) -> bool
auto operator<=(Period const& lhs, Period const& rhs) -> bool
auto operator>>(std::istream& in, Period& period) -> std::istream&
auto operator<<(std::ostream& os, Period const& period) -> std::ostream&