PingPongNumber Class Template Reference

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

Inheritance diagram for PingPongNumber:

RangedNumber

List of all members.


Detailed Description

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

A PingPongNumber is a number that can grow (or shrink) up to a point, and then starts shrinking (or growing) again.

Author:
Herman Tulleken (herman.tulleken@gmail.com)

luma/games (http://www.luma.co.za/)

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.

Parameters:
T Must be

Definition at line 38 of file PingPongNumber.h.


Public Member Functions

virtual void dec (float elapsedTime=1)
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

pingPongValue () const
 Converts the internal cyclic value to a ping pong value.
pingPongValue (T value) const
 Converts the internal cyclic value to a ping pong value.

Private Attributes

CyclicNumber< T > mCyclicNumber

Constructor & Destructor Documentation

PingPongNumber ( value,
min,
max,
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.


Member Function Documentation

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

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]

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]

PingPongNumber< T > & operator= ( const PingPongNumber< T > &  other  )  [inline]

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 ( 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]


Member Data Documentation


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