#include <C:/Work/specialnumbers_svn/NumberLib/NumbersLib/CyclicNumber.h>
For example,
CyclicNumber<int> c(0, 0, 4, 1); c += 10; cout << c;
prints 2.
Definition at line 29 of file CyclicNumber.h.
Public Member Functions | |
CyclicNumber (T value, T min, T max, T increment) | |
virtual void | dec (float elapsedTime=1) |
virtual T | getValidValue (const T &value) const |
virtual void | inc (float elapsedTime=1) |
CyclicNumber< T > | operator++ (int) |
Post-increments this Cyclic number's value with increment, and wraps it around if it exceeds the max. | |
CyclicNumber< T > & | operator++ () |
Pre-increments this Cyclic number's value with increment, and wraps it around if it exceeds the max. | |
CyclicNumber< T > & | operator+= (const T &increment) |
Increments this CyclicNumber's value by the given increment, and waps it around. | |
CyclicNumber< T > | operator-- (int) |
Post-decrements this Cyclic number's value with increment, and wraps it around if it exceeds the max. | |
CyclicNumber< T > & | operator-- () |
Pre-decrements this Cyclic number's value with increment, and wraps it around if it exceeds the max. | |
CyclicNumber< T > & | operator-= (const T &decrement) |
Decrements this CyclicNumber's value by the given increment, and waps it around. | |
CyclicNumber< T > & | operator= (const T &value) |
CyclicNumber< T > & | operator= (const CyclicNumber< T > &other) |
CyclicNumber | ( | T | value, | |
T | min, | |||
T | max, | |||
T | increment | |||
) | [inline] |
Definition at line 85 of file CyclicNumber.h.
void dec | ( | float | elapsedTime = 1 |
) | [inline, virtual] |
Implements RangedNumber.
Definition at line 174 of file CyclicNumber.h.
References RangedNumber::mIncrement, RangedNumber::mMax, RangedNumber::mMin, luma::numbers::mod(), and RangedNumber::mValue.
Referenced by CyclicNumber::operator--().
T getValidValue | ( | const T & | value | ) | const [inline, virtual] |
Implements RangedNumber.
Definition at line 161 of file CyclicNumber.h.
References RangedNumber::mMax, RangedNumber::mMin, and luma::numbers::mod().
void inc | ( | float | elapsedTime = 1 |
) | [inline, virtual] |
Implements RangedNumber.
Definition at line 167 of file CyclicNumber.h.
References RangedNumber::mIncrement, RangedNumber::mMax, RangedNumber::mMin, luma::numbers::mod(), and RangedNumber::mValue.
Referenced by CyclicNumber::operator++().
CyclicNumber< T > operator++ | ( | int | ) | [inline] |
Post-increments this Cyclic number's value with increment, and wraps it around if it exceeds the max.
Definition at line 117 of file CyclicNumber.h.
CyclicNumber< T > & operator++ | ( | ) | [inline, virtual] |
Pre-increments this Cyclic number's value with increment, and wraps it around if it exceeds the max.
Implements RangedNumber.
Definition at line 109 of file CyclicNumber.h.
References CyclicNumber::inc().
CyclicNumber< T > & operator+= | ( | const T & | increment | ) | [inline] |
Increments this CyclicNumber's value by the given increment, and waps it around.
Definition at line 143 of file CyclicNumber.h.
References RangedNumber::mMax, RangedNumber::mMin, luma::numbers::mod(), and RangedNumber::mValue.
CyclicNumber< T > operator-- | ( | int | ) | [inline] |
Post-decrements this Cyclic number's value with increment, and wraps it around if it exceeds the max.
Definition at line 134 of file CyclicNumber.h.
CyclicNumber< T > & operator-- | ( | ) | [inline, virtual] |
Pre-decrements this Cyclic number's value with increment, and wraps it around if it exceeds the max.
Implements RangedNumber.
Definition at line 126 of file CyclicNumber.h.
References CyclicNumber::dec().
CyclicNumber< T > & operator-= | ( | const T & | decrement | ) | [inline] |
Decrements this CyclicNumber's value by the given increment, and waps it around.
Definition at line 152 of file CyclicNumber.h.
References RangedNumber::mMax, RangedNumber::mMin, luma::numbers::mod(), and RangedNumber::mValue.
CyclicNumber< T > & operator= | ( | const T & | value | ) | [inline, virtual] |
Reimplemented from RangedNumber.
Definition at line 101 of file CyclicNumber.h.
References RangedNumber::mMax, RangedNumber::mMin, luma::numbers::mod(), and RangedNumber::mValue.
CyclicNumber< T > & operator= | ( | const CyclicNumber< T > & | other | ) | [inline] |