#include <Input.h>
Inheritance diagram for gadget::Input:

Public Methods | |
| Input () | |
| Default Constructor. More... | |
| virtual | ~Input () |
| Input Destructor. More... | |
| virtual bool | config (jccl::ConfigElementPtr e) |
| Config method. More... | |
| virtual bool | sample ()=0 |
| Sample the device. More... | |
| virtual bool | startSampling ()=0 |
| Start a device sampling. More... | |
| virtual bool | stopSampling ()=0 |
| StopSampling. More... | |
| virtual void | updateData ()=0 |
| Update the data. More... | |
| std::string | getInstanceName () |
| Returns the name identifying this instance of the device. More... | |
| virtual std::string | getBaseType () |
| Get the BaseType used later by the BaseTypeFactory to build a "virtual" representation of this to be used for remote input. More... | |
| virtual vpr::ReturnStatus | writeObject (vpr::ObjectWriter *writer) |
| Serialize this device's data. More... | |
| virtual vpr::ReturnStatus | readObject (vpr::ObjectReader *reader) |
| De-serialize this devices data. More... | |
| bool | isActive () |
| Is this input device active? More... | |
Static Public Methods | |
| std::string | getElementType () |
| Returns the string rep of the element type used to config this device. More... | |
Protected Methods | |
| virtual void | destroy ()=0 |
| Subclasses must implement this so that dynamically loaded device drivers delete themselves in the correct memory space. More... | |
| Input (const Input &o) | |
| void | operator= (const Input &o) |
Protected Attributes | |
| std::string | mInstName |
| vpr::Thread * | mThread |
| The thread being used by the driver. More... | |
| bool | mActive |
| Is the driver active? More... | |
Input is the base class for all Input Devices, all the devices are therefore forced to implement the pure virtual functions of Sample, StartSampling, StopSampling, and UpdateData.
Dummy devices can use a default constructor, but physical devices should have a Constructor which takes a config element and calls the Input constructor taking a jccl::ConfigElementPtr.
All Physical devices will inherit from not Input but another abstract class which inherits from Input, currently there is support for Positional Devices, Analog Devices, and Digital devices, each has its own added pure virtual functions providing a simple and equal interface to themselves.
Definition at line 74 of file Input.h.
|
|
Default Constructor. The default constructor is intended only for use by the DummyProxies which do not need to have their serial port and baud rate etc set up. Also, initializes mThread and mActive to null values. Definition at line 43 of file Input.cpp.
|
|
|
Input Destructor. Free the memory for the Instance Name and Serial Port strings if allocated. Definition at line 91 of file Input.h.
00092 {
00093 ;
00094 }
|
|
|
Definition at line 222 of file Input.h.
00222 : vpr::SerializableObject(o)
00223 {;}
|
|
|
Config method. This baselevel config will fill the base datamembers when found in the jccl::ConfigElementPtr such as instance name. Reimplemented in gadget::EventWindowOSX. Definition at line 50 of file Input.cpp. References mInstName.
00051 {
00052 //if((!mPort.empty()) && (!mInstName.empty()))
00053 //{
00054 // ASSERT: We have already been configured
00055 // this prevents config from being called multiple times (once for each derived class)
00056 // ie. Digital, Analog, etc
00057 // return true;
00058 //}
00059
00060 mInstName = e->getFullName();
00061
00062 return true;
00063 }
|
|
|
Sample the device. Read the next set of input. This method is normally used internally by threaded drivers to repetively sample data in a separate thread. (This new data is not accessable until UpdateData is called) Implemented in gadget::EventWindowOSX. |
|
|
Start a device sampling. Start the device sampling, normally this will spawn a thread which will just repeatedly call Sample(). This function should return true when it sucessfully starts, false otherwise. Implemented in gadget::EventWindowOSX. |
|
|
StopSampling. Reverse the effects of StartSampling(). Implemented in gadget::EventWindowOSX. |
|
|
Update the data. After this function is called subsequent calls to GetData(d) will return the most recent data at the time of THIS function call. Data is guaranteed to be valid and static until the next call to UpdateData. Implemented in gadget::EventWindowOSX. |
|
|
Returns the string rep of the element type used to config this device. This string is used by the device factory to look up device drivers based up the type of element it is trying to load. Reimplemented in gadget::EventWindowOSX. Definition at line 145 of file Input.h.
00145 { return std::string("Undefined"); }
|
|
|
Returns the name identifying this instance of the device. This is the name given to the device in its config element (e.g., "MyFlockOfBirds", "The Ibox", etc.). Definition at line 152 of file Input.h. Referenced by gadget::InputLogger::addRecordingSample.
|
|
|
Get the BaseType used later by the BaseTypeFactory to build a "virtual" representation of this to be used for remote input.
Reimplemented in gadget::InputMixer< Input, Position >. Definition at line 165 of file Input.h.
00166 {
00167 return std::string("Input");
00168 }
|
|
|
Serialize this device's data.
Reimplemented in gadget::InputMixer< Input, Position >. Definition at line 173 of file Input.h. Referenced by gadget::InputLogger::addRecordingSample.
00174 {
00175 boost::ignore_unused_variable_warning(writer);
00176 return vpr::ReturnStatus(vpr::ReturnStatus::Fail);
00177 }
|
|
|
De-serialize this devices data.
Reimplemented in gadget::InputMixer< Input, Position >. Definition at line 182 of file Input.h. Referenced by gadget::InputLogger::playNextSample.
00183 {
00184 boost::ignore_unused_variable_warning(reader);
00185 return vpr::ReturnStatus(vpr::ReturnStatus::Fail);
00186 }
|
|
|
Is this input device active?
Definition at line 189 of file Input.h.
00190 {
00191 return mActive;
00192 }
|
|
|
Subclasses must implement this so that dynamically loaded device drivers delete themselves in the correct memory space. This uses a template pattern. Implemented in gadget::EventWindowOSX. |
|
|
Definition at line 224 of file Input.h.
00224 {;}
|
|
|
Definition at line 218 of file Input.h. Referenced by config, gadget::EventWindowWin32::createWindowWin32, and gadget::EventWindowWin32::updKeys. |
|
|
The thread being used by the driver.
Definition at line 219 of file Input.h. Referenced by gadget::EventWindowXWin::controlLoop, gadget::EventWindowXWin::startSampling, gadget::EventWindowWin32::startSampling, gadget::EventWindowXWin::stopSampling, and gadget::EventWindowWin32::stopSampling. |
|
|
Is the driver active?
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002