Changeset 224 for code/branches/objecthierarchie/src/Identifier.h
- Timestamp:
- Nov 20, 2007, 8:38:53 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchie/src/Identifier.h
r221 r224 26 26 class BaseObject; 27 27 28 // ##### Identifier ##### 28 // ############################### 29 // ### Identifier ### 30 // ############################### 29 31 class Identifier 30 32 { … … 35 37 friend class BaseIdentifier; 36 38 37 template <class T>38 friend class Iterator;39 40 39 public: 41 void addObject(OrxonoxClass* object); 42 void removeObject(OrxonoxClass* object); 40 virtual void removeObject(OrxonoxClass* object) {}; 43 41 44 42 virtual BaseObject* fabricate() {}; … … 73 71 IdentifierList allChildren_; 74 72 75 ObjectList objects_;76 73 std::string name_; 77 74 … … 83 80 84 81 85 // ##### ClassIdentifier ##### 82 // ############################### 83 // ### ClassIdentifier ### 84 // ############################### 86 85 template <class T> 87 86 class ClassIdentifier : public Identifier 88 87 { 88 template <class U> 89 friend class Iterator; 90 89 91 public: 90 92 static ClassIdentifier<T>* registerClass(IdentifierList* parents, std::string name, bool bRootClass, bool bIsAbstractClass); … … 92 94 BaseObject* fabricate(); 93 95 T* fabricateClass(); 96 static void addObject(T* object); 97 void removeObject(OrxonoxClass* object); 94 98 95 99 private: … … 99 103 100 104 static ClassIdentifier<T>* pointer_s; 101 105 ObjectList<T> objects_s; 102 106 }; 103 107 … … 182 186 } 183 187 184 // ##### BaseIdentifier ##### 188 template <class T> 189 void ClassIdentifier<T>::addObject(T* object) 190 { 191 std::cout << "*** Added object to " << ClassIdentifier<T>::getIdentifier()->getName() << "-list.\n"; 192 ClassIdentifier<T>::getIdentifier()->objects_s.add(object); 193 } 194 195 template <class T> 196 void ClassIdentifier<T>::removeObject(OrxonoxClass* object) 197 { 198 bool bIterateForwards = !Identifier::isCreatingHierarchy(); 199 200 if (bIterateForwards) 201 std::cout << "*** Removed object from " << this->name_ << "-list, iterating forwards.\n"; 202 else 203 std::cout << "*** Removed object from " << this->name_ << "-list, iterating backwards.\n"; 204 205 this->objects_s.remove(object, bIterateForwards); 206 207 IdentifierListElement* temp = this->directParents_.first_; 208 while (temp) 209 { 210 temp->identifier_->removeObject(object); 211 temp = temp->next_; 212 } 213 } 214 215 216 // ############################### 217 // ### BaseIdentifier ### 218 // ############################### 185 219 template <class B> 186 220 class BaseIdentifier
Note: See TracChangeset
for help on using the changeset viewer.