00001 /* 00002 Autor: $Author: kunkel $ State: $State: Exp $ 00003 Datum: $Date: 2005/05/30 12:35:25 $ 00004 Version: $Revision: 1.1 $ 00005 */ 00006 00011 #ifndef OBJECTMANAGER_H 00012 #define OBJECTMANAGER_H 00013 00014 #include <string> 00015 #include <list> 00016 00017 #include "Object.h" 00018 #include "Vector.h" 00019 #include "config.h" 00020 00021 using namespace std; 00022 typedef list<Object*> objectList; 00023 00027 class ObjectManager { 00028 private: 00032 objectList objects; 00033 00038 class OldPosition { 00039 public: 00043 Vector pos; 00047 float radius; 00051 bool isFirstInThisStep; 00052 00053 OldPosition(const Vector pos_, const double radius_, bool isFirstInThisStep_ =false ) { 00054 pos=pos_; 00055 radius=radius_; 00056 isFirstInThisStep=isFirstInThisStep_; 00057 } 00058 }; 00062 list<OldPosition> oldPositions; 00066 int oldPositionTimeSteps; 00067 00068 00069 public: 00070 00071 //Typverwaltung: 00072 static int TypeToInt(const string & objType); 00073 static char * NumToType(const int typenum); 00074 static int getTypeCount(); 00075 00076 ObjectManager(); 00077 ~ObjectManager(); 00078 00082 objectList* getObjectList() { 00083 return & objects; 00084 } 00085 00086 00087 void deleteAllObjects(); 00088 00092 int getObjectCount() { 00093 return objects.size(); 00094 } 00095 00096 Object * getFarthestAwayObject(); 00097 void viewDetailInformationForAllObjects(); 00098 Object * createObject(const string & objectType); 00099 Object * createFreeObject(const string & objectType); 00100 void createRandomObject(string type, int mMass,int mPos, int mR, int mV); 00101 void addFreeObjectToObjectList(Object * obj); 00102 00103 void deleteObject(objectList::iterator & it); 00104 void deleteObject(Object * obj); 00105 void load(istream & FILE); 00106 void save(ostream & FILE); 00107 00108 void drawObjects(); 00109 00110 void nextTimeStep(); 00111 00112 }; 00113 00114 extern ObjectManager ourObjectManager; 00115 00116 #endif