Changeset 9597 for code/branches/core6
- Timestamp:
- Mar 29, 2013, 11:44:22 AM (12 years ago)
- Location:
- code/branches/core6/src/libraries/core
- Files:
-
- 2 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core6/src/libraries/core/CorePrereqs.h
r9585 r9597 167 167 class MemoryArchive; 168 168 class MemoryArchiveFactory; 169 class MetaObjectList;170 class MetaObjectListElement;171 169 class Namespace; 172 170 class NamespaceNode; -
code/branches/core6/src/libraries/core/class/Identifier.h
r9593 r9597 90 90 91 91 #include "util/Output.h" 92 #include "core/object/MetaObjectList.h"93 92 #include "core/object/ObjectList.h" 94 93 #include "core/object/ObjectListBase.h" … … 428 427 { 429 428 orxout(verbose, context::object_list) << "Added object to " << this->getName() << "-list." << endl; 430 object-> metaList_->add(this->objects_,this->objects_->add(object));429 object->elements_.push_back(this->objects_->add(object)); 431 430 } 432 431 -
code/branches/core6/src/libraries/core/object/CMakeLists.txt
r9591 r9597 3 3 Destroyable.cc 4 4 Listable.cc 5 MetaObjectList.cc6 5 ObjectListBase.cc 7 6 ) -
code/branches/core6/src/libraries/core/object/Listable.cc
r9572 r9597 33 33 34 34 #include "Listable.h" 35 36 #include "core/object/MetaObjectList.h" 35 #include "ObjectListBase.h" 37 36 38 37 namespace orxonox 39 38 { 40 39 /** 41 @brief Constructor: creates the meta-object-list.40 @brief Constructor: Allocates space in the element list. 42 41 */ 43 42 Listable::Listable() 44 43 { 45 this-> metaList_ = new MetaObjectList();44 this->elements_.reserve(6); 46 45 } 47 46 … … 59 58 void Listable::unregisterObject() 60 59 { 61 if (this->metaList_)62 delete this-> metaList_;63 this-> metaList_ = 0;60 for (size_t i = 0; i < this->elements_.size(); ++i) 61 delete this->elements_[i]; 62 this->elements_.clear(); 64 63 } 65 64 } -
code/branches/core6/src/libraries/core/object/Listable.h
r9572 r9597 37 37 38 38 #include "core/CorePrereqs.h" 39 40 #include <vector> 41 39 42 #include "core/class/Identifiable.h" 40 43 … … 42 45 { 43 46 /** 44 @brief Listable stores the MetaObjectList which is used when storing instances in object lists.47 @brief Listable stores the entries of all object lists pointing to this instance. 45 48 */ 46 49 class _CoreExport Listable : virtual public Identifiable … … 56 59 57 60 private: 58 MetaObjectList* metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in61 std::vector<ObjectListBaseElement*> elements_; //!< The corresponding ObjectListElements in all object lists the object is registered in 59 62 }; 60 63 } -
code/branches/core6/src/libraries/core/object/ObjectListBase.cc
r9596 r9597 84 84 @brief Adds a new object to the end of the list. 85 85 @param element The element to add 86 @return The pointer to the new ObjectListBaseElement, needed by the MetaObjectList of the added object87 86 */ 88 ObjectListBaseElement*ObjectListBase::addElement(ObjectListBaseElement* element)87 void ObjectListBase::addElement(ObjectListBaseElement* element) 89 88 { 90 89 if (!this->last_) … … 102 101 temp->next_ = this->last_; 103 102 } 104 105 return this->last_;106 103 } 107 104 105 /** 106 * @brief Removes the element from the list 107 */ 108 108 void ObjectListBase::removeElement(ObjectListBaseElement* element) 109 109 { -
code/branches/core6/src/libraries/core/object/ObjectListBase.h
r9596 r9597 101 101 template <class T> 102 102 inline ObjectListBaseElement* add(T* object) 103 { return this->addElement(new ObjectListElement<T>(object, this)); } 103 { 104 ObjectListBaseElement* element = new ObjectListElement<T>(object, this); 105 this->addElement(element); 106 return element; 107 } 104 108 105 ObjectListBaseElement*addElement(ObjectListBaseElement* element);109 void addElement(ObjectListBaseElement* element); 106 110 void removeElement(ObjectListBaseElement* element); 107 111
Note: See TracChangeset
for help on using the changeset viewer.