Honeycomb  0.1
Component-Model Framework
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
honey::Duration< Rep_, Period_ > Class Template Reference

Duration represented by repetitions of a period. The period must be a ratio. More...

#include <Duration.h>

Public Types

typedef Rep_ Rep
 
typedef Period_ Period
 

Public Member Functions

constexpr Duration ()=default
 
template<class Rep2 >
constexpr Duration (const Rep2 &rep)
 Construct from repetition. More...
 
template<class Rep2 , class Period2 , class Ratio = typename Period2::template div<Period>::type>
constexpr Duration (const Duration< Rep2, Period2 > &d)
 Construct from another type of duration. More...
 
template<class Rep2 , class Period2 , class Ratio = typename Period2::template div<Period>::type>
Durationoperator= (const Duration< Rep2, Period2 > &rhs)
 
constexpr Duration operator+ () const
 
Durationoperator++ ()
 
Duration operator++ (int) const
 
Durationoperator+= (const Duration &rhs)
 
constexpr Duration operator- () const
 
Durationoperator-- ()
 
Duration operator-- (int) const
 
Durationoperator-= (const Duration &rhs)
 
Durationoperator*= (const Rep &rhs)
 
Durationoperator/= (const Rep &rhs)
 
Durationoperator%= (const Rep &rhs)
 
Durationoperator%= (const Duration &rhs)
 
template<class Rep2 , class Period2 , class DurCommon = typename std::common_type<Duration, Duration<Rep2,Period2>>::type>
constexpr bool operator== (const Duration< Rep2, Period2 > &rhs) const
 
template<class Rep2 , class Period2 >
constexpr bool operator!= (const Duration< Rep2, Period2 > &rhs) const
 
template<class Rep2 , class Period2 , class DurCommon = typename std::common_type<Duration, Duration<Rep2,Period2>>::type>
constexpr bool operator< (const Duration< Rep2, Period2 > &rhs) const
 
template<class Rep2 , class Period2 >
constexpr bool operator> (const Duration< Rep2, Period2 > &rhs) const
 
template<class Rep2 , class Period2 >
constexpr bool operator<= (const Duration< Rep2, Period2 > &rhs) const
 
template<class Rep2 , class Period2 >
constexpr bool operator>= (const Duration< Rep2, Period2 > &rhs) const
 
constexpr Rep count () const
 Get number of repetitions of period. More...
 

Static Public Member Functions

static constexpr Duration zero ()
 Zero duration. More...
 
static constexpr Duration min ()
 Minimum duration (negative reps) More...
 
static constexpr Duration max ()
 Maximum duration (positive reps) More...
 

Friends

template<class Rep , class Period >
class Duration
 

Related Functions

(Note that these are not member functions.)

Duration types
typedef Duration< int64, ratio::NanoNanosec
 
typedef Duration< int64, ratio::MicroMicrosec
 
typedef Duration< int64, ratio::MilliMillisec
 
typedef Duration< int64, ratio::UnitSeconds
 
typedef Duration< int, Seconds::Period::mul< Ratio< 60 > >::type > Minutes
 
typedef Duration< int, Minutes::Period::mul< Ratio< 60 > >::type > Hours
 
typedef Duration< int, Hours::Period::mul< Ratio< 24 > >::type > Days
 
Duration operators
template<class Rep , class Period , class Rep2 , class Period2 , class DurCommon = typename std::common_type<Duration<Rep,Period>, Duration<Rep2,Period2>>::type>
constexpr DurCommon operator+ (const Duration< Rep, Period > &lhs, const Duration< Rep2, Period2 > &rhs)
 operator+(Duration, Duration). Returns a duration with best-fit period and repetition types. More...
 
template<class Rep , class Period , class Rep2 , class Period2 , class DurCommon = typename std::common_type<Duration<Rep,Period>, Duration<Rep2,Period2>>::type>
constexpr DurCommon operator- (const Duration< Rep, Period > &lhs, const Duration< Rep2, Period2 > &rhs)
 operator-(Duration, Duration). Returns a duration with best-fit period and repetition types. More...
 
template<class Rep , class Period , class Rep2 , class DurCommon = Duration<typename std::common_type<Rep,Rep2>::type, Period>>
constexpr DurCommon operator* (const Duration< Rep, Period > &lhs, const Rep2 &rhs)
 operator*(Duration, Rep). Returns a duration of best-fit period and repetition types. More...
 
template<class Rep , class Rep2 , class Period , class DurCommon = Duration<typename std::common_type<Rep,Rep2>::type, Period>>
constexpr DurCommon operator* (const Rep &lhs, const Duration< Rep2, Period > &rhs)
 operator*(Rep, Duration). Returns a duration of best-fit period and repetition types. More...
 
template<class Rep , class Period , class Rep2 , typename mt::disable_if< mt::isSpecializationOf< Rep2, Duration >::value, int >::type = 0, class DurCommon = Duration<typename std::common_type<Rep,Rep2>::type, Period>>
constexpr DurCommon operator/ (const Duration< Rep, Period > &lhs, const Rep2 &rhs)
 operator/(Duration, Rep). Returns a duration of best-fit period and repetition types. More...
 
template<class Rep , class Period , class Rep2 , class Period2 , class DurCommon = typename std::common_type<Duration<Rep,Period>, Duration<Rep2,Period2>>::type, class RepCommon = typename std::common_type<Rep,Rep2>::type>
constexpr RepCommon operator/ (const Duration< Rep, Period > &lhs, const Duration< Rep2, Period2 > &rhs)
 operator/(Duration, Duration). Returns a repetition of best-fit type. More...
 
template<class Rep , class Period , class Rep2 , typename mt::disable_if< mt::isSpecializationOf< Rep2, Duration >::value, int >::type = 0, class DurCommon = Duration<typename std::common_type<Rep,Rep2>::type, Period>>
constexpr DurCommon operator% (const Duration< Rep, Period > &lhs, const Rep2 &rhs)
 operator%(Duration, Rep). Returns a duration of best-fit period and repetition types. More...
 
template<class Rep , class Period , class Rep2 , class Period2 , class DurCommon = typename std::common_type<Duration<Rep,Period>, Duration<Rep2,Period2>>::type>
constexpr DurCommon operator% (const Duration< Rep, Period > &lhs, const Duration< Rep2, Period2 > &rhs)
 operator%(Duration, Duration). Returns a duration of best-fit period and repetition types. More...
 
Duration literals
constexpr Nanosec operator""_ns (unsigned long long int n)
 Construct Nanosec from integer literal (eg. 100_ns) More...
 
constexpr Microsec operator""_us (unsigned long long int n)
 Construct Microsec from integer literal. More...
 
constexpr Millisec operator""_ms (unsigned long long int n)
 Construct Millisec from integer literal. More...
 
constexpr Seconds operator""_s (unsigned long long int n)
 Construct Seconds from integer literal. More...
 
constexpr Minutes operator""_min (unsigned long long int n)
 Construct Minutes from integer literal. More...
 
constexpr Hours operator""_h (unsigned long long int n)
 Construct Hours from integer literal. More...
 

Detailed Description

template<class Rep_, class Period_ = Ratio<1>>
class honey::Duration< Rep_, Period_ >

Duration represented by repetitions of a period. The period must be a ratio.

Member Typedef Documentation

template<class Rep_, class Period_ = Ratio<1>>
typedef Period_ honey::Duration< Rep_, Period_ >::Period
template<class Rep_, class Period_ = Ratio<1>>
typedef Rep_ honey::Duration< Rep_, Period_ >::Rep

Constructor & Destructor Documentation

template<class Rep_, class Period_ = Ratio<1>>
constexpr honey::Duration< Rep_, Period_ >::Duration ( )
default
template<class Rep_, class Period_ = Ratio<1>>
template<class Rep2 >
constexpr honey::Duration< Rep_, Period_ >::Duration ( const Rep2 &  rep)
inlineexplicit

Construct from repetition.

template<class Rep_, class Period_ = Ratio<1>>
template<class Rep2 , class Period2 , class Ratio = typename Period2::template div<Period>::type>
constexpr honey::Duration< Rep_, Period_ >::Duration ( const Duration< Rep2, Period2 > &  d)
inline

Construct from another type of duration.

Member Function Documentation

template<class Rep_, class Period_ = Ratio<1>>
constexpr Rep honey::Duration< Rep_, Period_ >::count ( ) const
inline

Get number of repetitions of period.

template<class Rep_, class Period_ = Ratio<1>>
static constexpr Duration honey::Duration< Rep_, Period_ >::max ( )
inlinestatic

Maximum duration (positive reps)

template<class Rep_, class Period_ = Ratio<1>>
static constexpr Duration honey::Duration< Rep_, Period_ >::min ( )
inlinestatic

Minimum duration (negative reps)

template<class Rep_, class Period_ = Ratio<1>>
template<class Rep2 , class Period2 >
constexpr bool honey::Duration< Rep_, Period_ >::operator!= ( const Duration< Rep2, Period2 > &  rhs) const
inline
template<class Rep_, class Period_ = Ratio<1>>
Duration& honey::Duration< Rep_, Period_ >::operator%= ( const Rep rhs)
inline
template<class Rep_, class Period_ = Ratio<1>>
Duration& honey::Duration< Rep_, Period_ >::operator%= ( const Duration< Rep_, Period_ > &  rhs)
inline
template<class Rep_, class Period_ = Ratio<1>>
Duration& honey::Duration< Rep_, Period_ >::operator*= ( const Rep rhs)
inline
template<class Rep_, class Period_ = Ratio<1>>
constexpr Duration honey::Duration< Rep_, Period_ >::operator+ ( ) const
inline
template<class Rep_, class Period_ = Ratio<1>>
Duration& honey::Duration< Rep_, Period_ >::operator++ ( )
inline
template<class Rep_, class Period_ = Ratio<1>>
Duration honey::Duration< Rep_, Period_ >::operator++ ( int  ) const
inline
template<class Rep_, class Period_ = Ratio<1>>
Duration& honey::Duration< Rep_, Period_ >::operator+= ( const Duration< Rep_, Period_ > &  rhs)
inline
template<class Rep_, class Period_ = Ratio<1>>
constexpr Duration honey::Duration< Rep_, Period_ >::operator- ( ) const
inline
template<class Rep_, class Period_ = Ratio<1>>
Duration& honey::Duration< Rep_, Period_ >::operator-- ( )
inline
template<class Rep_, class Period_ = Ratio<1>>
Duration honey::Duration< Rep_, Period_ >::operator-- ( int  ) const
inline
template<class Rep_, class Period_ = Ratio<1>>
Duration& honey::Duration< Rep_, Period_ >::operator-= ( const Duration< Rep_, Period_ > &  rhs)
inline
template<class Rep_, class Period_ = Ratio<1>>
Duration& honey::Duration< Rep_, Period_ >::operator/= ( const Rep rhs)
inline
template<class Rep_, class Period_ = Ratio<1>>
template<class Rep2 , class Period2 , class DurCommon = typename std::common_type<Duration, Duration<Rep2,Period2>>::type>
constexpr bool honey::Duration< Rep_, Period_ >::operator< ( const Duration< Rep2, Period2 > &  rhs) const
inline
template<class Rep_, class Period_ = Ratio<1>>
template<class Rep2 , class Period2 >
constexpr bool honey::Duration< Rep_, Period_ >::operator<= ( const Duration< Rep2, Period2 > &  rhs) const
inline
template<class Rep_, class Period_ = Ratio<1>>
template<class Rep2 , class Period2 , class Ratio = typename Period2::template div<Period>::type>
Duration& honey::Duration< Rep_, Period_ >::operator= ( const Duration< Rep2, Period2 > &  rhs)
inline
template<class Rep_, class Period_ = Ratio<1>>
template<class Rep2 , class Period2 , class DurCommon = typename std::common_type<Duration, Duration<Rep2,Period2>>::type>
constexpr bool honey::Duration< Rep_, Period_ >::operator== ( const Duration< Rep2, Period2 > &  rhs) const
inline
template<class Rep_, class Period_ = Ratio<1>>
template<class Rep2 , class Period2 >
constexpr bool honey::Duration< Rep_, Period_ >::operator> ( const Duration< Rep2, Period2 > &  rhs) const
inline
template<class Rep_, class Period_ = Ratio<1>>
template<class Rep2 , class Period2 >
constexpr bool honey::Duration< Rep_, Period_ >::operator>= ( const Duration< Rep2, Period2 > &  rhs) const
inline
template<class Rep_, class Period_ = Ratio<1>>
static constexpr Duration honey::Duration< Rep_, Period_ >::zero ( )
inlinestatic

Zero duration.

Friends And Related Function Documentation

template<class Rep_, class Period_ = Ratio<1>>
typedef Duration<int, Hours::Period::mul<Ratio<24> >::type> Days
related
template<class Rep_, class Period_ = Ratio<1>>
template<class Rep , class Period >
friend class Duration
friend
template<class Rep_, class Period_ = Ratio<1>>
typedef Duration<int, Minutes::Period::mul<Ratio<60> >::type> Hours
related
template<class Rep_, class Period_ = Ratio<1>>
typedef Duration<int64, ratio::Micro> Microsec
related
template<class Rep_, class Period_ = Ratio<1>>
typedef Duration<int64, ratio::Milli> Millisec
related
template<class Rep_, class Period_ = Ratio<1>>
typedef Duration<int, Seconds::Period::mul<Ratio<60> >::type> Minutes
related
template<class Rep_, class Period_ = Ratio<1>>
typedef Duration<int64, ratio::Nano> Nanosec
related
template<class Rep_, class Period_ = Ratio<1>>
constexpr Hours operator""_h ( unsigned long long int  n)
related

Construct Hours from integer literal.

template<class Rep_, class Period_ = Ratio<1>>
constexpr Minutes operator""_min ( unsigned long long int  n)
related

Construct Minutes from integer literal.

template<class Rep_, class Period_ = Ratio<1>>
constexpr Millisec operator""_ms ( unsigned long long int  n)
related

Construct Millisec from integer literal.

template<class Rep_, class Period_ = Ratio<1>>
constexpr Nanosec operator""_ns ( unsigned long long int  n)
related

Construct Nanosec from integer literal (eg. 100_ns)

template<class Rep_, class Period_ = Ratio<1>>
constexpr Seconds operator""_s ( unsigned long long int  n)
related

Construct Seconds from integer literal.

template<class Rep_, class Period_ = Ratio<1>>
constexpr Microsec operator""_us ( unsigned long long int  n)
related

Construct Microsec from integer literal.

template<class Rep , class Period , class Rep2 , typename mt::disable_if< mt::isSpecializationOf< Rep2, Duration >::value, int >::type = 0, class DurCommon = Duration<typename std::common_type<Rep,Rep2>::type, Period>>
constexpr DurCommon operator% ( const Duration< Rep, Period > &  lhs,
const Rep2 &  rhs 
)
related

operator%(Duration, Rep). Returns a duration of best-fit period and repetition types.

template<class Rep , class Period , class Rep2 , class Period2 , class DurCommon = typename std::common_type<Duration<Rep,Period>, Duration<Rep2,Period2>>::type>
constexpr DurCommon operator% ( const Duration< Rep, Period > &  lhs,
const Duration< Rep2, Period2 > &  rhs 
)
related

operator%(Duration, Duration). Returns a duration of best-fit period and repetition types.

template<class Rep , class Period , class Rep2 , class DurCommon = Duration<typename std::common_type<Rep,Rep2>::type, Period>>
constexpr DurCommon operator* ( const Duration< Rep, Period > &  lhs,
const Rep2 &  rhs 
)
related

operator*(Duration, Rep). Returns a duration of best-fit period and repetition types.

template<class Rep , class Rep2 , class Period , class DurCommon = Duration<typename std::common_type<Rep,Rep2>::type, Period>>
constexpr DurCommon operator* ( const Rep lhs,
const Duration< Rep2, Period > &  rhs 
)
related

operator*(Rep, Duration). Returns a duration of best-fit period and repetition types.

template<class Rep , class Period , class Rep2 , class Period2 , class DurCommon = typename std::common_type<Duration<Rep,Period>, Duration<Rep2,Period2>>::type>
constexpr DurCommon operator+ ( const Duration< Rep, Period > &  lhs,
const Duration< Rep2, Period2 > &  rhs 
)
related

operator+(Duration, Duration). Returns a duration with best-fit period and repetition types.

template<class Rep , class Period , class Rep2 , class Period2 , class DurCommon = typename std::common_type<Duration<Rep,Period>, Duration<Rep2,Period2>>::type>
constexpr DurCommon operator- ( const Duration< Rep, Period > &  lhs,
const Duration< Rep2, Period2 > &  rhs 
)
related

operator-(Duration, Duration). Returns a duration with best-fit period and repetition types.

template<class Rep , class Period , class Rep2 , typename mt::disable_if< mt::isSpecializationOf< Rep2, Duration >::value, int >::type = 0, class DurCommon = Duration<typename std::common_type<Rep,Rep2>::type, Period>>
constexpr DurCommon operator/ ( const Duration< Rep, Period > &  lhs,
const Rep2 &  rhs 
)
related

operator/(Duration, Rep). Returns a duration of best-fit period and repetition types.

template<class Rep , class Period , class Rep2 , class Period2 , class DurCommon = typename std::common_type<Duration<Rep,Period>, Duration<Rep2,Period2>>::type, class RepCommon = typename std::common_type<Rep,Rep2>::type>
constexpr RepCommon operator/ ( const Duration< Rep, Period > &  lhs,
const Duration< Rep2, Period2 > &  rhs 
)
related

operator/(Duration, Duration). Returns a repetition of best-fit type.

template<class Rep_, class Period_ = Ratio<1>>
typedef Duration<int64, ratio::Unit> Seconds
related

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