Changeset 7216 in orxonox.OLD for branches/std/src/lib/lang/class_list.h
- Timestamp:
- Mar 12, 2006, 8:54:30 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/lib/lang/class_list.h
r7165 r7216 10 10 #include "class_id.h" 11 11 #include <list> 12 #include <string> 12 13 #ifndef NULL 13 14 #define NULL 0 //!< NULL … … 32 33 class ClassList { 33 34 public: 34 ClassList(ClassID classID, unsigned long classIDFull, const char*className);35 ClassList(ClassID classID, unsigned long classIDFull, const std::string& className); 35 36 virtual ~ClassList(); 36 37 37 38 /* MAINTENANCE FUNCTIONS THESE ARE !!ONLY FOR BASEOBJECT !! */ 38 static ClassList* addToClassList(BaseObject* objectPointer, ClassID classID, unsigned long classIDFull, const char*className);39 static ClassList* addToClassList(BaseObject* objectPointer, ClassID classID, unsigned long classIDFull, const std::string& className); 39 40 static void removeFromClassList(BaseObject* objectPointer); 40 41 … … 42 43 43 44 static const std::list<BaseObject*>* getList(ClassID classID = CL_NULL);// { return (ClassList* fl = ClassList::getClassList(classID) != NULL)? &(fl->objectList) : NULL; }; 44 static const std::list<BaseObject*>* getList(const char*className); // { return (ClassList* fl = ClassList::getClassList(className) != NULL)? &(fl->objectList) : NULL; };45 static const std::list< const char*>* getClassNames();46 static BaseObject* getObject(const char*name, ClassID classID = CL_NULL);45 static const std::list<BaseObject*>* getList(const std::string& className); // { return (ClassList* fl = ClassList::getClassList(className) != NULL)? &(fl->objectList) : NULL; }; 46 static const std::list<std::string>* getClassNames(); 47 static BaseObject* getObject(const std::string& name, ClassID classID = CL_NULL); 47 48 static bool exists(const BaseObject* object, ClassID classID = CL_NULL); 48 49 … … 51 52 static void whatIs(const BaseObject* object); 52 53 53 static const char*IDToString(ClassID classID = CL_NULL);54 static ClassID StringToID(const char*className);54 static const std::string& IDToString(ClassID classID = CL_NULL); 55 static ClassID StringToID(const std::string& className); 55 56 static void debug(unsigned int debugLevel = 0, ClassID classID = CL_NULL); 56 static void debugS(const char* className = NULL, unsigned int debugLevel = 0);57 static void debugS(const std::string& className = "", unsigned int debugLevel = 0); 57 58 58 59 inline bool operator==(ClassID classID) { return (this->classID == classID); }; 59 bool operator==(const char*className);60 bool operator==(const std::string& className); 60 61 inline ClassID getLeafClassID() const { return this->classID; }; 61 62 62 63 private: 63 64 static ClassList* getClassList(ClassID classID); 64 static ClassList* getClassList(const char*className);65 static ClassList* getClassList(const std::string& className); 65 66 66 67 private: 67 ClassID classID; //!< ClassID stored in this ClassList68 unsigned long classIDFull; //!< The Full ClassID of this Class.68 ClassID classID; //!< ClassID stored in this ClassList 69 unsigned long classIDFull; //!< The Full ClassID of this Class. 69 70 70 const char*className; //!< Name of the Class Stored here71 const std::string className; //!< Name of the Class Stored here 71 72 72 std::list<BaseObject*> objectList; //!< A list of Objects belonging to this Class73 std::list<BaseObject*> objectList; //!< A list of Objects belonging to this Class 73 74 74 75 // STATIC MEMBERS 75 static std::list<ClassList>* classList; //!< The first Class in the List76 static std::list< const char*>classNames; //!< a List of all Names of all classes, that have registered so far.76 static std::list<ClassList>* classList; //!< The first Class in the List 77 static std::list<std::string> classNames; //!< a List of all Names of all classes, that have registered so far. 77 78 }; 78 79
Note: See TracChangeset
for help on using the changeset viewer.