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


Public Member Functions | |
| SimInput () | |
| virtual | ~SimInput () |
| virtual bool | config (jccl::ConfigElementPtr element) |
| Configures the keyboard interface. | |
| virtual std::string | getInputTypeName () |
| virtual vpr::ReturnStatus | writeObject (vpr::ObjectWriter *writer) |
| virtual vpr::ReturnStatus | readObject (vpr::ObjectReader *reader) |
Protected Member Functions | |
| virtual int | checkKeyPair (KeyModPair &pair) |
| Checks the given keypair. | |
| std::vector< KeyModPair > | readKeyList (std::vector< jccl::ConfigElementPtr > &keyList) |
| Constructs the mod pair from a mod pair element. | |
Protected Attributes | |
| KeyboardMouseInterface | mKeyboardMouse |
| The keyboard/mouse device from which we receive events. | |
Classes | |
| class | KeyModPair |
Has the common routines for accessing and seting up keyboard interface.
Definition at line 55 of file SimInput.h.
| gadget::SimInput::SimInput | ( | ) | [inline] |
Definition at line 91 of file SimInput.h.
00092 { 00093 //vprDEBUG(vprDBG_ALL, vprDBG_VERB_LVL)<<"*** SimInput::SimInput()\n"<< vprDEBUG_FLUSH; 00094 }
| virtual gadget::SimInput::~SimInput | ( | ) | [inline, virtual] |
| bool gadget::SimInput::config | ( | jccl::ConfigElementPtr | element | ) | [virtual] |
Configures the keyboard interface.
Reimplemented in gadget::SimGloveGesture.
Definition at line 70 of file SimInput.cpp.
References gadget::BaseDeviceInterface::init(), and mKeyboardMouse.
Referenced by gadget::SimPosition::config(), gadget::SimGloveGesture::config(), gadget::SimDigitalGlove::config(), gadget::SimDigital::config(), and gadget::SimAnalog::config().
00071 { 00072 // Get the event source. 00073 mKeyboardMouse.init(element->getProperty<std::string>("keyboard_mouse_proxy")); 00074 00075 return true; 00076 }
| virtual std::string gadget::SimInput::getInputTypeName | ( | ) | [inline, virtual] |
| virtual vpr::ReturnStatus gadget::SimInput::writeObject | ( | vpr::ObjectWriter * | writer | ) | [inline, virtual] |
Definition at line 108 of file SimInput.h.
00109 { 00110 boost::ignore_unused_variable_warning(writer); 00111 return vpr::ReturnStatus::Succeed; 00112 }
| virtual vpr::ReturnStatus gadget::SimInput::readObject | ( | vpr::ObjectReader * | reader | ) | [inline, virtual] |
Definition at line 114 of file SimInput.h.
00115 { 00116 boost::ignore_unused_variable_warning(reader); 00117 return vpr::ReturnStatus::Succeed; 00118 }
| int gadget::SimInput::checkKeyPair | ( | KeyModPair & | pair | ) | [protected, virtual] |
Checks the given keypair.
Definition at line 78 of file SimInput.cpp.
References gadget::SimInput::KeyModPair::mKey, mKeyboardMouse, and gadget::SimInput::KeyModPair::mModifier.
00079 { 00080 // If the modifier is any 00081 // - Then check to see if the key is pressed. 00082 // Else 00083 // - The modifier and the key must be pressed. 00084 00085 // NOTE: If the modifier is NONE, then if any modifier 00086 // is pressed we will return 0; 00087 00088 if (pair.mModifier == -1) 00089 { 00090 return mKeyboardMouse->keyPressed(pair.mKey); 00091 } 00092 if (mKeyboardMouse->modifierOnly(pair.mModifier)) 00093 { 00094 return mKeyboardMouse->keyPressed(pair.mKey); 00095 } 00096 else 00097 { 00098 return 0; 00099 } 00100 }
| std::vector< SimInput::KeyModPair > gadget::SimInput::readKeyList | ( | std::vector< jccl::ConfigElementPtr > & | keyList | ) | [protected] |
Constructs the mod pair from a mod pair element.
Takes as input a element that has a list of KeyModPair child elements.
Definition at line 42 of file SimInput.cpp.
Referenced by gadget::SimGloveGesture::config().
00043 { 00044 std::vector<KeyModPair> key_vec; 00045 00046 if ( ! keyList.empty() ) 00047 { 00048 #ifdef GADGET_DEBUG 00049 jccl::ConfigElementPtr first_element = keyList[0]; 00050 std::string element_type(first_element->getID()); 00051 vprASSERT(element_type == std::string("key_modifier_pair")); 00052 #endif 00053 00054 for ( std::vector<jccl::ConfigElementPtr>::iterator i = keyList.begin(); 00055 i != keyList.end(); 00056 ++i ) 00057 { 00058 key_vec.push_back(KeyModPair((gadget::Keys) (*i)->getProperty<int>("key"), 00059 (gadget::Keys) (*i)->getProperty<int>("modifier_key"))); 00060 } 00061 } 00062 00063 return key_vec; 00064 }
The keyboard/mouse device from which we receive events.
Definition at line 143 of file SimInput.h.
Referenced by checkKeyPair(), and config().
1.5.1