#include <InputDevice.h>
Inheritance diagram for cmil::InputDevice:
Public Member Functions | |
~InputDevice () | |
virtual InputDevice * | clone () const |
void | cleanup () |
void | dumpInputs () const |
This is helpful for debugging purposes. | |
std::string | getName () const |
Get the name of the device. | |
InputData *const | getData (const std::string &name) const |
InputData *const | getData (bool base_data, const std::string &name) const |
virtual bool | operator== (const InputDevice &dev) const |
const DeviceInputs & | getInputs () const |
bool | setInputs (const InputDevice &dev) |
This will rename inputs based on the parameter InputDevice. | |
Protected Member Functions | |
InputDevice () | |
This constructs a cloned device using the passed inputs. | |
InputDevice (const std::string &name, const DeviceInputs &cloned_inputs) | |
This constructs a cloned device using the passed inputs. | |
InputDevice (const std::string &name) | |
Restrict this to subclass/friend use. | |
unsigned long int | resetIDs (const unsigned long int count) |
void | resetWhichDevice (const unsigned long int which_device) |
void | add (InputData *const input) |
void | removeInput (const std::string &name) |
This is used by custom devices. | |
bool | setInput (const std::string &old_name, const std::string &new_name) |
Protected Attributes | |
DeviceInputs | m_inputs |
This keeps track of which inputs have been changed. | |
Private Attributes | |
std::string | m_name |
Friends | |
class | DeviceRegistry |
Definition at line 127 of file InputDevice.h.
cmil::InputDevice::~InputDevice | ( | ) | [inline] |
cmil::InputDevice::InputDevice | ( | ) | [protected] |
This constructs a cloned device using the passed inputs.
Definition at line 391 of file InputDevice.cpp.
Referenced by clone().
Here is the caller graph for this function:
cmil::InputDevice::InputDevice | ( | const std::string & | name, | |
const DeviceInputs & | cloned_inputs | |||
) | [protected] |
This constructs a cloned device using the passed inputs.
Definition at line 393 of file InputDevice.cpp.
cmil::InputDevice::InputDevice | ( | const std::string & | name | ) | [protected] |
Restrict this to subclass/friend use.
Definition at line 396 of file InputDevice.cpp.
00396 : m_name(name) {};
void cmil::InputDevice::add | ( | InputData *const | input | ) | [protected] |
Definition at line 407 of file InputDevice.cpp.
References cmil::DeviceInputs::add(), m_inputs, and m_name.
Referenced by cmil::Keyboard::init_inputs().
Here is the call graph for this function:
Here is the caller graph for this function:
void cmil::InputDevice::cleanup | ( | ) |
Definition at line 424 of file InputDevice.cpp.
References cmil::DeviceInputs::cleanup(), Logger::log_debug(), m_inputs, and m_name.
Referenced by cmil::SDL::SDLMice::getDevices(), and cmil::SDL::SDLKeyboards::getDevices().
00424 { 00425 log_debug(std::string("cleanup() of device named: ").append(m_name)); 00426 m_inputs.cleanup(); 00427 };
Here is the call graph for this function:
Here is the caller graph for this function:
InputDevice * cmil::InputDevice::clone | ( | ) | const [virtual] |
Devices must provide this function in order to achieve certain custom properties on on construction, this function is accessed by translators.
Reimplemented in cmil::GameController, cmil::Keyboard, and cmil::Mouse.
Definition at line 429 of file InputDevice.cpp.
References InputDevice(), m_inputs, and m_name.
00429 { 00430 return new InputDevice(m_name, m_inputs); 00431 };
Here is the call graph for this function:
void cmil::InputDevice::dumpInputs | ( | ) | const [inline] |
This is helpful for debugging purposes.
Definition at line 139 of file InputDevice.h.
References cmil::DeviceInputs::dumpInputs(), and m_inputs.
00139 { 00140 m_inputs.dumpInputs(); 00141 }
Here is the call graph for this function:
InputData *const cmil::InputDevice::getData | ( | bool | base_data, | |
const std::string & | name | |||
) | const |
Definition at line 442 of file InputDevice.cpp.
References cmil::DeviceInputs::getData(), and m_inputs.
00442 { 00443 return m_inputs.getData(base_data, name); 00444 };
Here is the call graph for this function:
InputData *const cmil::InputDevice::getData | ( | const std::string & | name | ) | const |
Definition at line 433 of file InputDevice.cpp.
References cmil::DeviceInputs::use_base.
Referenced by cmil::SDL::SDLMice::assign_inputs(), and cmil::SDL::SDLKeyboards::assign_inputs().
00433 { 00435 return getData(DeviceInputs::use_base, name); 00436 };
Here is the caller graph for this function:
const DeviceInputs & cmil::InputDevice::getInputs | ( | ) | const |
Definition at line 438 of file InputDevice.cpp.
References m_inputs.
Referenced by cmil::DeviceRegistry::copyDevice(), cmil::SDL::DefaultMouse::operator==(), cmil::Mouse::operator==(), cmil::Keyboard::operator==(), cmil::GameController::operator==(), and setInputs().
00438 { 00439 return m_inputs; 00440 };
Here is the caller graph for this function:
std::string cmil::InputDevice::getName | ( | ) | const [inline, virtual] |
Get the name of the device.
Implements Logger.
Reimplemented in cmil::Keyboard.
Definition at line 145 of file InputDevice.h.
References m_name.
Referenced by cmil::Mouse::clone(), cmil::GameController::clone(), cmil::DeviceRegistry::copyDevice(), cmil::GameController::operator==(), and cmil::DeviceRegistry::registerDevice().
00145 { 00146 return m_name; 00147 };
Here is the caller graph for this function:
bool cmil::InputDevice::operator== | ( | const InputDevice & | dev | ) | const [virtual] |
This matches based on base input identifiers and their type. Use judiciously, as comparison of with custom_inputs may not be desired when comparing a custom device type to a base.
Definition at line 446 of file InputDevice.cpp.
References Logger::log_debug(), m_inputs, and m_name.
00446 { 00447 log_debug("(base) operator== comparing input data"); 00448 return ((m_name == dev.m_name) && (m_inputs == dev.m_inputs)); 00449 };
Here is the call graph for this function:
void cmil::InputDevice::removeInput | ( | const std::string & | name | ) | [protected] |
This is used by custom devices.
Definition at line 411 of file InputDevice.cpp.
References m_inputs, and cmil::DeviceInputs::removeInput().
Referenced by cmil::SDL::DefaultKeyboard::DefaultKeyboard().
00411 { 00412 m_inputs.removeInput(name); 00413 };
Here is the call graph for this function:
Here is the caller graph for this function:
unsigned long int cmil::InputDevice::resetIDs | ( | const unsigned long int | count | ) | [protected] |
Definition at line 398 of file InputDevice.cpp.
References Logger::log_debug(), m_inputs, and cmil::DeviceInputs::resetIDs().
Referenced by cmil::DeviceRegistry::copyDevice().
00398 { 00399 log_debug("deferring resetIDs to m_inputs"); 00400 return m_inputs.resetIDs(count); 00401 };
Here is the call graph for this function:
Here is the caller graph for this function:
void cmil::InputDevice::resetWhichDevice | ( | const unsigned long int | which_device | ) | [protected] |
Definition at line 403 of file InputDevice.cpp.
References m_inputs, and cmil::DeviceInputs::resetWhichDevice().
Referenced by cmil::DeviceRegistry::copyDevice().
00403 { 00404 m_inputs.resetWhichDevice(which_device); 00405 };
Here is the call graph for this function:
Here is the caller graph for this function:
bool cmil::InputDevice::setInput | ( | const std::string & | old_name, | |
const std::string & | new_name | |||
) | [protected] |
Definition at line 415 of file InputDevice.cpp.
References m_inputs, and cmil::DeviceInputs::setInput().
Referenced by cmil::SDL::DefaultMouse::init(), and WidgetMouse::WidgetMouse().
00415 { 00416 return m_inputs.setInput(old_name, new_name); 00417 };
Here is the call graph for this function:
Here is the caller graph for this function:
bool cmil::InputDevice::setInputs | ( | const InputDevice & | dev | ) |
This will rename inputs based on the parameter InputDevice.
Definition at line 420 of file InputDevice.cpp.
References getInputs(), m_inputs, and cmil::DeviceInputs::setInputs().
Referenced by cmil::Mouse::clone(), cmil::Keyboard::clone(), and cmil::GameController::clone().
00420 { 00421 return m_inputs.setInputs(dev.getInputs()); 00422 };
Here is the call graph for this function:
Here is the caller graph for this function:
friend class DeviceRegistry [friend] |
Definition at line 166 of file InputDevice.h.
DeviceInputs cmil::InputDevice::m_inputs [protected] |
This keeps track of which inputs have been changed.
Definition at line 188 of file InputDevice.h.
Referenced by add(), cleanup(), clone(), dumpInputs(), cmil::GameController::GameController(), getData(), getInputs(), cmil::Mouse::init_inputs(), cmil::SDL::DefaultMouse::operator==(), cmil::Mouse::operator==(), cmil::Keyboard::operator==(), cmil::GameController::operator==(), operator==(), removeInput(), resetIDs(), resetWhichDevice(), setInput(), and setInputs().
std::string cmil::InputDevice::m_name [private] |
Definition at line 191 of file InputDevice.h.
Referenced by add(), cleanup(), clone(), getName(), and operator==().