DUDS
Distributed Update of Data from Something
duds::time::planetary::LeapBounds< Clock, Duration, Count > Class Template Reference

A container holding the number of leap seconds and the time bounds over which the leap seconds are applied. More...

#include <LeapBounds.hpp>

Public Types

typedef duds::time::interstellar::TimePoint< Clock, Duration > TimePoint
 The time point type used in this class. More...
 

Public Member Functions

constexpr LeapBounds ()
 A default constructor that sets invalid bounds and no leap seconds. More...
 
constexpr LeapBounds (const TimePoint &minimum, const TimePoint &maximum, const Count &leaps)
 Constructs with specific values. More...
 
 LeapBounds (const LeapBounds &)=default
 
template<class OtherClock , class OtherDuration , class OtherCount >
 LeapBounds (const LeapBounds< OtherClock, OtherDuration, OtherCount > &lb)
 Constructs from a different LeapBounds template. More...
 
const Count & leaps () const
 Returns the leap seconds in this period. More...
 
const TimePointmaximum () const
 Returns the maximum bound time; the maximum is inclusive. More...
 
const TimePointminimum () const
 Returns the minimum bound time; the minimum is exclusive. More...
 
LeapBoundsoperator= (const LeapBounds &)=default
 
template<class OtherClock , class OtherDuration , class OtherCount >
LeapBoundsoperator= (const LeapBounds< OtherClock, OtherDuration, OtherCount > &lb)
 Assigns from a different LeapBounds template. More...
 
bool valid () const
 Checks for validity; false if the maximum bound is under the minimum bound. More...
 
template<class OtherClock , class OtherDuration >
bool within (const duds::time::interstellar::TimePoint< OtherClock, OtherDuration > &time) const
 Returns true if the given provided time is within bounds. More...
 
bool within (const TimePoint &time) const
 Returns true if the given provided time is within bounds. More...
 

Private Attributes

TimePoint max
 The maximum bound time. More...
 
TimePoint min
 The minimum bound time; times within bounds do not include this time. More...
 
Count total
 The total leap seconds to apply during this period. More...
 

Detailed Description

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
class duds::time::planetary::LeapBounds< Clock, Duration, Count >

A container holding the number of leap seconds and the time bounds over which the leap seconds are applied.

Useful in cases when leap seconds will be regularly queried, but the queries will normally be for similar times. The template parameters allow for either smaller storage, or storage of the specific types that will be used (compared, added) to avoid run-time conversions.

Template Parameters
ClockThe clock type used with duds::time::interstellar::TimePoint to define the time bounds.
DurationThe duration type used with duds::time::interstellar::TimePoint to define the time bounds.
CountThe duration type used to store the number of leap seconds.
Author
Jeff Jackowski

Definition at line 38 of file LeapBounds.hpp.

Member Typedef Documentation

◆ TimePoint

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
typedef duds::time::interstellar::TimePoint<Clock, Duration> duds::time::planetary::LeapBounds< Clock, Duration, Count >::TimePoint

The time point type used in this class.

Definition at line 43 of file LeapBounds.hpp.

Constructor & Destructor Documentation

◆ LeapBounds() [1/4]

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
constexpr duds::time::planetary::LeapBounds< Clock, Duration, Count >::LeapBounds ( )
inline

A default constructor that sets invalid bounds and no leap seconds.

Definition at line 61 of file LeapBounds.hpp.

Referenced by duds::time::planetary::LeapBounds< Clock, Duration, Count >::LeapBounds().

◆ LeapBounds() [2/4]

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
constexpr duds::time::planetary::LeapBounds< Clock, Duration, Count >::LeapBounds ( const TimePoint minimum,
const TimePoint maximum,
const Count &  leaps 
)
inline

Constructs with specific values.

Parameters
minimumThe minimum bound for the period.
maximumThe maximum bound for the period.
leapsThe number of leap seconds to apply during the period.

Definition at line 71 of file LeapBounds.hpp.

◆ LeapBounds() [3/4]

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
duds::time::planetary::LeapBounds< Clock, Duration, Count >::LeapBounds ( const LeapBounds< Clock, Duration, Count > &  )
default

