Changeset 246 for code/branches/objecthierarchie/src/Identifier.h
- Timestamp:
- Nov 25, 2007, 7:19:54 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchie/src/Identifier.h
r244 r246 8 8 #include "Factory.h" 9 9 10 #define HIERARCHY_VERBOSE true10 #define HIERARCHY_VERBOSE false 11 11 12 12 … … 30 30 31 31 public: 32 virtual void removeObject(OrxonoxClass* object) const = 0;33 virtual void removeObjectIntern(OrxonoxClass* object, bool bIterateForwards) const = 0;34 35 32 inline void addFactory(BaseFactory* factory) { this->factory_ = factory; } 36 33 BaseObject* fabricate(); … … 93 90 static ClassIdentifier<T>* getIdentifier(); 94 91 static void addObject(T* object); 95 void removeObject(OrxonoxClass* object) const;96 void removeObjectIntern(OrxonoxClass* object, bool bIterateForwards) const;97 92 98 93 private: … … 172 167 std::cout << "*** Added object to " << ClassIdentifier<T>::getIdentifier()->getName() << "-list.\n"; 173 168 #endif 174 ClassIdentifier<T>::getIdentifier()->objects_->add(object); 175 } 176 177 template <class T> 178 void ClassIdentifier<T>::removeObject(OrxonoxClass* object) const 179 { 180 bool bIterateForwards = !Identifier::isCreatingHierarchy(); 181 182 this->removeObjectIntern(object, bIterateForwards); 183 184 IdentifierListElement* temp = this->parents_.first_; 185 while (temp) 186 { 187 temp->identifier_->removeObjectIntern(object, bIterateForwards); 188 temp = temp->next_; 189 } 190 } 191 192 template <class T> 193 void ClassIdentifier<T>::removeObjectIntern(OrxonoxClass* object, bool bIterateForwards) const 194 { 195 #if HIERARCHY_VERBOSE 196 if (bIterateForwards) 197 std::cout << "*** Removed object from " << this->name_ << "-list, iterating forwards.\n"; 198 else 199 std::cout << "*** Removed object from " << this->name_ << "-list, iterating backwards.\n"; 200 #endif 201 202 this->objects_->remove(object, bIterateForwards); 169 object->getMetaList()->add(ClassIdentifier<T>::getIdentifier()->objects_, ClassIdentifier<T>::getIdentifier()->objects_->add(object)); 203 170 } 204 171
Note: See TracChangeset
for help on using the changeset viewer.