physicsObjectCollection.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Filename: physicsObjectCollection.h
  2. // Created by: joswilso (12Jul06)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef PHYSICSOBJECTCOLLECTION_H
  19. #define PHYSICSOBJECTCOLLECTION_H
  20. #include "pandabase.h"
  21. #include "physicsObject.h"
  22. #include "pointerToArray.h"
  23. ////////////////////////////////////////////////////////////////////
  24. // Class : PhysicsObjectCollection
  25. // Description : This is a set of zero or more PhysicsObjects. It's handy
  26. // for returning from functions that need to return
  27. // multiple PhysicsObjects.
  28. ////////////////////////////////////////////////////////////////////
  29. class EXPCL_PANDAPHYSICS PhysicsObjectCollection {
  30. PUBLISHED:
  31. PhysicsObjectCollection();
  32. PhysicsObjectCollection(const PhysicsObjectCollection &copy);
  33. void operator = (const PhysicsObjectCollection &copy);
  34. INLINE ~PhysicsObjectCollection();
  35. void add_physics_object(PT(PhysicsObject) physics_object);
  36. bool remove_physics_object(PT(PhysicsObject) physics_object);
  37. void add_physics_objects_from(const PhysicsObjectCollection &other);
  38. void remove_physics_objects_from(const PhysicsObjectCollection &other);
  39. void remove_duplicate_physics_objects();
  40. bool has_physics_object(PT(PhysicsObject) physics_object) const;
  41. void clear();
  42. bool is_empty() const;
  43. int get_num_physics_objects() const;
  44. PT(PhysicsObject) get_physics_object(int index) const;
  45. PT(PhysicsObject) operator [] (int index) const;
  46. void output(ostream &out) const;
  47. void write(ostream &out, int indent_level = 0) const;
  48. private:
  49. typedef PTA(PT(PhysicsObject)) PhysicsObjects;
  50. PhysicsObjects _physics_objects;
  51. };
  52. /*
  53. INLINE ostream &operator << (ostream &out, const PhysicsObjectCollection &col) {
  54. col.output(out);
  55. return out;
  56. }
  57. */
  58. #include "physicsObjectCollection.I"
  59. #endif