Last change
on this file since 9671 was
9671,
checked in by bensch, 18 years ago
|
trunk: just realized, that polimorphism again is the evil part of classes.
Classes, that derive say from PNode and Element2D force that Element2D is registered after PNode, which means, that Element2D is interpretet as being derived from PNode in my implmentational idea…
hmm… now go for some new approach, this cannot and will not be the end of this…
|
File size:
871 bytes
|
Line | |
---|
1 | /*! |
---|
2 | * @file new_class_id.h |
---|
3 | * @brief Definition of a dynamically allocating ClassID |
---|
4 | * |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef _NEW_CLASS_ID_H |
---|
8 | #define _NEW_CLASS_ID_H |
---|
9 | |
---|
10 | #include "type_info.h" |
---|
11 | #include <string> |
---|
12 | #include <list> |
---|
13 | #include "new_object_list.h" |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | //! A class to dynamically allocate ClassID's and support a isA operator |
---|
19 | class NewClassID |
---|
20 | { |
---|
21 | public: |
---|
22 | NewClassID(); |
---|
23 | ~NewClassID(); |
---|
24 | |
---|
25 | template<class T> void registerObject(T* object, NewObjectList<T>& list); |
---|
26 | |
---|
27 | private: |
---|
28 | NewObjectListBase* _objectList; |
---|
29 | std::list<NewObjectListBase::IteratorBase*> _iterators; //!< Iterators to the class-list's positions. |
---|
30 | }; |
---|
31 | |
---|
32 | |
---|
33 | template<class T> |
---|
34 | inline void NewClassID::registerObject(T* object, NewObjectList<T>& objectList) |
---|
35 | { |
---|
36 | this->_objectList = &objectList; |
---|
37 | _iterators.push_back(objectList.registerObject(object, this->_objectList)); |
---|
38 | } |
---|
39 | |
---|
40 | #endif /* _NEW_CLASS_ID_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.