#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 *=NULL) | |
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... | |
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 100 of file Duration.h.
typedef Rep representation_t |
Type of the actual representation.
Definition at line 104 of file Duration.h.
Duration | ( | ) |
Construct a default Duration.
It is initialized with the minimum value acceptable.
Definition at line 111 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 120 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 137 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 155 of file Duration.h.
|
static |
Return the Duration value meaning forever.
Definition at line 229 of file Duration.h.
|
static |
Return the maximum duration.
Definition at line 210 of file Duration.h.
|
static |
Return the minimum duration.
Definition at line 200 of file Duration.h.
const Rep* storage | ( | ) | const |
Return a pointer to the value of the duration.
Definition at line 220 of file Duration.h.
Rep value | ( | ) | const |
Return the duration in TB units.
Definition at line 165 of file Duration.h.
uint32_t valueInMs | ( | ) | const |
Return the duration in milliseconds.
Definition at line 175 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 278 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 462 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 479 of file Duration.h.
Multiply a duration and a positive integer.
lhs | The duration. |
rhs | The integer. |
Definition at line 330 of file Duration.h.
Multiply a duration and a positive integer.
lhs | The integer. |
rhs | The multiplication. |
Definition at line 346 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 294 of file Duration.h.
|
related |
Add two durations together.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
Definition at line 311 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 363 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 377 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 394 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 411 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 428 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 445 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 530 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 547 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 496 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 513 of file Duration.h.
|
static |
Right bound of the duration range.
Definition at line 193 of file Duration.h.
|
static |
Left-bound of the duration range.
Definition at line 188 of file Duration.h.
|
static |
The time base.
Definition at line 183 of file Duration.h.