Last change
on this file since 9672 was
9672,
checked in by bensch, 18 years ago
|
orxonox/trunk: ClassList objectively implemented. This is not the fastest, but the most modular approach.
Now is the question of redundancy in code writing:
Should the ClassWriter explicitely declare a Class with superclasses, or should on runtime each object decide for itself, as it is done in BaseObject at the moment… questions questions questions…
|
File size:
879 bytes
|
Rev | Line | |
---|
[4838] | 1 | /*! |
---|
[9659] | 2 | * @file new_class_id.h |
---|
| 3 | * @brief Definition of a dynamically allocating ClassID |
---|
| 4 | * |
---|
| 5 | */ |
---|
[1853] | 6 | |
---|
[9659] | 7 | #ifndef _NEW_CLASS_ID_H |
---|
| 8 | #define _NEW_CLASS_ID_H |
---|
[1853] | 9 | |
---|
[9659] | 10 | #include "type_info.h" |
---|
| 11 | #include <string> |
---|
[9666] | 12 | #include <list> |
---|
[9663] | 13 | #include "new_object_list.h" |
---|
| 14 | |
---|
[9665] | 15 | |
---|
| 16 | |
---|
| 17 | |
---|
[9659] | 18 | //! A class to dynamically allocate ClassID's and support a isA operator |
---|
| 19 | class NewClassID |
---|
| 20 | { |
---|
| 21 | public: |
---|
| 22 | NewClassID(); |
---|
| 23 | ~NewClassID(); |
---|
[3245] | 24 | |
---|
[9664] | 25 | template<class T> void registerObject(T* object, NewObjectList<T>& list); |
---|
[9663] | 26 | |
---|
[9659] | 27 | private: |
---|
[9672] | 28 | std::list<NewObjectListBase::ClassEntry> _classes; |
---|
[1853] | 29 | }; |
---|
| 30 | |
---|
[9659] | 31 | |
---|
[9671] | 32 | template<class T> |
---|
| 33 | inline void NewClassID::registerObject(T* object, NewObjectList<T>& objectList) |
---|
[9664] | 34 | { |
---|
[9672] | 35 | this->_classes.push_back(NewObjectListBase::ClassEntry(&objectList, objectList.registerObject(object))); |
---|
| 36 | |
---|
| 37 | /* this->_objectList = &objectList; |
---|
| 38 | _iterators.push_back(objectList.registerObject(object, this->_objectList));*/ |
---|
[9664] | 39 | } |
---|
| 40 | |
---|
[9659] | 41 | #endif /* _NEW_CLASS_ID_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.