#include <input_device_server.h>
Definition at line 47 of file input_device_server.h.
Public Member Functions | |
| IInputDevice * | getDevice (uint index) |
| uint | getNumDevices () const |
| bool | isDevice (IInputDevice *device) const |
| Test wether the given device is handled by this server. | |
| void | poll (CEventServer *server) |
| Retrieve datas from the devices, and submit them to the given CEventServer. | |
| void | registerDevice (IInputDevice *device) |
| register a device into this device server. | |
| void | removeDevice (IInputDevice *device) |
| remove a device from this server (but does not delete it). | |
| void | submitEvent (IInputDeviceEvent *deviceEvent) |
| Allow an input device to register an event. The event will then be deleted by this server. | |
| virtual | ~CInputDeviceServer () |
Private Types | |
| typedef std::vector< IInputDevice * > | TDeviceCont |
| typedef std::vector< IInputDeviceEvent * > | TEventCont |
Private Attributes | |
| TDeviceCont | _Devices |
| TEventCont | _Events |
|
|
Definition at line 67 of file input_device_server.h. |
|
|
Definition at line 68 of file input_device_server.h. |
|
|
Definition at line 65 of file input_device_server.h.
00065 {}
|
|
|
Definition at line 57 of file input_device_server.h. References _Devices, index, and uint.
|
|
|
Definition at line 55 of file input_device_server.h. References _Devices, and uint.
00055 { return _Devices.size(); }
|
|
|
Test wether the given device is handled by this server.
Definition at line 50 of file input_device_server.cpp. References _Devices. Referenced by registerDevice().
|
|
|
Retrieve datas from the devices, and submit them to the given CEventServer.
Definition at line 67 of file input_device_server.cpp. References _Devices, nlassert, and NLMISC::IInputDevice::transitionOccured().
00068 {
00069 nlassert(_Events.empty());
00070 TDeviceCont::iterator deviceIt;
00071 for (deviceIt = _Devices.begin(); deviceIt != _Devices.end(); ++deviceIt)
00072 {
00073 (*deviceIt)->begin(server);
00074 (*deviceIt)->poll(this);
00075 }
00076 // Sort the messages to get the right dates.
00077 std::sort(_Events.begin(), _Events.end(), CInputDeviceEventLess());
00078 // submit the result to the server
00079 IInputDevice *lastVisitedDevice = NULL;
00080 TEventCont::iterator eventIt;
00081 for (eventIt = _Events.begin(); eventIt != _Events.end(); ++eventIt)
00082 {
00083 // see if this message is from a previous device then the last we visited.
00084 if (lastVisitedDevice && (*eventIt)->Emitter != lastVisitedDevice)
00085 {
00086 // yes, tells that a transition occured
00087 lastVisitedDevice->transitionOccured(server, *eventIt);
00088 lastVisitedDevice = (*eventIt)->Emitter;
00089 }
00090 nlassert((*eventIt)->Emitter != NULL);
00091 (*eventIt)->Emitter->submit(*eventIt, server);
00092 }
00093 //
00094 for (deviceIt = _Devices.begin(); deviceIt != _Devices.end(); ++deviceIt)
00095 {
00096 (*deviceIt)->transitionOccured(server, NULL);
00097 }
00098 // delete the messages
00099 for (eventIt = _Events.begin(); eventIt != _Events.end(); ++eventIt)
00100 {
00101 delete *eventIt;
00102 }
00103 //
00104 _Events.clear();
00105 }
|
|
|
register a device into this device server.
Definition at line 35 of file input_device_server.cpp. References _Devices, isDevice(), and nlassert.
|
|
|
remove a device from this server (but does not delete it).
Definition at line 42 of file input_device_server.cpp. References _Devices, and nlassert.
|
|
|
Allow an input device to register an event. The event will then be deleted by this server.
Definition at line 108 of file input_device_server.cpp.
00109 {
00110 _Events.push_back(deviceEvent);
00111 }
|
|
|
Definition at line 70 of file input_device_server.h. Referenced by getDevice(), getNumDevices(), isDevice(), poll(), registerDevice(), and removeDevice(). |
|
|
Definition at line 71 of file input_device_server.h. |
1.3.6