Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
orxonox::InputDeviceTemplated< Traits > Class Template Reference

Heavily templated base class for all three input devices. More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/CorePrereqs.h>

Inheritance diagram for orxonox::InputDeviceTemplated< Traits >:
orxonox::InputDevice

Public Member Functions

 InputDeviceTemplated (unsigned int id, OIS::InputManager *oisInputManager)
 Creates the OIS device. More...
 
virtual ~InputDeviceTemplated ()
 Destroys the OIS device. More...
 
virtual void clearBuffers () override
 Clears the list of pressed buttons and calls the derived class's method. More...
 
virtual std::string getClassName () const override
 Returns the device class (derived) name as string. More...
 
OISDeviceClassgetOISDevice ()
 
virtual void update (const Clock &time) override
 Captures OIS events (which then get distributed to the derived class) and creates the button held events. More...
 
- Public Member Functions inherited from orxonox::InputDevice
 InputDevice (unsigned int id)
 Only resets the members. More...
 
virtual ~InputDevice ()=default
 
unsigned int getDeviceID () const
 Returns the ID of the device (the same as in InputDeviceEnumerator for mouse and keyboard) More...
 
std::vector< InputState * > & getStateListRef ()
 Returns a reference to the internal input state vector. Use with care! More...
 
bool isCalibrating () const
 Tells whether the device is in calibration mode. More...
 
void startCalibration ()
 Start calibrating (only useful for joy sticks) More...
 
void stopCalibration ()
 Stop calibrating and evaluate the data (only useful for joy sticks) More...
 

Protected Member Functions

ORX_FORCEINLINE void buttonPressed (ButtonTypeParam button)
 Common code for all button pressed events (updates pressed buttons list and calls the input states) More...
 
ORX_FORCEINLINE void buttonReleased (ButtonTypeParam button)
 Common code for all button released events (updates pressed buttons list and calls the input states) More...
 
- Protected Member Functions inherited from orxonox::InputDevice
virtual void calibrationStarted ()
 To be ovrridden by the subclass. More...
 
virtual void calibrationStopped ()
 To be ovrridden by the subclass. More...
 

Protected Attributes

OISDeviceClassoisDevice_
 Managed pointer to the OIS device. More...
 
- Protected Attributes inherited from orxonox::InputDevice
std::vector< InputState * > inputStates_
 List of all input states that receive events from this device. More...
 

Private Types

typedef Traits::ButtonType ButtonType
 
typedef Traits::ButtonTypeParam ButtonTypeParam
 
typedef Traits::DeviceClass DeviceClass
 
typedef Traits::OISDeviceClass OISDeviceClass
 

Private Member Functions

void clearBuffersImpl ()
 < Fallback dummy function for static polymorphism More...
 
ButtonTypegetButtonEventArg (ButtonType &button)
 
void updateImpl (const Clock &time)
 Fallback dummy function for static polymorphism. More...
 

Private Attributes

OIS::InputManageroisInputManager_
 Pointer to the OIS InputManager that can create and destroy devices. More...
 
std::vector< ButtonTypepressedButtons_
 List of all buttons that are currently pressed down. More...
 

Static Private Attributes

static const OIS::Type OISDeviceValue = Traits::OISDeviceValue
 

Detailed Description

template<class Traits>
class orxonox::InputDeviceTemplated< Traits >

Heavily templated base class for all three input devices.

The purpose of this class is not to provide an interface but rather to reduce code redundancy. This concerns device creation and destruction as well as common code for button events (press, release, hold).

In order to derive from this class you have to supply it with a struct as template parameter that contains the necessary type traits.

Member Typedef Documentation

template<class Traits>
typedef Traits::ButtonType orxonox::InputDeviceTemplated< Traits >::ButtonType
private
template<class Traits>
typedef Traits::ButtonTypeParam orxonox::InputDeviceTemplated< Traits >::ButtonTypeParam
private
template<class Traits>
typedef Traits::DeviceClass orxonox::InputDeviceTemplated< Traits >::DeviceClass
private
template<class Traits>
typedef Traits::OISDeviceClass orxonox::InputDeviceTemplated< Traits >::OISDeviceClass
private

Constructor & Destructor Documentation

template<class Traits>
orxonox::InputDeviceTemplated< Traits >::InputDeviceTemplated ( unsigned int  id,
OIS::InputManager oisInputManager 
)
inline

Creates the OIS device.

template<class Traits>
virtual orxonox::InputDeviceTemplated< Traits >::~InputDeviceTemplated ( )
inlinevirtual

Destroys the OIS device.

Member Function Documentation

template<class Traits>
ORX_FORCEINLINE void orxonox::InputDeviceTemplated< Traits >::buttonPressed ( ButtonTypeParam  button)
inlineprotected

Common code for all button pressed events (updates pressed buttons list and calls the input states)

template<class Traits>
ORX_FORCEINLINE void orxonox::InputDeviceTemplated< Traits >::buttonReleased ( ButtonTypeParam  button)
inlineprotected

Common code for all button released events (updates pressed buttons list and calls the input states)

template<class Traits>
virtual void orxonox::InputDeviceTemplated< Traits >::clearBuffers ( )
inlineoverridevirtual

Clears the list of pressed buttons and calls the derived class's method.

Implements orxonox::InputDevice.

template<class Traits>
void orxonox::InputDeviceTemplated< Traits >::clearBuffersImpl ( )
inlineprivate

< Fallback dummy function for static polymorphism

Fallback dummy function for static polymorphism

template<class Traits>
ButtonType& orxonox::InputDeviceTemplated< Traits >::getButtonEventArg ( ButtonType button)
inlineprivate
template<class Traits>
virtual std::string orxonox::InputDeviceTemplated< Traits >::getClassName ( ) const
inlineoverridevirtual

Returns the device class (derived) name as string.

Implements orxonox::InputDevice.

template<class Traits>
OISDeviceClass* orxonox::InputDeviceTemplated< Traits >::getOISDevice ( )
inline
template<class Traits>
virtual void orxonox::InputDeviceTemplated< Traits >::update ( const Clock time)
inlineoverridevirtual

Captures OIS events (which then get distributed to the derived class) and creates the button held events.

Implements orxonox::InputDevice.

template<class Traits>
void orxonox::InputDeviceTemplated< Traits >::updateImpl ( const Clock time)
inlineprivate

Fallback dummy function for static polymorphism.

Member Data Documentation

template<class Traits>
OISDeviceClass* orxonox::InputDeviceTemplated< Traits >::oisDevice_
protected

Managed pointer to the OIS device.

template<class Traits>
const OIS::Type orxonox::InputDeviceTemplated< Traits >::OISDeviceValue = Traits::OISDeviceValue
staticprivate
template<class Traits>
OIS::InputManager* orxonox::InputDeviceTemplated< Traits >::oisInputManager_
private

Pointer to the OIS InputManager that can create and destroy devices.

template<class Traits>
std::vector<ButtonType> orxonox::InputDeviceTemplated< Traits >::pressedButtons_
private

List of all buttons that are currently pressed down.


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