◆ LeapBounds() [4/4]

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
template<class OtherClock , class OtherDuration , class OtherCount >
duds::time::planetary::LeapBounds< Clock, Duration, Count >::LeapBounds ( const LeapBounds< OtherClock, OtherDuration, OtherCount > &  lb)
inline

Constructs from a different LeapBounds template.

Parameters
lbA LeapBounds object. Its values will be converted to the types used by this object and the stored.

Definition at line 98 of file LeapBounds.hpp.

Member Function Documentation

◆ leaps()

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
const Count& duds::time::planetary::LeapBounds< Clock, Duration, Count >::leaps ( ) const
inline

Returns the leap seconds in this period.

Definition at line 118 of file LeapBounds.hpp.

Referenced by duds::time::planetary::Earth::addLeapSeconds(), and duds::time::planetary::LeapBounds< Clock, Duration, Count >::operator=().

◆ maximum()

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
const TimePoint& duds::time::planetary::LeapBounds< Clock, Duration, Count >::maximum ( ) const
inline

Returns the maximum bound time; the maximum is inclusive.

Definition at line 112 of file LeapBounds.hpp.

Referenced by duds::time::planetary::LeapBounds< Clock, Duration, Count >::operator=().

◆ minimum()

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
const TimePoint& duds::time::planetary::LeapBounds< Clock, Duration, Count >::minimum ( ) const
inline

Returns the minimum bound time; the minimum is exclusive.

Definition at line 106 of file LeapBounds.hpp.

Referenced by duds::time::planetary::LeapBounds< Clock, Duration, Count >::operator=().

◆ operator=() [1/2]

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
LeapBounds& duds::time::planetary::LeapBounds< Clock, Duration, Count >::operator= ( const LeapBounds< Clock, Duration, Count > &  )
default

◆ operator=() [2/2]

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
template<class OtherClock , class OtherDuration , class OtherCount >
LeapBounds& duds::time::planetary::LeapBounds< Clock, Duration, Count >::operator= ( const LeapBounds< OtherClock, OtherDuration, OtherCount > &  lb)
inline

Assigns from a different LeapBounds template.

Parameters
lbA LeapBounds object. Its values will be converted to the types used by this object and the stored.

Definition at line 84 of file LeapBounds.hpp.

◆ valid()

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
bool duds::time::planetary::LeapBounds< Clock, Duration, Count >::valid ( ) const
inline

Checks for validity; false if the maximum bound is under the minimum bound.

Definition at line 145 of file LeapBounds.hpp.

◆ within() [1/2]

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
template<class OtherClock , class OtherDuration >
bool duds::time::planetary::LeapBounds< Clock, Duration, Count >::within ( const duds::time::interstellar::TimePoint< OtherClock, OtherDuration > &  time) const
inline

Returns true if the given provided time is within bounds.

Parameters
timeThe time to check.
Returns
True if time is within the bounds of this period.

Definition at line 127 of file LeapBounds.hpp.

Referenced by duds::time::planetary::Earth::addLeapSeconds().

◆ within() [2/2]

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
bool duds::time::planetary::LeapBounds< Clock, Duration, Count >::within ( const TimePoint time) const
inline

Returns true if the given provided time is within bounds.

Parameters
timeThe time to check.
Returns
True if time is within the bounds of this period.

Definition at line 138 of file LeapBounds.hpp.

Member Data Documentation

◆ max

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
TimePoint duds::time::planetary::LeapBounds< Clock, Duration, Count >::max
private

◆ min

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
TimePoint duds::time::planetary::LeapBounds< Clock, Duration, Count >::min
private

The minimum bound time; times within bounds do not include this time.

Definition at line 48 of file LeapBounds.hpp.

Referenced by duds::time::planetary::LeapBounds< Clock, Duration, Count >::minimum().

◆ total

template<class Clock = duds::time::interstellar::SecondClock, class Duration = duds::time::interstellar::Seconds, class Count = duds::time::interstellar::Seconds>
Count duds::time::planetary::LeapBounds< Clock, Duration, Count >::total
private

The total leap seconds to apply during this period.

Definition at line 56 of file LeapBounds.hpp.

Referenced by duds::time::planetary::LeapBounds< Clock, Duration, Count >::leaps().


The documentation for this class was generated from the following file: