#include <Duration.h>
Public Types | |
typedef Rep | representation_t |
Type of the actual representation. More... | |
Public Member Functions | |
Duration () | |
Construct a default Duration. More... | |
Duration (Rep v) | |
Construct a Duration from an integer value. More... | |
template<typename OtherRep , uint32_t OtherTB, typename OtherRange , typename OtherF > | |
Duration (Duration< OtherRep, OtherTB, OtherRange, OtherF > other) | |
Construct a Duration from another Duration. More... | |
template<typename OtherRep , typename OtherRange , typename OtherF > | |
Duration (Duration< OtherRep, 1000, OtherRange, OtherF > other_ms, void *=nullptr) | |
Construct a new Duration from a Duration in milliseconds. More... | |
Rep | value () const |
Return the duration in TB units. More... | |
uint32_t | valueInMs () const |
Return the duration in milliseconds. More... | |
const Rep * | storage () const |
Return a pointer to the value of the duration. More... | |
bool | isForever () const |
Test if the forever value is being held. More... | |
std::chrono::duration< Rep, typename std::ratio< TB, 1000000 >::type > | valueChrono () const |
Convert the duration into an std::chrono one. More... | |
Static Public Member Functions | |
static Duration | min () |
Return the minimum duration. More... | |
static Duration | max () |
Return the maximum duration. More... | |
static Duration | forever () |
Return the Duration value meaning forever. More... | |
Static Public Attributes | |
static const uint32_t | TIME_BASE = TB |
The time base. More... | |
static const Rep | MIN = Range::MIN |
Left-bound of the duration range. More... | |
static const Rep | MAX = Range::MAX |
Right bound of the duration range. More... | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename DurationOut , typename RepIn , uint32_t TBIn, typename RangeIn , typename FIn > | |
DurationOut | durationCast (Duration< RepIn, TBIn, RangeIn, FIn > duration) |
Cast a duration to another. More... | |
template<typename RepLHS , uint32_t TBLHS, typename RangeLHS , typename FLHS , typename RepRHS , uint32_t TBRHS, typename RangeRHS , typename FRHS > | |
microsecond_t | operator+ (Duration< RepLHS, TBLHS, RangeLHS, FLHS > lhs, Duration< RepRHS, TBRHS, RangeRHS, FRHS > rhs) |
Add two durations together and return the result in microseconds. More... | |
template<typename Rep , uint32_t TB, typename Range , typename F > | |
Duration< Rep, TB, Range, F > | operator+ (Duration< Rep, TB, Range, F > lhs, Duration< Rep, TB, Range, F > rhs) |
Add two durations together. More... | |
template<typename Rep , uint32_t TB, typename Range , typename F > | |
Duration< Rep, TB, Range, F > | operator* (Duration< Rep, TB, Range, F > lhs, uint32_t rhs) |
Multiply a duration and a positive integer. More... | |
template<typename Rep , uint32_t TB, typename Range , typename F > | |
Duration< Rep, TB, Range, F > | operator* (uint32_t lhs, Duration< Rep, TB, Range, F > rhs) |
Multiply a duration and a positive integer. More... | |
template<typename RepLHS , uint32_t TBLHS, typename RangeLHS , typename FLHS , typename RepRHS , uint32_t TBRHS, typename RangeRHS , typename FRHS > | |
bool | operator< (Duration< RepLHS, TBLHS, RangeLHS, FLHS > lhs, Duration< RepRHS, TBRHS, RangeRHS, FRHS > rhs) |
Indicate if the duration lhs is less than the duration rhs. More... | |
template<typename Rep , uint32_t Us, typename Range , typename F > | |
bool | operator< (Duration< Rep, Us, Range, F > lhs, Duration< Rep, Us, Range, F > rhs) |
Indicate if the duration lhs is less than the duration rhs. More... | |
template<typename RepLHS , uint32_t TBLHS, typename RangeLHS , typename FLHS , typename RepRHS , uint32_t TBRHS, typename RangeRHS , typename FRHS > | |
bool | operator<= (Duration< RepLHS, TBLHS, RangeLHS, FLHS > lhs, Duration< RepRHS, TBRHS, RangeRHS, FRHS > rhs) |
Indicate if the duration lhs is less than or equal to the duration rhs. More... | |
template<typename Rep , uint32_t Us, typename Range > | |
bool | operator<= (Duration< Rep, Us, Range > lhs, Duration< Rep, Us, Range > rhs) |
Indicate if the duration lhs is less than or equal to the duration rhs. More... | |
template<typename RepLHS , uint32_t TBLHS, typename RangeLHS , typename FLHS , typename RepRHS , uint32_t TBRHS, typename RangeRHS , typename FRHS > | |
bool | operator== (Duration< RepLHS, TBLHS, RangeLHS, FLHS > lhs, Duration< RepRHS, TBRHS, RangeRHS, FRHS > rhs) |
Indicate if the duration lhs is equal to the duration rhs. More... | |
template<typename Rep , uint32_t Us, typename Range , typename F > | |
bool | operator== (Duration< Rep, Us, Range, F > lhs, Duration< Rep, Us, Range, F > rhs) |
Indicate if the duration lhs is equal to the duration rhs. More... | |
template<typename RepLHS , uint32_t TBLHS, typename RangeLHS , typename FLHS , typename RepRHS , uint32_t TBRHS, typename RangeRHS , typename FRHS > | |
bool | operator!= (Duration< RepLHS, TBLHS, RangeLHS, FLHS > lhs, Duration< RepRHS, TBRHS, RangeRHS, FRHS > rhs) |
Indicate if the duration lhs is not equal to the duration rhs. More... | |
template<typename Rep , uint32_t Us, typename Range , typename F > | |
bool | operator!= (Duration< Rep, Us, Range, F > lhs, Duration< Rep, Us, Range, F > rhs) |
Indicate if the duration lhs is not equal to the duration rhs. More... | |
template<typename RepLHS , uint32_t TBLHS, typename RangeLHS , typename FLHS , typename RepRHS , uint32_t TBRHS, typename RangeRHS , typename FRHS > | |
bool | operator>= (Duration< RepLHS, TBLHS, RangeLHS, FLHS > lhs, Duration< RepRHS, TBRHS, RangeRHS, FRHS > rhs) |
Indicate if the duration lhs greater or equal to the duration rhs. More... | |
template<typename Rep , uint32_t Us, typename Range , typename F > | |
bool | operator>= (Duration< Rep, Us, Range, F > lhs, Duration< Rep, Us, Range, F > rhs) |
Indicate if the duration lhs greater or equal to the duration rhs. More... | |
template<typename RepLHS , uint32_t TBLHS, typename RangeLHS , typename FLHS , typename RepRHS , uint32_t TBRHS, typename RangeRHS , typename FRHS > | |
bool | operator> (Duration< RepLHS, TBLHS, RangeLHS, FLHS > lhs, Duration< RepRHS, TBRHS, RangeRHS, FRHS > rhs) |
Indicate if the duration lhs greater than the duration rhs. More... | |
template<typename Rep , uint32_t Us, typename Range , typename F > | |
bool | operator> (Duration< Rep, Us, Range, F > lhs, Duration< Rep, Us, Range, F > rhs) |
Indicate if the duration lhs greater than the duration rhs. More... | |
Model BLE durations.
Rep | The representation type of the duration. |
TB | The time base in micro seconds. |
Range | Closed interval of the duration |
Forever | The special value (if applicable) that represents a forever duration. |
Definition at line 104 of file Duration.h.
typedef Rep representation_t |
Type of the actual representation.
Definition at line 108 of file Duration.h.
Duration | ( | ) |
Construct a default Duration.
It is initialized with the minimum value acceptable.
Definition at line 115 of file Duration.h.
|
explicit |
Construct a Duration from an integer value.
v | The value of the duration in TIME_BASE units. |
Definition at line 124 of file Duration.h.
Construct a Duration from another Duration.
OtherRep | The type used to represent the other Duration. |
OtherTB | The time base in micro seconds of the other Duration. |
OtherRange | The range of the other Duration. |
OtherF | The forever value of the other type. |
other | The Duration used to construct this object. |
Definition at line 141 of file Duration.h.
Construct a new Duration from a Duration in milliseconds.
OtherRep | The representation type used by other_ms. |
OtherRange | The range used by other_ms. |
OtherF | The forever value used by other_ms. |
other_ms | The Duration in millisecond to convert. |
Definition at line 159 of file Duration.h.
|
static |
Return the Duration value meaning forever.
Definition at line 233 of file Duration.h.
bool isForever | ( | ) | const |
Test if the forever value is being held.
|
static |
Return the maximum duration.
Definition at line 214 of file Duration.h.
|
static |
Return the minimum duration.
Definition at line 204 of file Duration.h.
const Rep* storage | ( | ) | const |
Return a pointer to the value of the duration.
Definition at line 224 of file Duration.h.
Rep value | ( | ) | const |
Return the duration in TB units.
Definition at line 169 of file Duration.h.
std::chrono::duration<Rep, typename std::ratio<TB, 1000000>::type> valueChrono | ( | ) | const |
Convert the duration into an std::chrono one.
Definition at line 273 of file Duration.h.
uint32_t valueInMs | ( | ) | const |
Return the duration in milliseconds.
Definition at line 179 of file Duration.h.
|
related |
Cast a duration to another.
DurationOut | Type of the Duration in output. |
RepIn | The representation type of duration. |
TBIn | The timebase of duration. |
RangeIn | The range of duration. |
FIn | The Forever value of duration. |
duration | The duration to convert. |
Definition at line 324 of file Duration.h.
|
related |
Indicate if the duration lhs is not equal to the duration rhs.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 508 of file Duration.h.
Indicate if the duration lhs is not equal to the duration rhs.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 525 of file Duration.h.
Multiply a duration and a positive integer.
lhs | The duration. |
rhs | The integer. |
Definition at line 376 of file Duration.h.
Multiply a duration and a positive integer.
lhs | The integer. |
rhs | The multiplication. |
Definition at line 392 of file Duration.h.
|
related |
Add two durations together and return the result in microseconds.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 340 of file Duration.h.
|
related |
Add two durations together.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 357 of file Duration.h.
|
related |
Indicate if the duration lhs is less than the duration rhs.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 409 of file Duration.h.
Indicate if the duration lhs is less than the duration rhs.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 423 of file Duration.h.
|
related |
Indicate if the duration lhs is less than or equal to the duration rhs.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 440 of file Duration.h.
Indicate if the duration lhs is less than or equal to the duration rhs.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 457 of file Duration.h.
|
related |
Indicate if the duration lhs is equal to the duration rhs.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 474 of file Duration.h.
Indicate if the duration lhs is equal to the duration rhs.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 491 of file Duration.h.
|
related |
Indicate if the duration lhs greater than the duration rhs.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 576 of file Duration.h.
Indicate if the duration lhs greater than the duration rhs.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 593 of file Duration.h.
|
related |
Indicate if the duration lhs greater or equal to the duration rhs.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 542 of file Duration.h.
Indicate if the duration lhs greater or equal to the duration rhs.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 559 of file Duration.h.
|
static |
Right bound of the duration range.
Definition at line 197 of file Duration.h.
|
static |
Left-bound of the duration range.
Definition at line 192 of file Duration.h.
|
static |
The time base.
Definition at line 187 of file Duration.h.