Changeset 243 for code/branches/objecthierarchie/src/Identifier.h
- Timestamp:
- Nov 25, 2007, 4:07:56 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchie/src/Identifier.h
r242 r243 28 28 public: 29 29 virtual void removeObject(OrxonoxClass* object) const = 0; 30 virtual void removeObjectIntern(OrxonoxClass* object, bool bIterateForwards) const = 0; 30 31 31 32 virtual BaseObject* fabricate() const = 0; … … 34 35 bool isDirectlyA(const Identifier* identifier) const; 35 36 bool isChildOf(const Identifier* identifier) const; 36 bool isDirectChildOf(const Identifier* identifier) const;37 37 bool isParentOf(const Identifier* identifier) const; 38 bool isDirectParentOf(const Identifier* identifier) const;39 38 40 39 const std::string& getName() const { return this->name_; } 41 const IdentifierList& getDirectParents() const { return this->directParents_; } 42 const IdentifierList& getAllParents() const { return this->allParents_; } 43 IdentifierList& getDirectChildren() const { return *this->directChildren_; } 44 IdentifierList& getAllChildren() const { return *this->allChildren_; } 40 const IdentifierList& getParents() const { return this->parents_; } 41 IdentifierList& getChildren() const { return *this->children_; } 45 42 46 43 static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); } … … 68 65 } 69 66 70 IdentifierList directParents_; 71 IdentifierList allParents_; 72 IdentifierList* directChildren_; 73 IdentifierList* allChildren_; 67 IdentifierList parents_; 68 IdentifierList* children_; 74 69 75 70 std::string name_; … … 98 93 static void addObject(T* object); 99 94 void removeObject(OrxonoxClass* object) const; 95 void removeObjectIntern(OrxonoxClass* object, bool bIterateForwards) const; 100 96 101 97 private: … … 212 208 bool bIterateForwards = !Identifier::isCreatingHierarchy(); 213 209 210 this->removeObjectIntern(object, bIterateForwards); 211 212 IdentifierListElement* temp = this->parents_.first_; 213 while (temp) 214 { 215 temp->identifier_->removeObjectIntern(object, bIterateForwards); 216 temp = temp->next_; 217 } 218 } 219 220 template <class T> 221 void ClassIdentifier<T>::removeObjectIntern(OrxonoxClass* object, bool bIterateForwards) const 222 { 214 223 #if HIERARCHY_VERBOSE 215 224 if (bIterateForwards) … … 220 229 221 230 this->objects_->remove(object, bIterateForwards); 222 223 IdentifierListElement* temp = this->directParents_.first_;224 while (temp)225 {226 temp->identifier_->removeObject(object);227 temp = temp->next_;228 }229 231 } 230 232 … … 295 297 inline bool isChildOf(const Identifier* identifier) const 296 298 { return this->identifier_->isChildOf(identifier); } 297 inline bool isDirectChildOf(const Identifier* identifier) const298 { return this->identifier_->isDirectChildOf(identifier); }299 299 inline bool isParentOf(const Identifier* identifier) const 300 300 { return this->identifier_->isParentOf(identifier); } 301 inline bool isDirectParentOf(const Identifier* identifier) const302 { return this->identifier_->isDirectParentOf(identifier); }303 301 304 302 private:
Note: See TracChangeset
for help on using the changeset viewer.