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.
cyclic_value< T, FIRST, LAST, typename > Class Template Reference
[cyclic_value]
Provides a value that cycles between two limits. More...
#include <cyclic_value.h>
Public Member Functions | |
cyclic_value () | |
Constructor. | |
cyclic_value (const cyclic_value< T, FIRST, LAST > &other) | |
Copy constructor. | |
void | set (T value_) |
Sets the value. | |
void | to_first () |
Resets the value to the first in the range. | |
void | to_last () |
Resets the value to the last in the range. | |
void | advance (int n) |
Advances to value by a number of steps. | |
operator T () | |
Conversion operator. | |
operator const T () const | |
Const conversion operator. | |
cyclic_value & | operator++ () |
++ operator. | |
cyclic_value | operator++ (int) |
++ operator. | |
cyclic_value & | operator-- () |
-- operator. | |
cyclic_value | operator-- (int) |
-- operator. | |
cyclic_value & | operator= (T t) |
= operator. | |
template<const T FIRST2, const T LAST2> | |
cyclic_value & | operator= (const cyclic_value< T, FIRST2, LAST2 > &other) |
= operator. | |
T | get () const |
Gets the value. | |
const T | first () const |
Gets the first value. | |
const T | last () const |
Gets the last value. | |
void | swap (cyclic_value< T, FIRST, LAST > &other) |
Swaps the values. | |
Friends | |
void | swap (cyclic_value< T, FIRST, LAST > &lhs, cyclic_value< T, FIRST, LAST > &rhs) |
Swaps the values. | |
bool | operator== (const cyclic_value< T, FIRST, LAST > &lhs, const cyclic_value< T, FIRST, LAST > &rhs) |
Operator ==. | |
bool | operator!= (const cyclic_value< T, FIRST, LAST > &lhs, const cyclic_value< T, FIRST, LAST > &rhs) |
Operator !=. |
Detailed Description
template<typename T, T FIRST = 0, T LAST = 0, typename = void>
class etl::cyclic_value< T, FIRST, LAST, typename >
Provides a value that cycles between two limits.
Supports incrementing and decrementing.
- Template Parameters:
-
T The type of the variable. FIRST The first value of the range. LAST The last value of the range.
Definition at line 59 of file cyclic_value.h.
Constructor & Destructor Documentation
cyclic_value | ( | ) |
Constructor.
The initial value is set to the first value.
Definition at line 67 of file cyclic_value.h.
cyclic_value | ( | const cyclic_value< T, FIRST, LAST > & | other ) |
Copy constructor.
Definition at line 75 of file cyclic_value.h.
Member Function Documentation
void advance | ( | int | n ) |
Advances to value by a number of steps.
- Parameters:
-
n The number of steps to advance.
Definition at line 118 of file cyclic_value.h.
const T first | ( | ) | const |
Gets the first value.
Definition at line 246 of file cyclic_value.h.
T get | ( | ) | const |
Gets the value.
Definition at line 238 of file cyclic_value.h.
const T last | ( | ) | const |
Gets the last value.
Definition at line 254 of file cyclic_value.h.
operator const T | ( | ) | const |
Const conversion operator.
- Returns:
- The value of the underlying type.
Definition at line 153 of file cyclic_value.h.
operator T | ( | ) |
Conversion operator.
- Returns:
- The value of the underlying type.
Definition at line 144 of file cyclic_value.h.
cyclic_value operator++ | ( | int | ) |
++ operator.
Definition at line 178 of file cyclic_value.h.
cyclic_value& operator++ | ( | ) |
++ operator.
Definition at line 161 of file cyclic_value.h.
cyclic_value& operator-- | ( | ) |
-- operator.
Definition at line 190 of file cyclic_value.h.
cyclic_value operator-- | ( | int | ) |
-- operator.
Definition at line 207 of file cyclic_value.h.
cyclic_value& operator= | ( | T | t ) |
= operator.
Definition at line 219 of file cyclic_value.h.
cyclic_value& operator= | ( | const cyclic_value< T, FIRST2, LAST2 > & | other ) |
= operator.
Definition at line 229 of file cyclic_value.h.
void set | ( | T | value_ ) |
void swap | ( | cyclic_value< T, FIRST, LAST > & | other ) |
Swaps the values.
Definition at line 262 of file cyclic_value.h.
void to_first | ( | ) |
Resets the value to the first in the range.
Definition at line 101 of file cyclic_value.h.
void to_last | ( | ) |
Resets the value to the last in the range.
Definition at line 109 of file cyclic_value.h.
Friends And Related Function Documentation
bool operator!= | ( | const cyclic_value< T, FIRST, LAST > & | lhs, |
const cyclic_value< T, FIRST, LAST > & | rhs | ||
) | [friend] |
Operator !=.
Definition at line 286 of file cyclic_value.h.
bool operator== | ( | const cyclic_value< T, FIRST, LAST > & | lhs, |
const cyclic_value< T, FIRST, LAST > & | rhs | ||
) | [friend] |
Operator ==.
Definition at line 278 of file cyclic_value.h.
void swap | ( | cyclic_value< T, FIRST, LAST > & | lhs, |
cyclic_value< T, FIRST, LAST > & | rhs | ||
) | [friend] |
Swaps the values.
Definition at line 270 of file cyclic_value.h.
Generated on Tue Jul 12 2022 14:05:49 by
