PhysicsObjectCollection

class PhysicsObjectCollection

This is a set of zero or more PhysicsObjects. It’s handy for returning from functions that need to return multiple PhysicsObjects.

Inheritance diagram

Inheritance diagram of PhysicsObjectCollection

PhysicsObjectCollection(void)
PhysicsObjectCollection(PhysicsObjectCollection const &copy)
void add_physics_object(PointerTo<PhysicsObject> physics_object)

Adds a new PhysicsObject to the collection.

void add_physics_objects_from(PhysicsObjectCollection const &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.

void clear(void)

Removes all PhysicsObjects from the collection.

int get_num_physics_objects(void) const

Returns the number of PhysicsObjects in the collection.

PointerTo<PhysicsObject> get_physics_object(int index) const

Returns the nth PhysicsObject in the collection.

bool has_physics_object(PointerTo<PhysicsObject> physics_object) const

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

bool is_empty(void) const

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

void output(std::ostream &out) const

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

void remove_duplicate_physics_objects(void)

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.

bool remove_physics_object(PointerTo<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.

void remove_physics_objects_from(PhysicsObjectCollection const &other)

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

int size(void) const

Returns the number of physics objects in the collection. This is the same thing as get_num_physics_objects().

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

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