Changeset 9593 for code/branches/core6/src
- Timestamp:
- Mar 27, 2013, 11:17:45 PM (12 years ago)
- Location:
- code/branches/core6/src/libraries/core
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core6/src/libraries/core/class/Identifier.cc
r9564 r9593 52 52 : classID_(IdentifierManager::classIDCounter_s++) 53 53 { 54 this->objects_ = new ObjectListBase( this);54 this->objects_ = new ObjectListBase(); 55 55 56 56 this->bCreatedOneObject_ = false; -
code/branches/core6/src/libraries/core/class/Identifier.h
r9586 r9593 428 428 { 429 429 orxout(verbose, context::object_list) << "Added object to " << this->getName() << "-list." << endl; 430 object->metaList_->add(this->objects_, this->objects_->add( new ObjectListElement<T>(object)));430 object->metaList_->add(this->objects_, this->objects_->add(object)); 431 431 } 432 432 -
code/branches/core6/src/libraries/core/object/MetaObjectList.cc
r9563 r9593 48 48 MetaObjectListElement::~MetaObjectListElement() 49 49 { 50 orxout(verbose, context::object_list) << "Removing Object from " << this->list_->getIdentifier()->getName() << "-list." << endl; 51 this->list_->notifyIterators(this->element_->objectBase_); 52 53 if (this->element_->next_) 54 this->element_->next_->prev_ = this->element_->prev_; 55 else 56 this->list_->last_ = this->element_->prev_; // If there is no next_, we deleted the last object and have to update the last_ pointer of the list 57 58 if (this->element_->prev_) 59 this->element_->prev_->next_ = this->element_->next_; 60 else 61 this->list_->first_ = this->element_->next_; // If there is no prev_, we deleted the first object and have to update the first_ pointer of the list 62 50 this->list_->removeElement(this->element_); 63 51 delete this->element_; 64 52 } -
code/branches/core6/src/libraries/core/object/ObjectListBase.cc
r9573 r9593 36 36 #include <set> 37 37 #include "Iterator.h" 38 #include "Listable.h" 38 39 #include "ObjectListIterator.h" 39 40 … … 43 44 @brief Constructor: Sets default values. 44 45 */ 45 ObjectListBase::ObjectListBase( Identifier* identifier)46 ObjectListBase::ObjectListBase() 46 47 { 47 this->identifier_ = identifier;48 48 this->first_ = 0; 49 49 this->last_ = 0; … … 81 81 @return The pointer to the new ObjectListBaseElement, needed by the MetaObjectList of the added object 82 82 */ 83 ObjectListBaseElement* ObjectListBase::add (ObjectListBaseElement* element)83 ObjectListBaseElement* ObjectListBase::addElement(ObjectListBaseElement* element) 84 84 { 85 85 if (!this->last_) … … 100 100 return this->last_; 101 101 } 102 103 void ObjectListBase::removeElement(ObjectListBaseElement* element) 104 { 105 orxout(verbose, context::object_list) << "Removing Object from " << element->objectBase_->getIdentifier()->getName() << "-list." << endl; 106 this->notifyIterators(element->objectBase_); 107 108 if (element->next_) 109 element->next_->prev_ = element->prev_; 110 else 111 this->last_ = element->prev_; // If there is no next_, we deleted the last object and have to update the last_ pointer of the list 112 113 if (element->prev_) 114 element->prev_->next_ = element->next_; 115 else 116 this->first_ = element->next_; // If there is no prev_, we deleted the first object and have to update the first_ pointer of the list 117 } 102 118 } -
code/branches/core6/src/libraries/core/object/ObjectListBase.h
r9573 r9593 93 93 class _CoreExport ObjectListBase 94 94 { 95 friend class MetaObjectListElement;96 97 95 public: 98 ObjectListBase( Identifier* identifier);96 ObjectListBase(); 99 97 ~ObjectListBase(); 100 98 101 ObjectListBaseElement* add(ObjectListBaseElement* element); 99 template <class T> 100 inline ObjectListBaseElement* add(T* object) 101 { return this->addElement(new ObjectListElement<T>(object)); } 102 103 ObjectListBaseElement* addElement(ObjectListBaseElement* element); 104 void removeElement(ObjectListBaseElement* element); 102 105 103 106 /// Helper struct, used to export an element and the list to an instance of Iterator. … … 144 147 void notifyIterators(Listable* object) const; 145 148 146 inline Identifier* getIdentifier() const { return this->identifier_; }147 148 149 private: 149 Identifier* identifier_; //!< The Iterator owning this list150 150 ObjectListBaseElement* first_; //!< The first element in the list 151 151 ObjectListBaseElement* last_; //!< The last element in the list
Note: See TracChangeset
for help on using the changeset viewer.