Panda3D
Public Member Functions

PhysicsObjectCollection Class Reference

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

#include "physicsObjectCollection.h"

List of all members.

Public Member Functions

 PhysicsObjectCollection (const PhysicsObjectCollection &copy)
void add_physics_object (PT(PhysicsObject) physics_object)
 Adds a new PhysicsObject to the collection.
void add_physics_objects_from (const PhysicsObjectCollection &other)
 Adds all the PhysicsObjects indicated in the other collection to this collection.
void clear ()
 Removes all PhysicsObjects from the collection.
int get_num_physics_objects () const
 Returns the number of PhysicsObjects in the collection.
bool has_physics_object (PT(PhysicsObject) physics_object) const
 Returns true if the indicated PhysicsObject appears in this collection, false otherwise.
bool is_empty () const
 Returns true if there are no PhysicsObjects in the collection, false otherwise.
 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.
void operator+= (const PhysicsObjectCollection &other)
 Appends the other list onto the end of this one.
void operator= (const PhysicsObjectCollection &copy)
void output (ostream &out) const
 Writes a brief one-line description of the PhysicsObjectCollection to the indicated output stream.
 PT (PhysicsObject) operator[](int index) const
 PT (PhysicsObject) get_physics_object(int index) const
void remove_duplicate_physics_objects ()
 Removes any duplicate entries of the same PhysicsObjects on this collection.
bool remove_physics_object (PT(PhysicsObject) physics_object)
 Removes the indicated PhysicsObject from the collection.
void remove_physics_objects_from (const PhysicsObjectCollection &other)
 Removes from this collection all of the PhysicsObjects listed in the other collection.
int size () const
 Returns the number of physics objects in the collection.
void write (ostream &out, int indent_level=0) const
 Writes a complete multi-line description of the PhysicsObjectCollection to the indicated output stream.

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

void PhysicsObjectCollection::add_physics_object ( PT(PhysicsObject physics_object)

Adds a new PhysicsObject to the collection.

Definition at line 55 of file physicsObjectCollection.cxx.

Referenced by 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 add_physics_object(), and get_num_physics_objects().

Referenced by operator+=().

void PhysicsObjectCollection::clear ( )

Removes all PhysicsObjects from the collection.

Definition at line 194 of file physicsObjectCollection.cxx.

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(), has_physics_object(), output(), remove_duplicate_physics_objects(), remove_physics_objects_from(), and write().

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

Referenced by remove_physics_objects_from().

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.

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.

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

void PhysicsObjectCollection::output ( ostream &  out) const

Writes a brief one-line description of the PhysicsObjectCollection to the indicated output stream.

Definition at line 264 of file physicsObjectCollection.cxx.

References get_num_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 get_num_physics_objects().

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.

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 get_num_physics_objects(), and has_physics_object().

int PhysicsObjectCollection::size ( ) const

Returns the number of physics objects in the collection.

This is the same thing as get_num_physics_objects().

Definition at line 253 of file physicsObjectCollection.cxx.

void PhysicsObjectCollection::write ( ostream &  out,
int  indent_level = 0 
) const

Writes a complete multi-line description of the PhysicsObjectCollection to the indicated output stream.

Definition at line 279 of file physicsObjectCollection.cxx.

References get_num_physics_objects().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations