Orxonox: OIS::InputManager Class Reference

# OIS::InputManager Class Reference

`#include <src/ois/OISInputManager.h>`

Inheritance diagram for OIS::InputManager:

List of all members.

## Public Types

enum | AddOnFactories { AddOn_All = 0, AddOn_LIRC = 1, AddOn_WiiMote = 2 }
| All generic devices OIS supports internally (if they are compiled in). More...

## Public Member Functions

void | addFactoryCreator (FactoryCreator *factory)
Object * | createInputObject (Type iType, bool bufferMode, const std::string &vendor="")
void | destroyInputObject (Object *obj)
void | enableAddOnFactory (AddOnFactories factory)
int | getNumberOfDevices (Type iType)
const std::string & | getVersionName ()
const std::string & | inputSystemName ()
DeviceList | listFreeDevices ()
void | removeFactoryCreator (FactoryCreator *factory)

## Static Public Member Functions

static InputManager * | createInputSystem (ParamList &paramList)
static InputManager * | createInputSystem (std::size_t winHandle)
static void | destroyInputSystem (InputManager *manager)
static unsigned int | getVersionNumber ()

## Protected Member Functions

virtual void | _initialize (ParamList &paramList)=0
| InputManager (const std::string &name)
virtual | ~InputManager ()

## Protected Attributes

LIRCFactoryCreator * | m_lircSupport
| Extra factory (not enabled by default).
const std::string | m_VersionName
| OIS Version name.
WiiMoteFactoryCreator * | m_wiiMoteSupport
FactoryList | mFactories
| FactoryCreator list.
FactoryCreatedObject | mFactoryObjects
| Factory created objects - useful so we can find creator to send destruction request to.
const std::string | mInputSystemName
| Name of the input system.

## Detailed Description

Base Manager class. No longer a Singleton; so feel free to create as many InputManager's as you have windows.

## Member Enumeration Documentation

enum OIS::InputManager::AddOnFactories

All generic devices OIS supports internally (if they are compiled in).

Enumerator:

  AddOn_All |
  AddOn_LIRC |
  AddOn_WiiMote |

## Constructor & Destructor Documentation

InputManager::InputManager | ( | const std::string & | name | ) | `[protected]`

Remarks:
  Derived classes must provide input system name

InputManager::~InputManager | ( |  | ) | `[protected, virtual]`

Remarks:
  Virtual Destructor - this base class will clean up all devices still opened in mFactoryObjects list

References m_lircSupport, and m_wiiMoteSupport.

## Member Function Documentation

virtual void OIS::InputManager::_initialize | ( | ParamList & | paramList | ) | `[protected, pure virtual]`

Remarks:
  Called from createInputSystem, gives derived input class a chance to setup after it is created

Implemented in OIS::LinuxInputManager, OIS::MacInputManager, and OIS::Win32InputManager.

Referenced by createInputSystem().

void InputManager::addFactoryCreator | ( | FactoryCreator * | factory | ) |

Remarks:
  Add a custom object factory to allow for user controls.

Parameters:

  | factory | Factory instance to add Make sure you do not delete the factory before devices created from the factory are destroyed (either by calling RemoveFactoryCreator, or shutting down the input system). Order should be something like the following: Create Input System Create Factory Instance AddFactoryCreator(factory) Create a device from the InputManager (device created by factory) One of the follwoing: removeFactoryCreator(factory) inputManager->destroyInputObject(obj) destroyInputSystem(inputManager) destroy Factory Instance You can safely delete the factory instance once you have removed it or shut down the input manager.

References mFactories.

Referenced by enableAddOnFactory().

Object * InputManager::createInputObject | ( | Type | iType,
|  | bool | bufferMode,
|  | const std::string & | vendor = `""` |
| ) |  |  |

Remarks:
  Tries to create an object with the specified vendor. If you have no preference of vendor, leave vender as default (""). Raises exception on failure

References OIS::Object::_initialize(), destroyInputObject(), OIS::E_InputDeviceNonExistant, mFactories, mFactoryObjects, and OIS_EXCEPT.

Referenced by orxonox::InputManager::_initialiseJoySticks(), orxonox::InputManager::_initialiseKeyboard(), and orxonox::InputManager::_initialiseMouse().

InputManager * InputManager::createInputSystem | ( | ParamList & | paramList | ) | `[static]`

Remarks:
  Creates appropriate input system dependent on platform.

Parameters:

  | paramList | ParamList contains OS specific info (such as HWND and HINSTANCE for window apps), and access mode.

Returns:
  A pointer to the created manager, or raises Exception

References _initialize(), OIS::E_General, and OIS_EXCEPT.

