#include <SDLTranslator.h>
Inheritance diagram for cmil::SDL::SDLTranslator:
Public Types | |
typedef std::list< DeviceTranslator * > | DeviceTranslators |
Public Member Functions | |
SDLTranslator (System *const sys) | |
virtual bool | addTranslated (DeviceTranslator *sdl_device) |
DeviceRegistry & | getDevices () |
This provides a temporary device registry which containes the devices which the SDL translator can provide. | |
virtual void | poll () |
virtual void | translate (const SDL_Event &input_event) |
virtual | ~SDLTranslator () |
std::string | getName () const |
Private Attributes | |
DeviceRegistry | m_devices |
This registry contains the devices provided by this translator. | |
DeviceTranslators | m_sdltranslators |
This contains a list of sdl devices. | |
SDL_Event | m_event |
Definition at line 290 of file SDLTranslator.h.
typedef std::list<DeviceTranslator*> cmil::SDL::SDLTranslator::DeviceTranslators |
Definition at line 295 of file SDLTranslator.h.
cmil::SDL::SDLTranslator::SDLTranslator | ( | System *const | sys | ) | [inline] |
virtual cmil::SDL::SDLTranslator::~SDLTranslator | ( | ) | [inline, virtual] |
Definition at line 306 of file SDLTranslator.h.
References Logger::log_debug(), and m_sdltranslators.
00306 { 00307 log_debug("dtor"); 00308 for(DeviceTranslators::iterator i = m_sdltranslators.begin(); i != m_sdltranslators.end() ; ++i) 00309 if(*i) { 00310 log_debug("dtor : deleting device translator"); 00311 delete (*i); 00312 } 00313 }
Here is the call graph for this function:
bool cmil::SDL::SDLTranslator::addTranslated | ( | DeviceTranslator * | sdl_device | ) | [virtual] |
Definition at line 684 of file SDLTranslator.cpp.
References cmil::SDL::DeviceTranslator::getDevices(), Logger::log_error(), m_devices, m_sdltranslators, and cmil::DeviceRegistry::mergeRegistry().
Referenced by cmil::SDL::SDLSystem::init().
00684 { 00685 for(DeviceTranslators::iterator i= m_sdltranslators.begin(); i != m_sdltranslators.end() ; i++) 00686 if(*(*i) == *sdl_device) { 00687 log_error("addTranslated() Prevented due to name conflict with pre-existing device translator."); 00688 delete sdl_device; 00689 return false; 00690 } 00691 00692 m_sdltranslators.push_back(sdl_device); 00693 00695 m_devices.mergeRegistry(sdl_device->getDevices()); 00696 return true; 00697 }
Here is the call graph for this function:
Here is the caller graph for this function:
DeviceRegistry & cmil::SDL::SDLTranslator::getDevices | ( | ) | [virtual] |
This provides a temporary device registry which containes the devices which the SDL translator can provide.
Implements cmil::InputTranslator.
Definition at line 716 of file SDLTranslator.cpp.
References m_devices.
Referenced by cmil::SDL::SDLSystem::init().
00716 { 00717 return m_devices; 00718 };
Here is the caller graph for this function:
std::string cmil::SDL::SDLTranslator::getName | ( | ) | const [inline, virtual] |
void cmil::SDL::SDLTranslator::poll | ( | ) | [virtual] |
Implements cmil::InputTranslator.
Definition at line 710 of file SDLTranslator.cpp.
References m_event, and translate().
Referenced by cmil::SDL::SDLSystem::poll().
Here is the call graph for this function:
Here is the caller graph for this function:
void cmil::SDL::SDLTranslator::translate | ( | const SDL_Event & | input_event | ) | [virtual] |
Definition at line 699 of file SDLTranslator.cpp.
References m_sdltranslators, and cmil::SystemClient::quit().
Referenced by poll().
00699 { 00700 if(input_event.type == SDL_QUIT) 00701 quit(); 00702 else { 00704 for(DeviceTranslators::iterator i = m_sdltranslators.begin(); i != m_sdltranslators.end() ; i++) 00705 if((*i)->translate(input_event)) 00706 continue; 00707 } 00708 };
Here is the call graph for this function:
Here is the caller graph for this function:
This registry contains the devices provided by this translator.
Definition at line 321 of file SDLTranslator.h.
Referenced by addTranslated(), and getDevices().
SDL_Event cmil::SDL::SDLTranslator::m_event [private] |
This contains a list of sdl devices.
Definition at line 324 of file SDLTranslator.h.
Referenced by addTranslated(), translate(), and ~SDLTranslator().