Manages a list of InputDevice objects, as returned by various InputDeviceManager methods. More...
#include "inputDeviceSet.h"
Public Member Functions | |
InputDeviceSet (const InputDeviceSet ©) | |
void | add_device (InputDevice *device) |
Adds a new InputDevice to the collection. More... | |
void | add_devices_from (const InputDeviceSet &other) |
Adds all the InputDevices indicated in the other collection to this set. More... | |
void | clear () |
Removes all InputDevices from the collection. More... | |
bool | has_device (InputDevice *device) const |
Returns true if the indicated InputDevice appears in this collection, false otherwise. More... | |
InputDevice * | operator [] (size_t index) const |
Returns the nth InputDevice in the collection. More... | |
void | operator= (const InputDeviceSet ©) |
void | output (std::ostream &out) const |
Writes a brief one-line description of the InputDeviceSet to the indicated output stream. More... | |
bool | remove_device (InputDevice *device) |
Removes the indicated InputDevice from the collection. More... | |
void | remove_devices_from (const InputDeviceSet &other) |
Removes from this collection all of the devices listed in the other set. More... | |
void | reserve (size_t num) |
This is a hint to Panda to allocate enough memory to hold the given number of InputDevices, if you know ahead of time how many you will be adding. More... | |
size_t | size () const |
Returns the number of devices in the collection. More... | |
void | write (std::ostream &out, int indent_level=0) const |
Writes a complete multi-line description of the InputDeviceSet to the indicated output stream. More... | |
Manages a list of InputDevice objects, as returned by various InputDeviceManager methods.
This is implemented like a set, meaning the same device cannot occur more than once.
Definition at line 26 of file inputDeviceSet.h.
void InputDeviceSet::add_device | ( | InputDevice * | device | ) |
Adds a new InputDevice to the collection.
Definition at line 45 of file inputDeviceSet.cxx.
Referenced by InputDeviceManager::add_device().
void InputDeviceSet::add_devices_from | ( | const InputDeviceSet & | other | ) |
Adds all the InputDevices indicated in the other collection to this set.
Definition at line 62 of file inputDeviceSet.cxx.
References size().
void InputDeviceSet::clear | ( | ) |
Removes all InputDevices from the collection.
Definition at line 100 of file inputDeviceSet.cxx.
References ordered_vector< Key, Compare, Vector >::clear().
bool InputDeviceSet::has_device | ( | InputDevice * | device | ) | const |
Returns true if the indicated InputDevice appears in this collection, false otherwise.
Definition at line 91 of file inputDeviceSet.cxx.
References ordered_vector< Key, Compare, Vector >::end().
Referenced by remove_devices_from().
|
inline |
Returns the nth InputDevice in the collection.
Definition at line 25 of file inputDeviceSet.I.
void InputDeviceSet::output | ( | std::ostream & | out | ) | const |
Writes a brief one-line description of the InputDeviceSet to the indicated output stream.
Definition at line 118 of file inputDeviceSet.cxx.
References ordered_vector< Key, Compare, Vector >::size().
Referenced by write().
bool InputDeviceSet::remove_device | ( | InputDevice * | device | ) |
Removes the indicated InputDevice from the collection.
Definition at line 54 of file inputDeviceSet.cxx.
Referenced by InputDeviceManager::remove_device().
void InputDeviceSet::remove_devices_from | ( | const InputDeviceSet & | other | ) |
Removes from this collection all of the devices listed in the other set.
Definition at line 74 of file inputDeviceSet.cxx.
References ordered_vector< Key, Compare, Vector >::begin(), ordered_vector< Key, Compare, Vector >::end(), has_device(), ordered_vector< Key, Compare, Vector >::push_back(), ov_set< Key, Compare, Vector >::sort(), and ordered_vector< Key, Compare, Vector >::swap().
void InputDeviceSet::reserve | ( | size_t | num | ) |
This is a hint to Panda to allocate enough memory to hold the given number of InputDevices, if you know ahead of time how many you will be adding.
Definition at line 109 of file inputDeviceSet.cxx.
References ordered_vector< Key, Compare, Vector >::reserve().
|
inline |
Returns the number of devices in the collection.
Definition at line 34 of file inputDeviceSet.I.
References ordered_vector< Key, Compare, Vector >::size().
Referenced by add_devices_from().
void InputDeviceSet::write | ( | std::ostream & | out, |
int | indent_level = 0 |
||
) | const |
Writes a complete multi-line description of the InputDeviceSet to the indicated output stream.
Definition at line 131 of file inputDeviceSet.cxx.
References ordered_vector< Key, Compare, Vector >::begin(), ordered_vector< Key, Compare, Vector >::end(), indent(), and output().