Changeset 9606 for code/branches/core6/src/libraries/core/class
- Timestamp:
- Mar 30, 2013, 7:26:54 PM (12 years ago)
- Location:
- code/branches/core6/src/libraries/core/class
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core6/src/libraries/core/class/Identifier.cc
r9602 r9606 52 52 : classID_(IdentifierManager::classIDCounter_s++) 53 53 { 54 this->objects_ = new ObjectListBase();55 56 54 this->bCreatedOneObject_ = false; 57 55 this->bSetName_ = false; … … 70 68 Identifier::~Identifier() 71 69 { 72 delete this->objects_;73 74 70 if (this->factory_) 75 71 delete this->factory_; -
code/branches/core6/src/libraries/core/class/Identifier.h
r9602 r9606 57 57 58 58 OrxonoxClass* other = object->getIdentifier()->fabricate(0); // fabricates a new instance of MyClass 59 60 61 // iterate through all objects of type MyClass:62 ObjectListBase* objects = object->getIdentifier()->getObjects(); // get a pointer to the object-list63 int count;64 for (Iterator<MyClass> it = objects.begin(); it != objects.end(); ++it) // iterate through the objects65 ++count;66 orxout() << count << endl; // prints "2" because we created 2 instances of MyClass so far67 59 68 60 … … 91 83 #include "util/Output.h" 92 84 #include "core/object/ObjectList.h" 93 #include "core/object/ObjectListBase.h" 85 #include "core/object/Listable.h" 86 #include "core/object/Context.h" 94 87 #include "IdentifierManager.h" 95 88 #include "Super.h" … … 126 119 /// Returns the unique ID of the class. 127 120 ORX_FORCEINLINE unsigned int getClassID() const { return this->classID_; } 128 129 /// Returns the list of all existing objects of this class.130 inline ObjectListBase* getObjects() const { return this->objects_; }131 121 132 122 /// Sets the Factory. … … 231 221 /// Returns the direct children of the class the Identifier belongs to. 232 222 inline std::set<const Identifier*>& getDirectChildrenIntern() const { return this->directChildren_; } 233 234 ObjectListBase* objects_; //!< The list of all objects of this class235 223 236 224 private: … … 424 412 */ 425 413 template <class T> 426 void ClassIdentifier<T>::addObjectToList(T* object, Listable*) 427 { 428 orxout(verbose, context::object_list) << "Added object to " << this->getName() << "-list." << endl; 429 object->elements_.push_back(this->objects_->add(object)); 414 void ClassIdentifier<T>::addObjectToList(T* object, Listable* listable) 415 { 416 listable->getContext()->addObject(object); 430 417 } 431 418
Note: See TracChangeset
for help on using the changeset viewer.