BufferedNumber Class Template Reference

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

Inheritance diagram for BufferedNumber:

UpdateableNumber

List of all members.


Detailed Description

template<class T, class Number = ClampedNumber<T>>
class luma::numbers::BufferedNumber< T, Number >

This class mimicks a float, but ensures smooth transitions.

The value returned grows towards the value set at a maximum pace.

The function is updated everyTime setValue() is called.

\[ y_n = y_{n-1} + sign(x_n - y_{n-1}) \max(d, |y_{n-1} - x_n|). \]

Author:
Herman Tulleken (herman.tulleken@gmail.com)
The code of this documentation can be downloaded from http://www.luma.co.za/labs/2007/09/01/c-special-numbers-library/.

Definition at line 31 of file BufferedNumber.h.


Public Member Functions

 BufferedNumber (T initialValue, T min, T max, T increment)
 Constructs a new BufferedNumber.
void forceValue (T value)
 Forces the value of this BufferedNumber to the given value.
getValue () const
 Returns the value of this buffered number.
void setValue (T value, float elapsedTime=TIME_UNIT)
 Sets the next input sample for this BufferedNumber.

Private Attributes

Number mIdealValue
Number mValue

Constructor & Destructor Documentation

BufferedNumber ( initialValue,
min,
max,
increment 
) [inline]

Constructs a new BufferedNumber.

The number initial value is clamped between min and max.

Definition at line 65 of file BufferedNumber.h.


Member Function Documentation

void forceValue ( value  )  [inline]

Forces the value of this BufferedNumber to the given value.

After this funcion has been called, the value returned by the next call to getValue will be the value passed to this function.

Definition at line 91 of file BufferedNumber.h.

References BufferedNumber::mIdealValue, and BufferedNumber::mValue.

T getValue (  )  const [inline, virtual]

Returns the value of this buffered number.

This value is always in the interval [min, max).

Implements UpdateableNumber.

Definition at line 72 of file BufferedNumber.h.

References BufferedNumber::mValue.

void setValue ( value,
float  elapsedTime = TIME_UNIT 
) [inline, virtual]

Sets the next input sample for this BufferedNumber.

Implements UpdateableNumber.

Definition at line 78 of file BufferedNumber.h.

References luma::numbers::frameRate, BufferedNumber::mIdealValue, and BufferedNumber::mValue.


Member Data Documentation

Number mIdealValue [private]

Definition at line 34 of file BufferedNumber.h.

Referenced by BufferedNumber::forceValue(), and BufferedNumber::setValue().

Number mValue [private]


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