#include <gadget/Devices/Sim/SimDigital.h>
Inheritance diagram for gadget::SimDigital:


Public Member Functions | |
| SimDigital () | |
| Default Constructor. | |
| virtual | ~SimDigital () |
| Destructor. | |
| virtual bool | config (jccl::ConfigElementPtr element) |
| virtual bool | startSampling () |
| These functions don't do anything. | |
| virtual bool | stopSampling () |
| virtual bool | sample () |
| virtual void | updateData () |
| Updates the state of the digital data vector. | |
| virtual std::vector< KeyModPair > | getKeys () |
| void | operator delete (void *p) |
| Invokes the global scope delete operator. | |
Static Public Member Functions | |
| static std::string | getElementType () |
Protected Member Functions | |
| virtual void | destroy () |
| Deletes this object. | |
Simulates a digital device from a keyboard device. It allows any number of simulated digital devices to be created.
When the key configured is held down, the digital device is on. When the key is released, the device is no longer set.
This class should not be used directly by the user.
Definition at line 59 of file SimDigital.h.
| gadget::SimDigital::SimDigital | ( | ) |
Default Constructor.
Definition at line 41 of file SimDigital.cpp.
00042 { 00043 vprDEBUG(vprDBG_ALL, vprDBG_VERB_LVL)<<"*** SimDigital::SimDigital()\n"<< vprDEBUG_FLUSH; 00044 }
| gadget::SimDigital::~SimDigital | ( | ) | [virtual] |
Destructor.
Definition at line 47 of file SimDigital.cpp.
00048 { 00049 //vprDEBUG(vprDBG_ALL, vprDBG_VERB_LVL)<<"*** SimDigital::~SimDigital()\n"<< vprDEBUG_FLUSH; 00050 }
| bool gadget::SimDigital::config | ( | jccl::ConfigElementPtr | element | ) | [virtual] |
Definition at line 57 of file SimDigital.cpp.
References gadget::SimInput::config(), gadget::Digital::config(), and gadget::Input::config().
00058 { 00059 //vprDEBUG(vprDBG_ALL, vprDBG_VERB_LVL)<<"*** SimDigital::config()\n"<< vprDEBUG_FLUSH; 00060 if (! (Input::config(element) && Digital::config(element) && 00061 SimInput::config(element)) ) 00062 { 00063 return false; 00064 } 00065 00066 std::vector<jccl::ConfigElementPtr> key_list; 00067 int key_count = element->getNum("key_pair"); 00068 for ( int i = 0; i < key_count; ++i ) 00069 { 00070 key_list.push_back(element->getProperty<jccl::ConfigElementPtr>("key_pair", i)); 00071 } 00072 mSimKeys = readKeyList(key_list); 00073 00074 return true; 00075 }
| virtual bool gadget::SimDigital::startSampling | ( | ) | [inline, virtual] |
| virtual bool gadget::SimDigital::stopSampling | ( | ) | [inline, virtual] |
| virtual bool gadget::SimDigital::sample | ( | ) | [inline, virtual] |
| void gadget::SimDigital::updateData | ( | ) | [virtual] |
Updates the state of the digital data vector.
Definition at line 83 of file SimDigital.cpp.
00084 { 00085 //vprDEBUG(vprDBG_ALL, vprDBG_VERB_LVL)<<"*** SimDigital::updateData()\n"<< vprDEBUG_FLUSH; 00086 std::vector<DigitalData> digital_data_sample(mSimKeys.size()); // The digital data that makes up the sample 00087 00088 // -- Update digital data --- // 00089 for (unsigned int i = 0; i < mSimKeys.size(); i++) 00090 { 00091 // Set the time for the digital data to the KeyboardMouse timestamp 00092 digital_data_sample[i].setTime(mKeyboardMouse->getTimeStamp()); 00093 if(checkKeyPair(mSimKeys[i])) // If keys pressed 00094 { 00095 digital_data_sample[i] = 1; 00096 } 00097 else 00098 { 00099 digital_data_sample[i] = 0; 00100 } 00101 } 00102 00103 // Add a sample 00104 addDigitalSample(digital_data_sample); 00105 00106 swapDigitalBuffers(); 00107 }
| std::string gadget::SimDigital::getElementType | ( | ) | [static] |
| virtual std::vector<KeyModPair> gadget::SimDigital::getKeys | ( | ) | [inline, virtual] |
| void gadget::SimDigital::operator delete | ( | void * | p | ) | [inline] |
Invokes the global scope delete operator.
This is required for proper releasing of memory in DLLs on Win32.
Definition at line 83 of file SimDigital.h.
| virtual void gadget::SimDigital::destroy | ( | ) | [inline, protected, virtual] |
Deletes this object.
This is an implementation of the pure virtual gadget::Input::destroy() method.
Definition at line 93 of file SimDigital.h.
1.5.1