Panda3D
|
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. | |
void | add_devices_from (const InputDeviceSet &other) |
Adds all the InputDevices indicated in the other collection to this set. | |
void | clear () |
Removes all InputDevices from the collection. | |
bool | has_device (InputDevice *device) const |
Returns true if the indicated InputDevice appears in this collection, false otherwise. | |
void | operator= (const InputDeviceSet ©) |
InputDevice * | operator[] (size_t index) const |
Returns the nth InputDevice in the collection. | |
void | output (std::ostream &out) const |
Writes a brief one-line description of the InputDeviceSet to the indicated output stream. | |
bool | remove_device (InputDevice *device) |
Removes the indicated InputDevice from the collection. | |
void | remove_devices_from (const InputDeviceSet &other) |
Removes from this collection all of the devices listed in the other set. | |
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. | |
size_t | size () const |
Returns the number of devices in the collection. | |
void | write (std::ostream &out, int indent_level=0) const |
Writes a complete multi-line description of the InputDeviceSet to the indicated output stream. | |
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.
InputDeviceSet::InputDeviceSet | ( | ) |
Definition at line 20 of file inputDeviceSet.cxx.
InputDeviceSet::InputDeviceSet | ( | const InputDeviceSet & | copy | ) |
Definition at line 27 of file inputDeviceSet.cxx.
|
inline |
Definition at line 17 of file inputDeviceSet.I.
void InputDeviceSet::add_device | ( | InputDevice * | device | ) |
Adds a new InputDevice to the collection.
Definition at line 44 of file inputDeviceSet.cxx.
Referenced by InputDeviceManager::add_device(), InputDeviceManager::get_devices(), and InputDeviceManager::get_devices().
void InputDeviceSet::add_devices_from | ( | const InputDeviceSet & | other | ) |
Adds all the InputDevices indicated in the other collection to this set.
Definition at line 61 of file inputDeviceSet.cxx.
References ordered_vector< Key, Compare, Vector >::push_back(), size(), and ov_set< Key, Compare, Vector >::sort().
void InputDeviceSet::clear | ( | ) |
Removes all InputDevices from the collection.
Definition at line 99 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 90 of file inputDeviceSet.cxx.
References ordered_vector< Key, Compare, Vector >::end().
Referenced by remove_devices_from().
void InputDeviceSet::operator= | ( | const InputDeviceSet & | copy | ) |
Definition at line 36 of file inputDeviceSet.cxx.
|
inline |
Returns the nth InputDevice in the collection.
Definition at line 24 of file inputDeviceSet.I.
References ordered_vector< Key, Compare, Vector >::size().
void InputDeviceSet::output | ( | std::ostream & | out | ) | const |
Writes a brief one-line description of the InputDeviceSet to the indicated output stream.
Definition at line 117 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 53 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 73 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 108 of file inputDeviceSet.cxx.
References ordered_vector< Key, Compare, Vector >::reserve().
|
inline |
Returns the number of devices in the collection.
Definition at line 33 of file inputDeviceSet.I.
References ordered_vector< Key, Compare, Vector >::size().
Referenced by add_devices_from(), InputDeviceManager::get_devices(), and InputDeviceManager::get_devices().
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 130 of file inputDeviceSet.cxx.
References ordered_vector< Key, Compare, Vector >::begin(), ordered_vector< Key, Compare, Vector >::end(), indent(), and output().