CyclicNumber Class Template Reference

#include <C:/Work/specialnumbers_svn/NumberLib/NumbersLib/CyclicNumber.h>

Inheritance diagram for CyclicNumber:

RangedNumber

List of all members.


Detailed Description

template<class T>
class luma::numbers::CyclicNumber< T >

A cyclic number is a number that is always in a given range, and wraps around when it would exceed this range.

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)

Constructor & Destructor Documentation

CyclicNumber ( value,
min,
max,
increment 
) [inline]

Definition at line 85 of file CyclicNumber.h.


Member Function Documentation

void dec ( float  elapsedTime = 1  )  [inline, virtual]

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]

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]

Definition at line 91 of file CyclicNumber.h.

References RangedNumber::operator=().


The documentation for this class was generated from the following file:

Generated on Sun Sep 21 20:49:08 2008 for Numbers by  doxygen 1.5.6