- Timestamp:
- Mar 29, 2013, 12:42:24 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core6/src/libraries/core/object/ObjectListBase.h
r9593 r9596 56 56 @param objectBase The object to store 57 57 */ 58 ObjectListBaseElement(Listable* objectBase) : next_(0), prev_(0), objectBase_(objectBase) {} 58 ObjectListBaseElement(Listable* object, ObjectListBase* list) : next_(0), prev_(0), objectBase_(object), list_(list) {} 59 ~ObjectListBaseElement(); 59 60 60 61 ObjectListBaseElement* next_; //!< The next element in the list 61 62 ObjectListBaseElement* prev_; //!< The previous element in the list 62 Listable* objectBase_; 63 Listable* objectBase_; //!< The object 64 ObjectListBase* list_; //!< The list 63 65 }; 64 66 … … 72 74 { 73 75 public: 74 ObjectListElement(T* object ) : ObjectListBaseElement(static_cast<Listable*>(object)), object_(object) {}76 ObjectListElement(T* object, ObjectListBase* list) : ObjectListBaseElement(static_cast<Listable*>(object), list), object_(object) {} 75 77 T* object_; //!< The object 76 78 }; … … 99 101 template <class T> 100 102 inline ObjectListBaseElement* add(T* object) 101 { return this->addElement(new ObjectListElement<T>(object )); }103 { return this->addElement(new ObjectListElement<T>(object, this)); } 102 104 103 105 ObjectListBaseElement* addElement(ObjectListBaseElement* element); 104 106 void removeElement(ObjectListBaseElement* element); 105 107 106 /// Helper struct, used to export an element and the list to an instance of Iterator.107 struct Export108 {109 Export(ObjectListBase* list, ObjectListBaseElement* element) : list_(list), element_(element) {}110 ObjectListBase* list_;111 ObjectListBaseElement* element_;112 };113 114 108 /// Returns a pointer to the first element in the list. Works only with Iterator. 115 inline Export begin() { return ObjectListBase::Export(this, this->first_); }109 inline ObjectListBaseElement* begin() { return this->first_; } 116 110 /// Returns a pointer to the element after the last element in the list. Works only with Iterator. 117 inline Export end() { return ObjectListBase::Export(this, 0); }111 inline ObjectListBaseElement* end() { return 0; } 118 112 /// Returns a pointer to the last element in the list. Works only with Iterator. 119 inline Export rbegin() { return ObjectListBase::Export(this, this->last_); }113 inline ObjectListBaseElement* rbegin() { return this->last_; } 120 114 /// Returns a pointer to the element in front of the first element in the list. Works only with Iterator. 121 inline Export rend() { return ObjectListBase::Export(this, 0); }115 inline ObjectListBaseElement* rend() { return 0; } 122 116 123 117 inline void registerIterator(void* iterator) { this->iterators_.push_back(iterator); }
Note: See TracChangeset
for help on using the changeset viewer.