Embedded Template Library  1.0
cyclic_value

Classes

class  etl::cyclic_value< T, FIRST, LAST, typename >
 
class  etl::cyclic_value< T, FIRST, LAST, typename etl::enable_if<(FIRST==0) &&(LAST==0)>::type >
 

Detailed Description

Provides a value that cycles between two limits.


Class Documentation

◆ etl::cyclic_value

class etl::cyclic_value

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
TThe type of the variable.
FIRSTThe first value of the range.
LASTThe last value of the range.

Public Member Functions

 cyclic_value ()
 
 cyclic_value (const cyclic_value< T, FIRST, LAST > &other)
 Copy constructor.
 
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.
 
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 !=.
 

Constructor & Destructor Documentation

◆ cyclic_value()

template<typename T , T FIRST = 0, T LAST = 0, typename = void>
etl::cyclic_value< T, FIRST, LAST, typename >::cyclic_value ( )
inline

Constructor. The initial value is set to the first value.

Member Function Documentation

◆ advance()

template<typename T , T FIRST = 0, T LAST = 0, typename = void>
void etl::cyclic_value< T, FIRST, LAST, typename >::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 = 0, T LAST = 0, typename = void>
etl::cyclic_value< T, FIRST, LAST, typename >::operator const T ( ) const
inline

Const conversion operator.

Returns
The value of the underlying type.

◆ operator T()

template<typename T , T FIRST = 0, T LAST = 0, typename = void>
etl::cyclic_value< T, FIRST, LAST, typename >::operator T ( )
inline

Conversion operator.

Returns
The value of the underlying type.

◆ set()

template<typename T , T FIRST = 0, T LAST = 0, typename = void>
void etl::cyclic_value< T, FIRST, LAST, typename >::set ( value_)
inline

Sets the value.

Parameters
valueThe value.

◆ etl::cyclic_value< T, FIRST, LAST, typename etl::enable_if<(FIRST==0) &&(LAST==0)>::type >

class etl::cyclic_value< T, FIRST, LAST, typename etl::enable_if<(FIRST==0) &&(LAST==0)>::type >

template<typename T, const T FIRST, const T LAST>
class etl::cyclic_value< T, FIRST, LAST, typename etl::enable_if<(FIRST==0) &&(LAST==0)>::type >

Provides a value that cycles between two 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 (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.
 
get () const
 Gets the value.
 
first () const
 Gets the first value.
 
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/2]

template<typename T , const T FIRST, const T LAST>
etl::cyclic_value< T, FIRST, LAST, typename etl::enable_if<(FIRST==0) &&(LAST==0)>::type >::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/2]

template<typename T , const T FIRST, const T LAST>
etl::cyclic_value< T, FIRST, LAST, typename etl::enable_if<(FIRST==0) &&(LAST==0)>::type >::cyclic_value ( first_,
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.

Member Function Documentation

◆ advance()

template<typename T , const T FIRST, const T LAST>
void etl::cyclic_value< T, FIRST, LAST, typename etl::enable_if<(FIRST==0) &&(LAST==0)>::type >::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 , const T FIRST, const T LAST>
etl::cyclic_value< T, FIRST, LAST, typename etl::enable_if<(FIRST==0) &&(LAST==0)>::type >::operator const T ( ) const
inline

Const conversion operator.

Returns
The value of the underlying type.

◆ operator T()

template<typename T , const T FIRST, const T LAST>
etl::cyclic_value< T, FIRST, LAST, typename etl::enable_if<(FIRST==0) &&(LAST==0)>::type >::operator T ( )
inline

Conversion operator.

Returns
The value of the underlying type.

◆ set() [1/2]

template<typename T , const T FIRST, const T LAST>
void etl::cyclic_value< T, FIRST, LAST, typename etl::enable_if<(FIRST==0) &&(LAST==0)>::type >::set ( first_,
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 , const T FIRST, const T LAST>
void etl::cyclic_value< T, FIRST, LAST, typename etl::enable_if<(FIRST==0) &&(LAST==0)>::type >::set ( value_)
inline

Sets the value.

Parameters
valueThe value.