InputManager * InputManager::createInputSystem | ( | std::size_t | winHandle | ) | `[static]`

Remarks:
  Creates appropriate input system dependent on platform.

Parameters:

  | winHandle | Contains OS specific window handle (such as HWND or X11 Window)

Returns:
  A pointer to the created manager, or raises Exception

Referenced by orxonox::InputManager::initialise().

void InputManager::destroyInputObject | ( | Object * | obj | ) |

Remarks:
  Destroys Input Object

References OIS::E_General, mFactoryObjects, and OIS_EXCEPT.

Referenced by orxonox::InputManager::_destroyJoySticks(), orxonox::InputManager::_destroyKeyboard(), orxonox::InputManager::_destroyMouse(), and createInputObject().

void InputManager::destroyInputSystem | ( | InputManager * | manager | ) | `[static]`

Remarks:
  Destroys the InputManager

Parameters:

  | manager | Manager to destroy

References mFactoryObjects.

Referenced by orxonox::InputManager::_reload(), orxonox::InputManager::initialise(), and orxonox::InputManager::~InputManager().

void InputManager::enableAddOnFactory | ( | AddOnFactories | factory | ) |

Remarks:
  Enable an addon FactoryCreator extension. By default, none are activated. If the desired support was not compiled in, this has no effect. Calling multiple times has no effect. Once activated, there is no way to deactivate - simply destroy and recreate input manager.

References addFactoryCreator(), AddOn_All, AddOn_LIRC, AddOn_WiiMote, m_lircSupport, and m_wiiMoteSupport.

int InputManager::getNumberOfDevices | ( | Type | iType | ) |

Remarks:
  Returns the number of the specified OIS::Type devices discovered by OIS

Parameters:

  | iType | Type that you are interested in

References mFactories.

Referenced by orxonox::InputManager::_initialiseJoySticks(), orxonox::InputManager::_initialiseKeyboard(), and orxonox::InputManager::_initialiseMouse().

const std::string & InputManager::getVersionName | ( |  | ) |

Remarks:
  Returns version string (useful in DLL/SO libs)

Returns:
  Version name

References m_VersionName.

unsigned int InputManager::getVersionNumber | ( |  | ) | `[static]`

Remarks:
  Returns version number (useful in DLL/SO libs)

Returns:
  Bits: 1-8 Patch number, 9-16 Minor version, 17-32 Major version

References OIS_VERSION.

const std::string & InputManager::inputSystemName | ( |  | ) |

Remarks:
  Gets the name of the current platform input system

References mInputSystemName.

DeviceList InputManager::listFreeDevices | ( |  | ) |

Remarks:
  Lists all unused devices

Returns:
  DeviceList which contains Type and vendor of device

References mFactories.

void InputManager::removeFactoryCreator | ( | FactoryCreator * | factory | ) |

Remarks:
  Remove a previously added object factory

Parameters:

  | factory | Factory object to remove. Removing a factory will automatically destroy any Objects created from the factory

References mFactories, and mFactoryObjects.

## Member Data Documentation

LIRCFactoryCreator* OIS::InputManager::m_lircSupport`[protected]`

Extra factory (not enabled by default).

Referenced by enableAddOnFactory(), and ~InputManager().

const std::string OIS::InputManager::m_VersionName`[protected]`

OIS Version name.

Referenced by getVersionName().

WiiMoteFactoryCreator* OIS::InputManager::m_wiiMoteSupport`[protected]`

Referenced by enableAddOnFactory(), and ~InputManager().

FactoryList OIS::InputManager::mFactories`[protected]`

FactoryCreator list.

Referenced by addFactoryCreator(), createInputObject(), getNumberOfDevices(), OIS::LinuxInputManager::LinuxInputManager(), listFreeDevices(), OIS::MacInputManager::MacInputManager(), removeFactoryCreator(), and OIS::Win32InputManager::Win32InputManager().

FactoryCreatedObject OIS::InputManager::mFactoryObjects`[protected]`

Factory created objects - useful so we can find creator to send destruction request to.

Referenced by createInputObject(), destroyInputObject(), destroyInputSystem(), and removeFactoryCreator().

const std::string OIS::InputManager::mInputSystemName`[protected]`

Name of the input system.

Referenced by OIS::Win32InputManager::freeDeviceList(), OIS::MacInputManager::freeDeviceList(), OIS::LinuxInputManager::freeDeviceList(), inputSystemName(), OIS::Win32InputManager::vendorExist(), OIS::MacInputManager::vendorExist(), and OIS::LinuxInputManager::vendorExist().

The documentation for this class was generated from the following files:

- src/ois/OISInputManager.h
- src/ois/OISInputManager.cpp