Panda3D
Public Member Functions | List of all members
PhysicsObjectCollection Class Reference

This is a set of zero or more PhysicsObjects. More...

#include "physicsObjectCollection.h"

Public Member Functions

 PhysicsObjectCollection (const PhysicsObjectCollection &copy)
 
void add_physics_object (PT(PhysicsObject) physics_object)
 Adds a new PhysicsObject to the collection. More...
 
void add_physics_objects_from (const PhysicsObjectCollection &other)
 Adds all the PhysicsObjects indicated in the other collection to this collection. More...
 
void clear ()
 Removes all PhysicsObjects from the collection. More...
 
int get_num_physics_objects () const
 Returns the number of PhysicsObjects in the collection. More...
 
bool has_physics_object (PT(PhysicsObject) physics_object) const
 Returns true if the indicated PhysicsObject appears in this collection, false otherwise. More...
 
bool is_empty () const
 Returns true if there are no PhysicsObjects in the collection, false otherwise. More...
 
 MAKE_SEQ (get_physics_objects, get_num_physics_objects, get_physics_object)
 
PhysicsObjectCollection operator+ (const PhysicsObjectCollection &other) const
 Returns a PhysicsObjectCollection representing the concatenation of the two lists. More...
 
void operator+= (const PhysicsObjectCollection &other)
 Appends the other list onto the end of this one. More...
 
void operator= (const PhysicsObjectCollection &copy)
 
void output (ostream &out) const
 
 PT (PhysicsObject) get_physics_object(int index) const
 
 PT (PhysicsObject) operator[](int index) const
 
void remove_duplicate_physics_objects ()
 Removes any duplicate entries of the same PhysicsObjects on this collection. More...
 
bool remove_physics_object (PT(PhysicsObject) physics_object)
 Removes the indicated PhysicsObject from the collection. More...
 
void remove_physics_objects_from (const PhysicsObjectCollection &other)
 Removes from this collection all of the PhysicsObjects listed in the other collection. More...
 
int size () const
 
void write (ostream &out, int indent_level=0) const
 

Detailed Description

This is a set of zero or more PhysicsObjects.

It's handy for returning from functions that need to return multiple PhysicsObjects.

Definition at line 28 of file physicsObjectCollection.h.

Member Function Documentation

◆ add_physics_object()

void PhysicsObjectCollection::add_physics_object ( PT(PhysicsObject physics_object)

Adds a new PhysicsObject to the collection.

Definition at line 55 of file physicsObjectCollection.cxx.

References remove_physics_object().

Referenced by Physical::~Physical().

◆ add_physics_objects_from()

void PhysicsObjectCollection::add_physics_objects_from ( const PhysicsObjectCollection other)

Adds all the PhysicsObjects indicated in the other collection to this collection.

The other physics_objects are simply appended to the end of the physics_objects in this list; duplicates are not automatically removed.

Definition at line 116 of file physicsObjectCollection.cxx.

References get_num_physics_objects(), and remove_physics_objects_from().

Referenced by operator+=(), and remove_physics_object().

◆ clear()

void PhysicsObjectCollection::clear ( )

Removes all PhysicsObjects from the collection.

Definition at line 194 of file physicsObjectCollection.cxx.

References is_empty().

Referenced by has_physics_object().

◆ get_num_physics_objects()

int PhysicsObjectCollection::get_num_physics_objects ( ) const

Returns the number of PhysicsObjects in the collection.

Definition at line 215 of file physicsObjectCollection.cxx.

Referenced by add_physics_objects_from(), and is_empty().

◆ has_physics_object()

bool PhysicsObjectCollection::has_physics_object ( PT(PhysicsObject physics_object) const

Returns true if the indicated PhysicsObject appears in this collection, false otherwise.

Definition at line 179 of file physicsObjectCollection.cxx.

References clear().

Referenced by remove_duplicate_physics_objects(), and remove_physics_objects_from().

◆ is_empty()

bool PhysicsObjectCollection::is_empty ( ) const

Returns true if there are no PhysicsObjects in the collection, false otherwise.

Definition at line 205 of file physicsObjectCollection.cxx.

References get_num_physics_objects().

Referenced by clear().

◆ operator+()

PhysicsObjectCollection PhysicsObjectCollection::operator+ ( const PhysicsObjectCollection other) const
inline

Returns a PhysicsObjectCollection representing the concatenation of the two lists.

Definition at line 42 of file physicsObjectCollection.I.

Referenced by operator+=().

◆ operator+=()

void PhysicsObjectCollection::operator+= ( const PhysicsObjectCollection other)
inline

Appends the other list onto the end of this one.

Definition at line 31 of file physicsObjectCollection.I.

References add_physics_objects_from(), and operator+().

◆ remove_duplicate_physics_objects()

void PhysicsObjectCollection::remove_duplicate_physics_objects ( )

Removes any duplicate entries of the same PhysicsObjects on this collection.

If a PhysicsObject appears multiple times, the first appearance is retained; subsequent appearances are removed.

Definition at line 152 of file physicsObjectCollection.cxx.

References has_physics_object().

Referenced by remove_physics_objects_from().

◆ remove_physics_object()

bool PhysicsObjectCollection::remove_physics_object ( PT(PhysicsObject physics_object)

Removes the indicated PhysicsObject from the collection.

Returns true if the physics_object was removed, false if it was not a member of the collection.

Definition at line 78 of file physicsObjectCollection.cxx.

References add_physics_objects_from().

Referenced by add_physics_object().

◆ remove_physics_objects_from()

void PhysicsObjectCollection::remove_physics_objects_from ( const PhysicsObjectCollection other)

Removes from this collection all of the PhysicsObjects listed in the other collection.

Definition at line 131 of file physicsObjectCollection.cxx.

References has_physics_object(), and remove_duplicate_physics_objects().

Referenced by add_physics_objects_from().


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