Embedded Template Library 1.0
Loading...
Searching...
No Matches
cyclic_value

Classes

class  etl::cyclic_value< T, First, Last, false >
 
class  etl::cyclic_value< T, First, Last, true >
 

Detailed Description

Provides a value that cycles between two limits.


Class Documentation

◆ etl::cyclic_value< T, First, Last, false >

class etl::cyclic_value< T, First, Last, false >
template<typename T, T First, T Last>
class etl::cyclic_value< T, First, Last, false >

Provides a value that cycles between two compile time limits. Supports incrementing and decrementing.

Template Parameters
TThe type of the variable.
FirstThe first value of the range.
LastThe last value of the range.

Public Member Functions

 cyclic_value ()
 
 cyclic_value (T initial)
 
 cyclic_value (const cyclic_value< T, First, Last > &other)
 Copy constructor.
 
cyclic_valueoperator= (const cyclic_value< T, First, Last > &other)
 Assignment operator.
 
void set (T 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)
 
 operator T ()
 
 operator const T () const
 
cyclic_valueoperator++ ()
 ++ operator.
 
cyclic_value operator++ (int)
 ++ operator.
 
cyclic_valueoperator-- ()
 – operator.
 
cyclic_value operator-- (int)
 – operator.
 
cyclic_valueoperator= (T t)
 = operator.
 
template<const T FIRST2, const T LAST2>
cyclic_valueoperator= (const cyclic_value< T, FIRST2, LAST2 > &other)
 = operator.
 
T get () const
 Gets the value.
 
void swap (cyclic_value< T, First, Last > &other)
 Swaps the values.
 

Static Public Member Functions

static ETL_CONSTEXPR T first ()
 Gets the first value.
 
static ETL_CONSTEXPR T last ()
 Gets the last value.
 

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 !=.
 

Constructor & Destructor Documentation

◆ cyclic_value() [1/2]

template<typename T , T First, T Last>
etl::cyclic_value< T, First, Last, false >::cyclic_value ( )
inline

Default constructor. The initial value is set to the first value.

◆ cyclic_value() [2/2]

template<typename T , T First, T Last>
etl::cyclic_value< T, First, Last, false >::cyclic_value ( T  initial)
inlineexplicit

Constructor. Set to an initial value. Clamped to the range.

Member Function Documentation

◆ advance()

template<typename T , T First, T Last>
void etl::cyclic_value< T, First, Last, false >::advance ( int  n)
inline

Advances to value by a number of steps.

Parameters
nThe number of steps to advance.

◆ operator const T()

template<typename T , T First, T Last>
etl::cyclic_value< T, First, Last, false >::operator const T ( ) const
inline

Const conversion operator.

Returns
The value of the underlying type.

◆ operator T()

template<typename T , T First, T Last>
etl::cyclic_value< T, First, Last, false >::operator T ( )
inline

Conversion operator.

Returns
The value of the underlying type.

◆ set()

template<typename T , T First, T Last>
void etl::cyclic_value< T, First, Last, false >::set ( T  value_)
inline

Sets the value. Truncates to the First/Last range.

Parameters
valueThe value.

◆ etl::cyclic_value< T, First, Last, true >

class etl::cyclic_value< T, First, Last, true >
template<typename T, T First, T Last>
class etl::cyclic_value< T, First, Last, true >

Provides a value that cycles between two run time limits. Supports incrementing and decrementing.

Template Parameters
TThe type of the variable.
FirstThe first value of the range.
LastThe last value of the range.

Public Member Functions

 cyclic_value ()
 
 cyclic_value (T first_, T last_)
 
 cyclic_value (T first_, T last_, T initial)
 
 cyclic_value (const cyclic_value &other)
 Copy constructor.
 
void set (T first_, T last_)
 
void set (T 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)
 
 operator T ()
 
 operator const T () const
 
cyclic_valueoperator++ ()
 ++ operator.
 
cyclic_value operator++ (int)
 ++ operator.
 
cyclic_valueoperator-- ()
 – operator.
 
cyclic_value operator-- (int)
 – operator.
 
cyclic_valueoperator= (T t)
 = operator.
 
cyclic_valueoperator= (const cyclic_value &other)
 = operator.
 
T get () const
 Gets the value.
 
T first () const
 Gets the first value.
 
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 !=.
 

Constructor & Destructor Documentation

◆ cyclic_value() [1/3]

template<typename T , T First, T Last>
etl::cyclic_value< T, First, Last, true >::cyclic_value ( )
inline

Constructor. Sets 'first' and 'last' to the template parameter values. The initial value is set to the first value.

◆ cyclic_value() [2/3]

template<typename T , T First, T Last>
etl::cyclic_value< T, First, Last, true >::cyclic_value ( T  first_,
T  last_ 
)
inline

Constructor. Sets the value to the first of the range.

Parameters
firstThe first value in the range.
lastThe last value in the range.

◆ cyclic_value() [3/3]

template<typename T , T First, T Last>
etl::cyclic_value< T, First, Last, true >::cyclic_value ( T  first_,
T  last_,
T  initial 
)
inline

Constructor. Set to an initial value. Clamped to the range.

Parameters
firstThe first value in the range.
lastThe last value in the range.

Member Function Documentation

◆ advance()

template<typename T , T First, T Last>
void etl::cyclic_value< T, First, Last, true >::advance ( int  n)
inline

Advances to value by a number of steps.

Parameters
nThe number of steps to advance.

◆ operator const T()

template<typename T , T First, T Last>
etl::cyclic_value< T, First, Last, true >::operator const T ( ) const
inline

Const conversion operator.

Returns
The value of the underlying type.

◆ operator T()

template<typename T , T First, T Last>
etl::cyclic_value< T, First, Last, true >::operator T ( )
inline

Conversion operator.

Returns
The value of the underlying type.

◆ set() [1/2]

template<typename T , T First, T Last>
void etl::cyclic_value< T, First, Last, true >::set ( T  first_,
T  last_ 
)
inline

Sets the range. Sets the value to the first of the range.

Parameters
firstThe first value in the range.
lastThe last value in the range.

◆ set() [2/2]

template<typename T , T First, T Last>
void etl::cyclic_value< T, First, Last, true >::set ( T  value_)
inline

Sets the value.

Parameters
valueThe value.