28 #ifndef __Controller_H__
29 #define __Controller_H__
70 while (mDeltaCount >= 1.0)
72 while (mDeltaCount < 0.0)
91 mDeltaInput = deltaInput;
103 template <
typename T>
134 template <
typename T>
157 : mSource(src), mDest(dest), mFunc(func)
223 mDest->setValue(mFunc->calculate(mSource->getValue()));
virtual ~Controller()
Default d-tor.
SharedPtr< ControllerFunction< T > > mFunc
Function.
const SharedPtr< ControllerValue< T > > & getSource(void) const
Gets the input controller value.
virtual void setValue(T value)=0
Subclasses of this class are responsible for performing a function on an input value for a Controller...
const SharedPtr< ControllerFunction< T > > & getFunction(void) const
Returns a pointer to the function object used by this controller.
bool mEnabled
Controller is enabled or not.
Can either be used as an input or output value.
void setSource(const SharedPtr< ControllerValue< T > > &src)
Sets the input controller value.
Instances of this class 'control' the value of another object in the system.
void update(void)
Tells this controller to map it's input controller value to it's output controller value...
bool mDeltaInput
If true, function will add input values together and wrap at 1.0 before evaluating.
const SharedPtr< ControllerValue< T > > & getDestination(void) const
Gets the output controller value.
SharedPtr< ControllerValue< T > > mDest
Destination value.
void setDestination(const SharedPtr< ControllerValue< T > > &dest)
Sets the output controller value.
T getAdjustedInput(T input)
Gets the input value as adjusted by any delta.
bool getEnabled(void) const
Returns true if this controller is currently enabled.
Reference-counted shared pointer, used for objects where implicit destruction is required.
virtual T calculate(T sourceValue)=0
Controller(const SharedPtr< ControllerValue< T > > &src, const SharedPtr< ControllerValue< T > > &dest, const SharedPtr< ControllerFunction< T > > &func)
Usual constructor.
void setFunction(const SharedPtr< ControllerFunction< T > > &func)
Sets the function object to be used by this controller.
virtual ~ControllerValue()
void setEnabled(bool enabled)
Sets whether this controller is enabled.
virtual T getValue(void) const =0
ControllerFunction(bool deltaInput)
Constructor.
virtual ~ControllerFunction()
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
SharedPtr< ControllerValue< T > > mSource
Source value.