Changeset 9661 in orxonox.OLD for trunk/src/lib/lang/new_class_list.h
- Timestamp:
- Aug 20, 2006, 12:21:18 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/lang/new_class_list.h
r9660 r9661 13 13 14 14 #define DeclareClass(ClassName) \ 15 New ClassList ClassID_##ClassName(ClassName)15 NewObjectList ClassID_##ClassName(ClassName) 16 16 17 17 #define DeclareInClass(ClassName) \ 18 New ClassList classList(ClassName)18 NewObjectList classList(ClassName) 19 19 20 class New ClassListBase20 class NewObjectListBase 21 21 { 22 22 public: … … 26 26 static int classCount() { return _idCounter; }; 27 27 28 bool compareName(const NewObjectListBase& more) { return this->_name < more.name(); }; 29 bool compareID(const NewObjectListBase& more) { return this->_id < more.id(); }; 30 28 31 protected: 29 NewClassListBase(const std::string& className); 32 NewObjectListBase(const std::string& className); 33 ~NewObjectListBase(); 30 34 private: 31 New ClassListBase(const NewClassListBase&);35 NewObjectListBase(const NewObjectListBase&); 32 36 37 static bool exists(const std::string& className); 33 38 34 39 private: … … 37 42 38 43 private: 44 typedef std::set<NewObjectListBase*> cList; 45 39 46 static int _idCounter; //!< A counter, that gives all classes a Unique ClassID. Access to this Variable is to be Thread-Safe. 40 static std::set<NewClassListBase>_classes; //!< A Set of all the classes in existance.47 static cList* _classes; //!< A Set of all the classes in existance. 41 48 }; 42 49 43 template<class T> class NewClassList : public NewClassListBase 50 51 ///////////////////////// 52 //// TEMPLATISATION ///// 53 ///////////////////////// 54 template<class T> class NewObjectList : public NewObjectListBase 44 55 { 45 56 public: 46 New ClassList(const std::string& name);47 ~New ClassList();57 NewObjectList(const std::string& name); 58 ~NewObjectList(); 48 59 49 60 private: 50 61 //! the copy constructor will be hidden. 51 New ClassList(const NewClassList& definer) {};62 NewObjectList(const NewObjectList& definer) {}; 52 63 }; 53 64 54 65 template <class T> 55 New ClassList<T>::NewClassList(const std::string& name)56 : New ClassListBase(name)66 NewObjectList<T>::NewObjectList(const std::string& name) 67 : NewObjectListBase(name) 57 68 {} 58 69 59 70 template <class T> 60 New ClassList<T>::~NewClassList()71 NewObjectList<T>::~NewObjectList() 61 72 {} 62 73
Note: See TracChangeset
for help on using the changeset viewer.