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


Public Methods | |
| SimDigital () | |
| Default Constructor. More... | |
| virtual | ~SimDigital () |
| Destructor. More... | |
| virtual bool | config (jccl::ConfigElementPtr element) |
| virtual bool | startSampling () |
| These functions don't do anything. More... | |
| virtual bool | stopSampling () |
| virtual bool | sample () |
| virtual void | updateData () |
| Updates the state of the digital data vector. More... | |
| virtual std::vector< KeyModPair > | getKeys () |
| void | operator delete (void *p) |
| Invokes the global scope delete operator. More... | |
Static Public Methods | |
| std::string | getElementType () |
Protected Methods | |
| virtual void | destroy () |
| Deletes this object. More... | |
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 57 of file SimDigital.h.
|
|
Default Constructor.
Definition at line 41 of file SimDigital.cpp.
00042 {
00043 vprDEBUG(vprDBG_ALL, vprDBG_VERB_LVL)<<"*** SimDigital::SimDigital()\n"<< vprDEBUG_FLUSH;
00044 }
|
|
|
Destructor.
Definition at line 47 of file SimDigital.cpp.
00048 {
00049 //vprDEBUG(vprDBG_ALL, vprDBG_VERB_LVL)<<"*** SimDigital::~SimDigital()\n"<< vprDEBUG_FLUSH;
00050 }
|
|
|
Reimplemented from gadget::Digital. Definition at line 57 of file SimDigital.cpp.
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 }
|
|
|
These functions don't do anything.
Definition at line 66 of file SimDigital.h.
00066 { return 1; }
|
|
|
Definition at line 67 of file SimDigital.h.
00067 { return 1; }
|
|
|
Definition at line 68 of file SimDigital.h.
00068 { return 1; }
|
|
|
Updates the state of the digital data vector.
Definition at line 83 of file SimDigital.cpp. References gadget::Digital::addDigitalSample, and gadget::Digital::swapDigitalBuffers.
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 digital_data_sample[i].setTime();
00092 if(checkKeyPair(mSimKeys[i])) // If keys pressed
00093 {
00094 digital_data_sample[i] = 1;
00095 }
00096 else
00097 {
00098 digital_data_sample[i] = 0;
00099 }
00100 }
00101
00102 // Add a sample
00103 addDigitalSample(digital_data_sample);
00104
00105 swapDigitalBuffers();
00106 }
|
|
|
Definition at line 52 of file SimDigital.cpp.
00053 {
00054 return "simulated_digital_device";
00055 }
|
|
|
Definition at line 75 of file SimDigital.h.
00075 { return mSimKeys; }
|
|
|
Invokes the global scope delete operator. This is required for proper releasing of memory in DLLs on Win32. Definition at line 81 of file SimDigital.h.
00082 {
00083 ::operator delete(p);
00084 }
|
|
|
Deletes this object. This is an implementation of the pure virtual gadget::Input::destroy() method. Definition at line 91 of file SimDigital.h.
00092 {
00093 delete this;
00094 }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002