Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

InputDevice Class Reference

Basic input device class. More...

#include <inputdevice.hpp>

Inheritance diagram for InputDevice:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 InputDevice ()
 Constructor.
virtual ~InputDevice ()
 Destructor.
void startPolling ()
 Start polling of input device.
void stopPolling ()
 Stop polling of input device.

Protected Member Functions

virtual void run ()
 Main method of input device thread.
virtual bool poll ()
 If any button was pressed poll() gives a signal to the handler and creates afterwards a reaction record if the reaction was valid.
virtual bool handle (vector< bool > &states)
 Checks if the reaction was valid.

Protected Attributes

bool active
 state flag

Detailed Description

Basic input device class.

A input device polls devices like mouse or keyboard for user reactions.

Definition at line 31 of file inputdevice.hpp.


Constructor & Destructor Documentation

InputDevice::InputDevice  ) 
 

Constructor.

Definition at line 29 of file inputdevice.cpp.

References active.

InputDevice::~InputDevice  )  [virtual]
 

Destructor.

Definition at line 36 of file inputdevice.cpp.


Member Function Documentation

bool InputDevice::handle vector< bool > &  states  )  [protected, virtual]
 

Checks if the reaction was valid.

Reimplemented in JoystickInputDevice, KeyboardInputDevice, and MouseInputDevice.

Definition at line 105 of file inputdevice.cpp.

Referenced by run().

bool InputDevice::poll  )  [protected, virtual]
 

If any button was pressed poll() gives a signal to the handler and creates afterwards a reaction record if the reaction was valid.

Reimplemented in JoystickInputDevice, KeyboardInputDevice, and MouseInputDevice.

Definition at line 98 of file inputdevice.cpp.

Referenced by run().

void InputDevice::run  )  [protected, virtual]
 

Main method of input device thread.

This method polls input devices via the poll() method and if necessary measures the time in which a event has happened. Then the handle() method is called which checks if an event is a valid reaction or not. If it is valid a ReactionRecord is inserted in the reaction queue.

Reimplemented in SimulatedInputDevice.

Definition at line 48 of file inputdevice.cpp.

References active, PtfCore::getEventLog(), PtfCore::getReactionRecords(), PtfCore::getReactionRecordsMutex(), Singleton< PtfCore >::getSingleton(), handle(), TimeInterval::measureA(), TimeInterval::measureB(), poll(), and TimeInterval::toString().

Here is the call graph for this function:

void InputDevice::startPolling  ) 
 

Start polling of input device.

Definition at line 112 of file inputdevice.cpp.

References active.

void InputDevice::stopPolling  ) 
 

Stop polling of input device.

Definition at line 120 of file inputdevice.cpp.

References active.


Member Data Documentation

bool InputDevice::active [protected]
 

state flag

Definition at line 33 of file inputdevice.hpp.

Referenced by InputDevice(), run(), startPolling(), and stopPolling().


The documentation for this class was generated from the following files:
Generated on Fri Dec 17 14:54:29 2004 for Psychological Test Framework by doxygen 1.3.8