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...
 
InputDeviceoperator [] (size_t index) const
 Returns the nth InputDevice in the collection. More...
 
void operator= (const InputDeviceSet &copy)
 
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 45 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 62 of file inputDeviceSet.cxx.

References size().

◆ clear()

void InputDeviceSet::clear ( )

Removes all InputDevices from the collection.

Definition at line 100 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 91 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 25 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 118 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 54 of file inputDeviceSet.cxx.

Referenced by InputDeviceManager::remove_device().

◆ remove_devices_from()

void InputDeviceSet::remove_devices_from ( const InputDeviceSet other)

◆ 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 109 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 34 of file inputDeviceSet.I.

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

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 131 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: