Panda3D
Loading...
Searching...
No Matches
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.
 
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 &copy)
 
InputDeviceoperator[] (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.
 

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.

Constructor & Destructor Documentation

◆ InputDeviceSet() [1/2]

InputDeviceSet::InputDeviceSet ( )

Definition at line 20 of file inputDeviceSet.cxx.

◆ InputDeviceSet() [2/2]

InputDeviceSet::InputDeviceSet ( const InputDeviceSet & copy)

Definition at line 27 of file inputDeviceSet.cxx.

◆ ~InputDeviceSet()

InputDeviceSet::~InputDeviceSet ( )
inline

Definition at line 17 of file inputDeviceSet.I.

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(), InputDeviceManager::get_devices(), and InputDeviceManager::get_devices().

◆ 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 ordered_vector< Key, Compare, Vector >::push_back(), size(), and ov_set< Key, Compare, Vector >::sort().

◆ 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=()

void InputDeviceSet::operator= ( const InputDeviceSet & copy)

Definition at line 36 of file inputDeviceSet.cxx.

◆ operator[]()

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

Returns the nth InputDevice in the collection.

Definition at line 24 of file inputDeviceSet.I.

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

◆ 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.

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

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

Referenced by add_devices_from(), InputDeviceManager::get_devices(), and InputDeviceManager::get_devices().

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