Panda3D
|
00001 // Filename: physicsObjectCollection.h 00002 // Created by: joswilso (12Jul06) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef PHYSICSOBJECTCOLLECTION_H 00016 #define PHYSICSOBJECTCOLLECTION_H 00017 00018 #include "pandabase.h" 00019 #include "physicsObject.h" 00020 #include "pointerToArray.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : PhysicsObjectCollection 00024 // Description : This is a set of zero or more PhysicsObjects. It's handy 00025 // for returning from functions that need to return 00026 // multiple PhysicsObjects. 00027 //////////////////////////////////////////////////////////////////// 00028 class EXPCL_PANDAPHYSICS PhysicsObjectCollection { 00029 PUBLISHED: 00030 PhysicsObjectCollection(); 00031 PhysicsObjectCollection(const PhysicsObjectCollection ©); 00032 void operator = (const PhysicsObjectCollection ©); 00033 INLINE ~PhysicsObjectCollection(); 00034 00035 void add_physics_object(PT(PhysicsObject) physics_object); 00036 bool remove_physics_object(PT(PhysicsObject) physics_object); 00037 void add_physics_objects_from(const PhysicsObjectCollection &other); 00038 void remove_physics_objects_from(const PhysicsObjectCollection &other); 00039 void remove_duplicate_physics_objects(); 00040 bool has_physics_object(PT(PhysicsObject) physics_object) const; 00041 void clear(); 00042 00043 bool is_empty() const; 00044 int get_num_physics_objects() const; 00045 PT(PhysicsObject) get_physics_object(int index) const; 00046 MAKE_SEQ(get_physics_objects, get_num_physics_objects, get_physics_object); 00047 PT(PhysicsObject) operator [] (int index) const; 00048 int size() const; 00049 INLINE void operator += (const PhysicsObjectCollection &other); 00050 INLINE PhysicsObjectCollection operator + (const PhysicsObjectCollection &other) const; 00051 00052 void output(ostream &out) const; 00053 void write(ostream &out, int indent_level = 0) const; 00054 00055 private: 00056 typedef PTA(PT(PhysicsObject)) PhysicsObjects; 00057 PhysicsObjects _physics_objects; 00058 }; 00059 00060 /* 00061 INLINE ostream &operator << (ostream &out, const PhysicsObjectCollection &col) { 00062 col.output(out); 00063 return out; 00064 } 00065 */ 00066 #include "physicsObjectCollection.I" 00067 00068 #endif 00069 00070