This is a set of zero or more PhysicsObjects. More...
#include "physicsObjectCollection.h"
Public Member Functions | |
PhysicsObjectCollection (const PhysicsObjectCollection ©) | |
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 |
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... | |
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 ©) |
void | output (std::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 (std::ostream &out, int indent_level=0) const |
Public Attributes | |
get_num_physics_objects | |
Returns the number of PhysicsObjects in the collection. More... | |
get_physics_object | |
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 25 of file physicsObjectCollection.h.
void PhysicsObjectCollection::add_physics_object | ( | PT(PhysicsObject) | physics_object | ) |
Adds a new PhysicsObject to the collection.
Definition at line 46 of file physicsObjectCollection.cxx.
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 99 of file physicsObjectCollection.cxx.
References get_num_physics_objects.
Referenced by operator+=().
void PhysicsObjectCollection::clear | ( | ) |
Removes all PhysicsObjects from the collection.
Definition at line 168 of file physicsObjectCollection.cxx.
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 155 of file physicsObjectCollection.cxx.
bool PhysicsObjectCollection::is_empty | ( | ) | const |
Returns true if there are no PhysicsObjects in the collection, false otherwise.
Definition at line 177 of file physicsObjectCollection.cxx.
|
inline |
Returns a PhysicsObjectCollection representing the concatenation of the two lists.
Definition at line 34 of file physicsObjectCollection.I.
|
inline |
Appends the other list onto the end of this one.
Definition at line 25 of file physicsObjectCollection.I.
References add_physics_objects_from().
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 130 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 66 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 112 of file physicsObjectCollection.cxx.
References get_num_physics_objects.
int PhysicsObjectCollection::get_num_physics_objects |
Returns the number of PhysicsObjects in the collection.
Definition at line 43 of file physicsObjectCollection.h.
Referenced by add_physics_objects_from(), remove_duplicate_physics_objects(), and remove_physics_objects_from().