Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Bounded< Rep, Min, Max > Struct Template Reference

Bounded< Rep, Min, Max > Struct Template Reference

Restrict values of an integer type to a defined range. More...

#include <Bounded.h>

Public Member Functions

 Bounded (Rep v)
 Construct a bounded integer.
Rep value () const
 Access the inner value.

Static Public Member Functions

static Rep min ()
 The left-bound value.
static Rep max ()
 The right-bound value.

Static Public Attributes

static const Rep MIN = Min
 The left-bound value.
static const Rep MAX = Max
 The right-bound value.

Detailed Description

template<typename Rep, Rep Min, Rep Max>
struct ble::Bounded< Rep, Min, Max >

Restrict values of an integer type to a defined range.

The range is a closed interval that includes its left-bound (Min) and right-bound value (Max).

Template Parameters:
RepThe C++ integer type used to represent the values.
MinMinimum value allowed.
MaxMaximum value allowed.

Definition at line 35 of file Bounded.h.


Constructor & Destructor Documentation

Bounded ( Rep  v )

Construct a bounded integer.

If v is out of the range [Min : Max], then if it is less than Min, the value of the bounded integer will be Min. If it greater than Max, then the value of the bounded integer will be Max.

Parameters:
vThe value to store.

Definition at line 45 of file Bounded.h.


Member Function Documentation

static Rep max (  ) [static]

The right-bound value.

Returns:
The highest value that this type can represent

Definition at line 79 of file Bounded.h.

static Rep min (  ) [static]

The left-bound value.

Returns:
The lowest value that this type can represent

Definition at line 69 of file Bounded.h.

Rep value (  ) const

Access the inner value.

Returns:
The current value.

Definition at line 59 of file Bounded.h.


Field Documentation

const T MAX = Max [static]

The right-bound value.

Definition at line 92 of file Bounded.h.

const T MIN = Min [static]

The left-bound value.

Definition at line 87 of file Bounded.h.