Browse Source

initial checkin

Josh Wilson 19 years ago
parent
commit
f66c7f8ab9

+ 27 - 0
panda/src/physics/physicsObjectCollection.I

@@ -0,0 +1,27 @@
+// Filename: physicsObjectCollection.I
+// Created by:  joswilso (12Jul06)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://etc.cmu.edu/panda3d/docs/license/ .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::Destructor
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE PhysicsObjectCollection::
+~PhysicsObjectCollection() {
+}
+

+ 27 - 0
panda/src/physics/physicsObjectCollection.I~

@@ -0,0 +1,27 @@
+// Filename: physicsObjectCollection.I
+// Created by:  joswilso (12Jul06)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://etc.cmu.edu/panda3d/docs/license/ .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////
+//     Function: NodePathCollection::Destructor
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE PhysicsObjectCollection::
+~PhysicsObjectCollection() {
+}
+

+ 276 - 0
panda/src/physics/physicsObjectCollection.cxx

@@ -0,0 +1,276 @@
+// Filename: physicsObjectCollection.cxx
+// Created by:  joswilso (12Jul06)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://etc.cmu.edu/panda3d/docs/license/ .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#include "physicsObjectCollection.h"
+
+#include "indent.h"
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::Constructor
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+PhysicsObjectCollection::
+PhysicsObjectCollection() {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::Copy Constructor
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+PhysicsObjectCollection::
+PhysicsObjectCollection(const PhysicsObjectCollection &copy) :
+  _physics_objects(copy._physics_objects)
+{
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::Copy Assignment Operator
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+void PhysicsObjectCollection::
+operator = (const PhysicsObjectCollection &copy) {
+  _physics_objects = copy._physics_objects;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::add_physics_object
+//       Access: Published
+//  Description: Adds a new PhysicsObject to the collection.
+////////////////////////////////////////////////////////////////////
+void PhysicsObjectCollection::
+add_physics_object(PT(PhysicsObject) physics_object) {
+  // If the pointer to our internal array is shared by any other
+  // PhysicsObjectCollections, we have to copy the array now so we won't
+  // inadvertently modify any of our brethren PhysicsObjectCollection
+  // objects.
+
+  if (_physics_objects.get_ref_count() > 1) {
+    PhysicsObjects old_physics_objects = _physics_objects;
+    _physics_objects = PhysicsObjects::empty_array(0);
+    _physics_objects.v() = old_physics_objects.v();
+  }
+
+  _physics_objects.push_back(physics_object);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::remove_physics_object
+//       Access: Published
+//  Description: 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.
+////////////////////////////////////////////////////////////////////
+bool PhysicsObjectCollection::
+remove_physics_object(PT(PhysicsObject) physics_object) {
+  int object_index = -1;
+  for (int i = 0; object_index == -1 && i < (int)_physics_objects.size(); i++) {
+    if (_physics_objects[i] == physics_object) {
+      object_index = i;
+    }
+  }
+
+  if (object_index == -1) {
+    // The indicated physics_object was not a member of the collection.
+    return false;
+  }
+
+  // If the pointer to our internal array is shared by any other
+  // PhysicsObjectCollections, we have to copy the array now so we won't
+  // inadvertently modify any of our brethren PhysicsObjectCollection
+  // objects.
+
+  if (_physics_objects.get_ref_count() > 1) {
+    PhysicsObjects old_physics_objects = _physics_objects;
+    _physics_objects = PhysicsObjects::empty_array(0);
+    _physics_objects.v() = old_physics_objects.v();
+  }
+
+  _physics_objects.erase(_physics_objects.begin() + object_index);
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::add_physics_objects_from
+//       Access: Published
+//  Description: 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 PhysicsObjectCollection::
+add_physics_objects_from(const PhysicsObjectCollection &other) {
+  int other_num_physics_objects = other.get_num_physics_objects();
+  for (int i = 0; i < other_num_physics_objects; i++) {
+    add_physics_object(other.get_physics_object(i));
+  }
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::remove_physics_objects_from
+//       Access: Published
+//  Description: Removes from this collection all of the PhysicsObjects
+//               listed in the other collection.
+////////////////////////////////////////////////////////////////////
+void PhysicsObjectCollection::
+remove_physics_objects_from(const PhysicsObjectCollection &other) {
+  PhysicsObjects new_physics_objects;
+  int num_physics_objects = get_num_physics_objects();
+  for (int i = 0; i < num_physics_objects; i++) {
+    PT(PhysicsObject) physics_object = get_physics_object(i);
+    if (!other.has_physics_object(physics_object)) {
+      new_physics_objects.push_back(physics_object);
+    }
+  }
+  _physics_objects = new_physics_objects;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::remove_duplicate_physics_objects
+//       Access: Published
+//  Description: 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.
+////////////////////////////////////////////////////////////////////
+void PhysicsObjectCollection::
+remove_duplicate_physics_objects() {
+  PhysicsObjects new_physics_objects;
+
+  int num_physics_objects = get_num_physics_objects();
+  for (int i = 0; i < num_physics_objects; i++) {
+    PT(PhysicsObject) physics_object = get_physics_object(i);
+    bool duplicated = false;
+
+    for (int j = 0; j < i && !duplicated; j++) {
+      duplicated = (physics_object == get_physics_object(j));
+    }
+
+    if (!duplicated) {
+      new_physics_objects.push_back(physics_object);
+    }
+  }
+
+  _physics_objects = new_physics_objects;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::has_physics_object
+//       Access: Published
+//  Description: Returns true if the indicated PhysicsObject appears in
+//               this collection, false otherwise.
+////////////////////////////////////////////////////////////////////
+bool PhysicsObjectCollection::
+has_physics_object(PT(PhysicsObject) physics_object) const {
+  for (int i = 0; i < get_num_physics_objects(); i++) {
+    if (physics_object == get_physics_object(i)) {
+      return true;
+    }
+  }
+  return false;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::clear
+//       Access: Published
+//  Description: Removes all PhysicsObjects from the collection.
+////////////////////////////////////////////////////////////////////
+void PhysicsObjectCollection::
+clear() {
+  _physics_objects.clear();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::is_empty
+//       Access: Published
+//  Description: Returns true if there are no PhysicsObjects in the
+//               collection, false otherwise.
+////////////////////////////////////////////////////////////////////
+bool PhysicsObjectCollection::
+is_empty() const {
+  return _physics_objects.empty();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::get_num_physics_objects
+//       Access: Published
+//  Description: Returns the number of PhysicsObjects in the collection.
+////////////////////////////////////////////////////////////////////
+int PhysicsObjectCollection::
+get_num_physics_objects() const {
+  return _physics_objects.size();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::get_physics_object
+//       Access: Published
+//  Description: Returns the nth PhysicsObject in the collection.
+////////////////////////////////////////////////////////////////////
+PT(PhysicsObject) PhysicsObjectCollection::
+get_physics_object(int index) const {
+  nassertr(index >= 0 && index < (int)_physics_objects.size(), PT(PhysicsObject)());
+
+  return _physics_objects[index];
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::operator []
+//       Access: Published
+//  Description: Returns the nth PhysicsObject in the collection.  This is
+//               the same as get_physics_object(), but it may be a more
+//               convenient way to access it.
+////////////////////////////////////////////////////////////////////
+PT(PhysicsObject) PhysicsObjectCollection::
+operator [] (int index) const {
+  nassertr(index >= 0 && index < (int)_physics_objects.size(), PT(PhysicsObject)());
+
+  return _physics_objects[index];
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::output
+//       Access: Published
+//  Description: Writes a brief one-line description of the
+//               PhysicsObjectCollection to the indicated output stream.
+////////////////////////////////////////////////////////////////////
+void PhysicsObjectCollection::
+output(ostream &out) const {
+  if (get_num_physics_objects() == 1) {
+    out << "1 PhysicsObject";
+  } else {
+    out << get_num_physics_objects() << " PhysicsObjects";
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::write
+//       Access: Published
+//  Description: Writes a complete multi-line description of the
+//               PhysicsObjectCollection to the indicated output stream.
+////////////////////////////////////////////////////////////////////
+void PhysicsObjectCollection::
+write(ostream &out, int indent_level) const {
+  for (int i = 0; i < get_num_physics_objects(); i++) {
+    indent(out, indent_level) << get_physics_object(i) << "\n";
+  }
+}
+

+ 275 - 0
panda/src/physics/physicsObjectCollection.cxx~

@@ -0,0 +1,275 @@
+// Filename: physicsObjectCollection.cxx
+// Created by:  joswilso (12Jul06)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://etc.cmu.edu/panda3d/docs/license/ .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#include "physicsObjectCollection.h"
+
+#include "indent.h"
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::Constructor
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+PhysicsObjectCollection::
+PhysicsObjectCollection() {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::Copy Constructor
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+PhysicsObjectCollection::
+PhysicsObjectCollection(const PhysicsObjectCollection &copy) :
+  _physics_objects(copy._physics_objects)
+{
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::Copy Assignment Operator
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+void PhysicsObjectCollection::
+operator = (const PhysicsObjectCollection &copy) {
+  _physics_objects = copy._physics_objects;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::add_physics_object
+//       Access: Published
+//  Description: Adds a new PhysicsObject to the collection.
+////////////////////////////////////////////////////////////////////
+void PhysicsObjectCollection::
+add_physics_object(const PhysicsObject &physics_object) {
+  // If the pointer to our internal array is shared by any other
+  // PhysicsObjectCollections, we have to copy the array now so we won't
+  // inadvertently modify any of our brethren PhysicsObjectCollection
+  // objects.
+
+  if (_physics_objects.get_ref_count() > 1) {
+    PhysicsObjects old_physics_objects = _physics_objects;
+    _physics_objects = PhysicsObjects::empty_array(0);
+    _physics_objects.v() = old_physics_objects.v();
+  }
+
+  _physics_objects.push_back(physics_object);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::remove_physics_object
+//       Access: Published
+//  Description: 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.
+////////////////////////////////////////////////////////////////////
+bool PhysicsObjectCollection::
+remove_physics_object(const PhysicsObject &physics_object) {
+  int object_index = -1;
+  for (int i = 0; object_index == -1 && i < (int)_physics_objects.size(); i++) {
+    if (_physics_objects[i] == physics_object) {
+      object_index = i;
+    }
+  }
+
+  if (object_index == -1) {
+    // The indicated physics_object was not a member of the collection.
+    return false;
+  }
+
+  // If the pointer to our internal array is shared by any other
+  // PhysicsObjectCollections, we have to copy the array now so we won't
+  // inadvertently modify any of our brethren PhysicsObjectCollection
+  // objects.
+
+  if (_physics_objects.get_ref_count() > 1) {
+    PhysicsObjects old_physics_objects = _physics_objects;
+    _physics_objects = PhysicsObjects::empty_array(0);
+    _physics_objects.v() = old_physics_objects.v();
+  }
+
+  _physics_objects.erase(_physics_objects.begin() + object_index);
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::add_physics_objects_from
+//       Access: Published
+//  Description: 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 PhysicsObjectCollection::
+add_paths_from(const PhysicsObjectCollection &other) {
+  int other_num_paths = other.get_num_paths();
+  for (int i = 0; i < other_num_paths; i++) {
+    add_path(other.get_path(i));
+  }
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::remove_paths_from
+//       Access: Published
+//  Description: Removes from this collection all of the PhysicsObjects
+//               listed in the other collection.
+////////////////////////////////////////////////////////////////////
+void PhysicsObjectCollection::
+remove_paths_from(const PhysicsObjectCollection &other) {
+  PhysicsObjects new_paths;
+  int num_paths = get_num_paths();
+  for (int i = 0; i < num_paths; i++) {
+    PhysicsObject path = get_path(i);
+    if (!other.has_path(path)) {
+      new_paths.push_back(path);
+    }
+  }
+  _physics_objects = new_paths;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::remove_duplicate_paths
+//       Access: Published
+//  Description: 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.
+////////////////////////////////////////////////////////////////////
+void PhysicsObjectCollection::
+remove_duplicate_paths() {
+  PhysicsObjects new_paths;
+
+  int num_paths = get_num_paths();
+  for (int i = 0; i < num_paths; i++) {
+    PhysicsObject path = get_path(i);
+    bool duplicated = false;
+
+    for (int j = 0; j < i && !duplicated; j++) {
+      duplicated = (path == get_path(j));
+    }
+
+    if (!duplicated) {
+      new_paths.push_back(path);
+    }
+  }
+
+  _physics_objects = new_paths;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::has_path
+//       Access: Published
+//  Description: Returns true if the indicated PhysicsObject appears in
+//               this collection, false otherwise.
+////////////////////////////////////////////////////////////////////
+bool PhysicsObjectCollection::
+has_path(const PhysicsObject &path) const {
+  for (int i = 0; i < get_num_paths(); i++) {
+    if (path == get_path(i)) {
+      return true;
+    }
+  }
+  return false;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::clear
+//       Access: Published
+//  Description: Removes all PhysicsObjects from the collection.
+////////////////////////////////////////////////////////////////////
+void PhysicsObjectCollection::
+clear() {
+  _physics_objects.clear();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::is_empty
+//       Access: Published
+//  Description: Returns true if there are no PhysicsObjects in the
+//               collection, false otherwise.
+////////////////////////////////////////////////////////////////////
+bool PhysicsObjectCollection::
+is_empty() const {
+  return _physics_objects.empty();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::get_num_paths
+//       Access: Published
+//  Description: Returns the number of PhysicsObjects in the collection.
+////////////////////////////////////////////////////////////////////
+int PhysicsObjectCollection::
+get_num_paths() const {
+  return _physics_objects.size();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::get_path
+//       Access: Published
+//  Description: Returns the nth PhysicsObject in the collection.
+////////////////////////////////////////////////////////////////////
+PhysicsObject PhysicsObjectCollection::
+get_path(int index) const {
+  nassertr(index >= 0 && index < (int)_physics_objects.size(), PhysicsObject());
+
+  return _physics_objects[index];
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::operator []
+//       Access: Published
+//  Description: Returns the nth PhysicsObject in the collection.  This is
+//               the same as get_path(), but it may be a more
+//               convenient way to access it.
+////////////////////////////////////////////////////////////////////
+PhysicsObject PhysicsObjectCollection::
+operator [] (int index) const {
+  nassertr(index >= 0 && index < (int)_physics_objects.size(), PhysicsObject());
+
+  return _physics_objects[index];
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::output
+//       Access: Published
+//  Description: Writes a brief one-line description of the
+//               PhysicsObjectCollection to the indicated output stream.
+////////////////////////////////////////////////////////////////////
+void PhysicsObjectCollection::
+output(ostream &out) const {
+  if (get_num_paths() == 1) {
+    out << "1 PhysicsObject";
+  } else {
+    out << get_num_paths() << " PhysicsObjects";
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::write
+//       Access: Published
+//  Description: Writes a complete multi-line description of the
+//               PhysicsObjectCollection to the indicated output stream.
+////////////////////////////////////////////////////////////////////
+void PhysicsObjectCollection::
+write(ostream &out, int indent_level) const {
+  for (int i = 0; i < get_num_paths(); i++) {
+    indent(out, indent_level) << get_path(i) << "\n";
+  }
+}

+ 71 - 0
panda/src/physics/physicsObjectCollection.h

@@ -0,0 +1,71 @@
+// Filename: physicsObjectCollection.h
+// Created by:  joswilso (12Jul06)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://etc.cmu.edu/panda3d/docs/license/ .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#ifndef PHYSICSOBJECTCOLLECTION_H
+#define PHYSICSOBJECTCOLLECTION_H
+
+#include "pandabase.h"
+#include "physicsObject.h"
+#include "pointerToArray.h"
+
+////////////////////////////////////////////////////////////////////
+//       Class : PhysicsObjectCollection
+// Description : This is a set of zero or more PhysicsObjects.  It's handy
+//               for returning from functions that need to return
+//               multiple PhysicsObjects.
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDAPHYSICS PhysicsObjectCollection {
+PUBLISHED:
+  PhysicsObjectCollection();
+  PhysicsObjectCollection(const PhysicsObjectCollection &copy);
+  void operator = (const PhysicsObjectCollection &copy);
+  INLINE ~PhysicsObjectCollection();
+  
+  void add_physics_object(PT(PhysicsObject) physics_object);
+  bool remove_physics_object(PT(PhysicsObject) physics_object);
+  void add_physics_objects_from(const PhysicsObjectCollection &other);
+  void remove_physics_objects_from(const PhysicsObjectCollection &other);
+  void remove_duplicate_physics_objects();
+  bool has_physics_object(PT(PhysicsObject) physics_object) const;
+  void clear();
+
+  bool is_empty() const;
+  int get_num_physics_objects() const;
+  PT(PhysicsObject) get_physics_object(int index) const;
+  PT(PhysicsObject) operator [] (int index) const;
+
+
+  void output(ostream &out) const;
+  void write(ostream &out, int indent_level = 0) const;
+
+private:
+  typedef PTA(PT(PhysicsObject)) PhysicsObjects;
+  PhysicsObjects _physics_objects;
+};
+
+/*
+INLINE ostream &operator << (ostream &out, const PhysicsObjectCollection &col) {
+  col.output(out);
+  return out;
+}
+*/
+#include "physicsObjectCollection.I"
+
+#endif
+
+

+ 69 - 0
panda/src/physics/physicsObjectCollection.h~

@@ -0,0 +1,69 @@
+// Filename: physicsObjectCollection.h
+// Created by:  joswilso (12Jul06)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://etc.cmu.edu/panda3d/docs/license/ .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#ifndef PHYSICSOBJECTCOLLECTION_H
+#define PHYSICSOBJECTCOLLECTION_H
+
+#include "pandabase.h"
+#include "nodePath.h"
+#include "pointerToArray.h"
+
+////////////////////////////////////////////////////////////////////
+//       Class : PhysicsObjectCollection
+// Description : This is a set of zero or more PhysicsObjects.  It's handy
+//               for returning from functions that need to return
+//               multiple PhysicsObjects.
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDA PhysicsObjectCollection {
+PUBLISHED:
+  PhysicsObjectCollection();
+  PhysicsObjectCollection(const PhysicsObjectCollection &copy);
+  void operator = (const PhysicsObjectCollection &copy);
+  INLINE ~PhysicsObjectCollection();
+
+  void add_physics_object(const PhysicsObject &physics_object);
+  bool remove_physics_object(const PhysicsObject &physics_object);
+  void add_physics_objects_from(const PhysicsObjectCollection &other);
+  void remove_physics_objects_from(const PhysicsObjectCollection &other);
+  void remove_duplicate_physics_objects();
+  bool has_physics_object(const PhysicsObject &physics_object) const;
+  void clear();
+
+  bool is_empty() const;
+  int get_num_physics_objects() const;
+  PhysicsObject get_physics_object(int index) const;
+  PhysicsObject operator [] (int index) const;
+
+  void output(ostream &out) const;
+  void write(ostream &out, int indent_level = 0) const;
+
+private:
+  typedef PTA(PhysicsObject) PhysicsObjects;
+  PhysicsObjects _node_paths;
+};
+
+INLINE ostream &operator << (ostream &out, const PhysicsObjectCollection &col) {
+  col.output(out);
+  return out;
+}
+
+#include "physicsObjectCollection.I"
+
+#endif
+
+