Panda3D

Public Member Functions | List of all members
InputDeviceSet Class Reference

Manages a list of InputDevice objects, as returned by various InputDeviceManager methods. More...

`#include "inputDeviceSet.h"`

## Public Member Functions
| InputDeviceSet (const InputDeviceSet &copy)
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...
void | operator= (const InputDeviceSet &copy)
InputDevice * | operator[] (size_t index) const
| Returns the nth InputDevice in the collection. More...
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...

## Detailed Description

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.

## Member Function Documentation

## ◆ add_device()

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().

## ◆ add_devices_from()

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 size().

## ◆ clear()

void InputDeviceSet::clear | ( |  | ) |

Removes all InputDevices from the collection.

Definition at line 99 of file inputDeviceSet.cxx.

References ordered_vector< Key, Compare, Vector >::clear().

## ◆ has_device()

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().

## ◆ operator[]()

InputDevice * InputDeviceSet::operator[] | ( | size_t | index | ) | const
| inline

Returns the nth InputDevice in the collection.

Definition at line 24 of file inputDeviceSet.I.

## ◆ output()

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().

## ◆ remove_device()

bool InputDeviceSet::remove_device | ( | InputDevice * | device | ) |

Removes the indicated InputDevice from the collection.

Returns
  true if the device was removed, false if it was not a member.

Definition at line 53 of file inputDeviceSet.cxx.

## ◆ remove_devices_from()

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().

## ◆ reserve()

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().

## ◆ size()

size_t InputDeviceSet::size | ( |  | ) | const
| inline

Returns the number of devices in the collection.

Definition at line 33 of file inputDeviceSet.I.

Referenced by add_devices_from().

## ◆ write()

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().

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

- panda/src/device/inputDeviceSet.h
- panda/src/device/inputDeviceSet.cxx
- panda/src/device/inputDeviceSet.I