Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
Duration< Rep, TB, Range, Forever > Struct Template Reference
#include <Duration.h>
Public Types | |
typedef Rep | representation_t |
Type of the actual representation. | |
Public Member Functions | |
Duration () | |
Construct a default Duration. | |
Duration (Rep v) | |
Construct a Duration from an integer value. | |
template<typename OtherRep , uint32_t OtherTB, typename OtherRange , typename OtherF > | |
Duration (Duration< OtherRep, OtherTB, OtherRange, OtherF > other) | |
Construct a Duration from another Duration. | |
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. | |
Rep | value () const |
Return the duration in TB units. | |
uint32_t | valueInMs () const |
Return the duration in milliseconds. | |
const Rep * | storage () const |
Return a pointer to the value of the duration. | |
Static Public Member Functions | |
static Duration | min () |
Return the minimum duration. | |
static Duration | max () |
Return the maximum duration. | |
static Duration | forever () |
Return the Duration value meaning forever. | |
Static Public Attributes | |
static const uint32_t | TIME_BASE = TB |
The time base. | |
static const Rep | MIN = Range::MIN |
Left-bound of the duration range. | |
static const Rep | MAX = Range::MAX |
Right bound of the duration range. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. |
Detailed Description
template<typename Rep, uint32_t TB, typename Range = typename DefaultRange<Rep>::type, typename Forever = void*>
struct ble::Duration< Rep, TB, Range, Forever >
Model BLE durations.
- Template Parameters:
-
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.
Member Typedef Documentation
typedef Rep representation_t |
Type of the actual representation.
Definition at line 104 of file Duration.h.
Constructor & Destructor Documentation
Duration | ( | ) |
Construct a default Duration.
It is initialized with the minimum value acceptable.
Definition at line 111 of file Duration.h.
Duration | ( | Rep | v ) | [explicit] |
Construct a Duration from an integer value.
- Parameters:
-
v The value of the duration in TIME_BASE units.
Definition at line 120 of file Duration.h.
Construct a Duration from another Duration.
- Note:
- The operation fail at compile time if there is a loss of precision.
- Template Parameters:
-
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.
- Parameters:
-
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.
- Note:
- The result of the conversion is rounded up.
- Template Parameters:
-
OtherRep The representation type used by other_ms. OtherRange The range used by other_ms. OtherF The forever value used by other_ms.
- Parameters:
-
other_ms The Duration in millisecond to convert.
Definition at line 155 of file Duration.h.
Member Function Documentation
static Duration forever | ( | ) | [static] |
Return the Duration value meaning forever.
- Returns:
- the Duration value meaning forever.
Definition at line 229 of file Duration.h.
static Duration max | ( | ) | [static] |
Return the maximum duration.
- Returns:
- The maximum duration.
Definition at line 210 of file Duration.h.
static Duration min | ( | ) | [static] |
Return the minimum duration.
- Returns:
- The minimum duration.
Definition at line 200 of file Duration.h.
const Rep* storage | ( | ) | const |
Return a pointer to the value of the duration.
- Returns:
- 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.
- Returns:
- The duration in TB units.
Definition at line 165 of file Duration.h.
uint32_t valueInMs | ( | ) | const |
Return the duration in milliseconds.
- Returns:
- The duration in milliseconds.
Definition at line 175 of file Duration.h.
Friends And Related Function Documentation
DurationOut durationCast | ( | Duration< RepIn, TBIn, RangeIn, FIn > | duration ) | [related] |
Cast a duration to another.
- Template Parameters:
-
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.
- Parameters:
-
duration The duration to convert.
- Returns:
- The converted duration. It is rounded up if precision is lost.
Definition at line 278 of file Duration.h.
bool operator!= | ( | Duration< RepLHS, TBLHS, RangeLHS, FLHS > | lhs, |
Duration< RepRHS, TBRHS, RangeRHS, FRHS > | rhs | ||
) | [related] |
Indicate if the duration lhs is not equal to the duration rhs.
- Parameters:
-
lhs Left hand side operand. rhs Right hand side operand.
- Returns:
- true if lhs is not equal to rhs and false otherwise.
Definition at line 462 of file Duration.h.
Indicate if the duration lhs is not equal to the duration rhs.
- Parameters:
-
lhs Left hand side operand. rhs Right hand side operand.
- Returns:
- true if lhs is not equal to rhs and false otherwise.
Definition at line 479 of file Duration.h.
Duration< Rep, TB, Range, F > operator* | ( | Duration< Rep, TB, Range, F > | lhs, |
uint32_t | rhs | ||
) | [related] |
Multiply a duration and a positive integer.
- Parameters:
-
lhs The duration. rhs The integer.
- Returns:
- A duration that represents the multiplication of lhs with rhs.
Definition at line 330 of file Duration.h.
Duration< Rep, TB, Range, F > operator* | ( | uint32_t | lhs, |
Duration< Rep, TB, Range, F > | rhs | ||
) | [related] |
Multiply a duration and a positive integer.
- Parameters:
-
lhs The integer. rhs The multiplication.
- Returns:
- A duration that represents the multiplication of lhs with rhs.
Definition at line 346 of file Duration.h.
microsecond_t operator+ | ( | Duration< RepLHS, TBLHS, RangeLHS, FLHS > | lhs, |
Duration< RepRHS, TBRHS, RangeRHS, FRHS > | rhs | ||
) | [related] |
Add two durations together and return the result in microseconds.
- Parameters:
-
lhs Left hand side operand. rhs Right hand side operand.
- Returns:
- The result of the addition of the two durations in microseconds.
Definition at line 294 of file Duration.h.
Duration< Rep, TB, Range, F > operator+ | ( | Duration< Rep, TB, Range, F > | lhs, |
Duration< Rep, TB, Range, F > | rhs | ||
) | [related] |
Add two durations together.
- Parameters:
-
lhs Left hand side operand. rhs Right hand side operand.
- Returns:
- The addition of the two durations in input.
Definition at line 311 of file Duration.h.
bool operator< | ( | Duration< RepLHS, TBLHS, RangeLHS, FLHS > | lhs, |
Duration< RepRHS, TBRHS, RangeRHS, FRHS > | rhs | ||
) | [related] |
Indicate if the duration lhs is less than the duration rhs.
- Parameters:
-
lhs Left hand side operand. rhs Right hand side operand.
- Returns:
- true if lhs is less than rhs and false otherwise.
Definition at line 363 of file Duration.h.
Indicate if the duration lhs is less than the duration rhs.
- Parameters:
-
lhs Left hand side operand. rhs Right hand side operand.
- Returns:
- true if lhs is less than rhs and false otherwise.
Definition at line 377 of file Duration.h.
bool operator<= | ( | Duration< RepLHS, TBLHS, RangeLHS, FLHS > | lhs, |
Duration< RepRHS, TBRHS, RangeRHS, FRHS > | rhs | ||
) | [related] |
Indicate if the duration lhs is less than or equal to the duration rhs.
- Parameters:
-
lhs Left hand side operand. rhs Right hand side operand.
- Returns:
- true if lhs is less than or equal to rhs and false otherwise.
Definition at line 394 of file Duration.h.
Indicate if the duration lhs is less than or equal to the duration rhs.
- Parameters:
-
lhs Left hand side operand. rhs Right hand side operand.
- Returns:
- true if lhs is less than or equal to rhs and false otherwise.
Definition at line 411 of file Duration.h.
bool operator== | ( | Duration< RepLHS, TBLHS, RangeLHS, FLHS > | lhs, |
Duration< RepRHS, TBRHS, RangeRHS, FRHS > | rhs | ||
) | [related] |
Indicate if the duration lhs is equal to the duration rhs.
- Parameters:
-
lhs Left hand side operand. rhs Right hand side operand.
- Returns:
- true if lhs is equal to rhs and false otherwise.
Definition at line 428 of file Duration.h.
Indicate if the duration lhs is equal to the duration rhs.
- Parameters:
-
lhs Left hand side operand. rhs Right hand side operand.
- Returns:
- true if lhs is equal to rhs and false otherwise.
Definition at line 445 of file Duration.h.
Indicate if the duration lhs greater than the duration rhs.
- Parameters:
-
lhs Left hand side operand. rhs Right hand side operand.
- Returns:
- true if lhs is greater than rhs and false otherwise.
Definition at line 547 of file Duration.h.
bool operator> | ( | Duration< RepLHS, TBLHS, RangeLHS, FLHS > | lhs, |
Duration< RepRHS, TBRHS, RangeRHS, FRHS > | rhs | ||
) | [related] |
Indicate if the duration lhs greater than the duration rhs.
- Parameters:
-
lhs Left hand side operand. rhs Right hand side operand.
- Returns:
- true if lhs is greater than rhs and false otherwise.
Definition at line 530 of file Duration.h.
Indicate if the duration lhs greater or equal to the duration rhs.
- Parameters:
-
lhs Left hand side operand. rhs Right hand side operand.
- Returns:
- true if lhs is greater or equal to rhs and false otherwise.
Definition at line 513 of file Duration.h.
bool operator>= | ( | Duration< RepLHS, TBLHS, RangeLHS, FLHS > | lhs, |
Duration< RepRHS, TBRHS, RangeRHS, FRHS > | rhs | ||
) | [related] |
Indicate if the duration lhs greater or equal to the duration rhs.
- Parameters:
-
lhs Left hand side operand. rhs Right hand side operand.
- Returns:
- true if lhs is greater or equal to rhs and false otherwise.
Definition at line 496 of file Duration.h.
Field Documentation
const Rep MAX = Range::MAX [static] |
Right bound of the duration range.
Definition at line 193 of file Duration.h.
const Rep MIN = Range::MIN [static] |
Left-bound of the duration range.
Definition at line 188 of file Duration.h.
const uint32_t TIME_BASE = TB [static] |
The time base.
Definition at line 183 of file Duration.h.
Generated on Tue Jul 12 2022 13:55:39 by
