#include <C:/Work/specialnumbers_svn/NumberLib/NumbersLib/PingPongNumber.h>
For example:
PingPongNumber n(0, 0, 3, 1); for(int i = 0; i < 7; i++) { n++; cout << n << " "; }
will print 0 1 2 1 0 1 2.
T | Must be |
Definition at line 38 of file PingPongNumber.h.
Public Member Functions | |
virtual void | dec (float elapsedTime=1) |
T | getCyclicValue () const |
Used for debugging and testing only. | |
virtual T | getValidValue (const T &value) const |
virtual void | inc (float elapsedTime=1) |
PingPongNumber< T > | operator++ (int) |
PingPongNumber< T > & | operator++ () |
Puts this ClampedNumber's value onto the stream. | |
PingPongNumber< T > | operator-- (int) |
PingPongNumber< T > & | operator-- () |
Decrements this RangedNumber by one increment, as specified by the constructor. | |
PingPongNumber< T > & | operator= (const T &value) |
PingPongNumber< T > & | operator= (const PingPongNumber< T > &other) |
PingPongNumber (const PingPongNumber &other) | |
PingPongNumber (T value, T min, T max, T increment) | |
Constructs a new PingPongNumber with the given value, min, max, and direction. | |
void | setIncrement (const T &increment) |
Private Member Functions | |
T | pingPongValue () const |
Converts the internal cyclic value to a ping pong value. | |
T | pingPongValue (T value) const |
Converts the internal cyclic value to a ping pong value. | |
Private Attributes | |
CyclicNumber< T > | mCyclicNumber |
PingPongNumber | ( | T | value, | |
T | min, | |||
T | max, | |||
T | increment | |||
) | [inline] |
Constructs a new PingPongNumber with the given value, min, max, and direction.
Definition at line 92 of file PingPongNumber.h.
PingPongNumber | ( | const PingPongNumber< T > & | other | ) | [inline] |
Definition at line 99 of file PingPongNumber.h.
void dec | ( | float | elapsedTime = 1 |
) | [inline, virtual] |
Implements RangedNumber.
Definition at line 175 of file PingPongNumber.h.
References PingPongNumber::mCyclicNumber, RangedNumber::mValue, and PingPongNumber::pingPongValue().
Referenced by PingPongNumber::operator--().
T getCyclicValue | ( | ) | const [inline] |
Used for debugging and testing only.
Definition at line 190 of file PingPongNumber.h.
References PingPongNumber::mCyclicNumber.
T getValidValue | ( | const T & | value | ) | const [inline, virtual] |
Implements RangedNumber.
Definition at line 161 of file PingPongNumber.h.
References PingPongNumber::mCyclicNumber, and PingPongNumber::pingPongValue().
void inc | ( | float | elapsedTime = 1 |
) | [inline, virtual] |
Implements RangedNumber.
Definition at line 167 of file PingPongNumber.h.
References PingPongNumber::mCyclicNumber, RangedNumber::mValue, and PingPongNumber::pingPongValue().
Referenced by PingPongNumber::operator++().
PingPongNumber< T > operator++ | ( | int | ) | [inline] |
Definition at line 133 of file PingPongNumber.h.
PingPongNumber< T > & operator++ | ( | ) | [inline, virtual] |
Puts this ClampedNumber's value onto the stream.
Increments this RangedNumber by one increment, as specified by the constructor.
Implements RangedNumber.
Definition at line 125 of file PingPongNumber.h.
References PingPongNumber::inc().
PingPongNumber< T > operator-- | ( | int | ) | [inline] |
Definition at line 151 of file PingPongNumber.h.
PingPongNumber< T > & operator-- | ( | ) | [inline, virtual] |
Decrements this RangedNumber by one increment, as specified by the constructor.
Implements RangedNumber.
Definition at line 143 of file PingPongNumber.h.
References PingPongNumber::dec().
PingPongNumber< T > & operator= | ( | const T & | value | ) | [inline, virtual] |
Reimplemented from RangedNumber.
Definition at line 116 of file PingPongNumber.h.
References PingPongNumber::mCyclicNumber, RangedNumber::mValue, and PingPongNumber::pingPongValue().
PingPongNumber< T > & operator= | ( | const PingPongNumber< T > & | other | ) | [inline] |
Definition at line 106 of file PingPongNumber.h.
References PingPongNumber::mCyclicNumber, RangedNumber::mIncrement, RangedNumber::mMax, RangedNumber::mMin, RangedNumber::modify(), RangedNumber::mValue, and PingPongNumber::pingPongValue().
T pingPongValue | ( | ) | const [inline, private] |
Converts the internal cyclic value to a ping pong value.
Definition at line 54 of file PingPongNumber.h.
References PingPongNumber::mCyclicNumber.
Referenced by PingPongNumber::dec(), PingPongNumber::getValidValue(), PingPongNumber::inc(), and PingPongNumber::operator=().
T pingPongValue | ( | T | value | ) | const [inline, private] |
Converts the internal cyclic value to a ping pong value.
Definition at line 46 of file PingPongNumber.h.
References RangedNumber::mIncrement, and RangedNumber::mMax.
void setIncrement | ( | const T & | increment | ) | [inline, virtual] |
Reimplemented from RangedNumber.
Definition at line 183 of file PingPongNumber.h.
References PingPongNumber::mCyclicNumber, RangedNumber::mMax, RangedNumber::mMin, and RangedNumber::setIncrement().
CyclicNumber<T> mCyclicNumber [private] |
Definition at line 41 of file PingPongNumber.h.
Referenced by PingPongNumber::dec(), PingPongNumber::getCyclicValue(), PingPongNumber::getValidValue(), PingPongNumber::inc(), PingPongNumber::operator=(), PingPongNumber::pingPongValue(), and PingPongNumber::setIncrement().