#include <SDLTranslator.h>
Inheritance diagram for cmil::SDL::tDeviceTranslator< DeviceBase >:


| Public Member Functions | |
| tDeviceTranslator (System *const sys) | |
| virtual bool | translate (const SDL_Event &input_event)=0 | 
| This should return a boolean as to whether or not translation was successful. | |
| bool | addCustomDevice (InputDevice *device) | 
| virtual DeviceRegistry & | getDevices ()=0 | 
| virtual std::string | getName () const | 
| unsigned long int | getTimeRef () const | 
| Protected Member Functions | |
| virtual | ~tDeviceTranslator () | 
| Protected Attributes | |
| std::list< DeviceBase * > | m_custom_devices | 
| Friends | |
| class | SDLTranslator | 
| Class unallocation should only be handled by the SDLTranslator. | |
Definition at line 90 of file SDLTranslator.h.
| cmil::SDL::tDeviceTranslator< DeviceBase >::tDeviceTranslator | ( | System *const | sys | ) |  [inline] | 
| virtual cmil::SDL::tDeviceTranslator< DeviceBase >::~tDeviceTranslator | ( | ) |  [inline, protected, virtual] | 
Definition at line 134 of file SDLTranslator.h.
00134 { 00135 for(typename std::list<DeviceBase*>::iterator i = m_custom_devices.begin(); i != m_custom_devices.end() ; ++i) { 00136 if(*i) { (*i)->cleanup(); delete (*i); } 00137 } 00138 }
| bool cmil::SDL::tDeviceTranslator< DeviceBase >::addCustomDevice | ( | InputDevice * | device | ) |  [inline, virtual] | 
Implements cmil::SDL::DeviceTranslator.
Definition at line 96 of file SDLTranslator.h.
00096 { 00097 DeviceBase* tmp_derived_ptr; 00098 00099 if(!(tmp_derived_ptr= dynamic_cast<DeviceBase*>(device))) { 00100 log_error("addCustomDevice() not adding custom device due to cast check failure."); 00101 device->cleanup(); 00102 delete device; 00103 } 00104 else { 00105 for(typename std::list<DeviceBase*>::iterator i = m_custom_devices.begin(); 00106 i != m_custom_devices.end() ; ++i) 00107 if(*(*i) == *tmp_derived_ptr) { 00108 log_error("addCustomDevice() tried to add pre-existing controller type"); 00109 return false; 00110 } 00111 00112 log_debug(std::string("addCustomDevice() adding device type with name: ").append(device->getName())); 00113 m_custom_devices.push_back( tmp_derived_ptr); 00114 return true; 00115 } 00116 00117 return false; 00118 }
| virtual DeviceRegistry& cmil::SDL::tDeviceTranslator< DeviceBase >::getDevices | ( | ) |  [pure virtual] | 
This retrieves a registry of devices provided by this translator, for instance, if there were only 1 joystick attached, it should return a registry containing just that joystick.
Implements cmil::SDL::DeviceTranslator.
Implemented in cmil::SDL::SDLKeyboards, cmil::SDL::SDLMice, and cmil::SDL::SDLControllers.
| virtual std::string cmil::SDL::tDeviceTranslator< DeviceBase >::getName | ( | ) | const  [inline, virtual] | 
Implements cmil::SDL::DeviceTranslator.
Reimplemented in cmil::SDL::SDLKeyboards, cmil::SDL::SDLMice, and cmil::SDL::SDLControllers.
Definition at line 122 of file SDLTranslator.h.
| unsigned long int cmil::SDL::tDeviceTranslator< DeviceBase >::getTimeRef | ( | ) | const  [inline, virtual] | 
| virtual bool cmil::SDL::tDeviceTranslator< DeviceBase >::translate | ( | const SDL_Event & | input_event | ) |  [pure virtual] | 
This should return a boolean as to whether or not translation was successful.
Implements cmil::SDL::DeviceTranslator.
Implemented in cmil::SDL::SDLKeyboards, cmil::SDL::SDLMice, and cmil::SDL::SDLControllers.
| friend class SDLTranslator  [friend] | 
Class unallocation should only be handled by the SDLTranslator.
Definition at line 132 of file SDLTranslator.h.
| std::list<DeviceBase*> cmil::SDL::tDeviceTranslator< DeviceBase >::m_custom_devices  [protected] | 
Definition at line 140 of file SDLTranslator.h.
Referenced by cmil::SDL::tDeviceTranslator< cmil::Mouse >::addCustomDevice(), cmil::SDL::SDLControllers::getDevices(), cmil::SDL::SDLMice::getDevices(), cmil::SDL::SDLKeyboards::getDevices(), and cmil::SDL::tDeviceTranslator< cmil::Mouse >::~tDeviceTranslator().
 1.4.7
 1.4.7