Changeset 817 for code/branches/core/src/orxonox/core/Identifier.h
- Timestamp:
- Feb 16, 2008, 7:31:18 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core/src/orxonox/core/Identifier.h
r814 r817 39 39 40 40 Every object has a pointer to the Identifier of its class. This allows the use isA(...), 41 is DirectlyA(...), isChildOf(...) and isParentOf(...).41 isExactlyA(...), isChildOf(...) and isParentOf(...). 42 42 43 43 To create the class-hierarchy, the Identifier has some intern functions and variables. … … 82 82 83 83 Every object has a pointer to the Identifier of its class. This allows the use isA(...), 84 is DirectlyA(...), isChildOf(...) and isParentOf(...).84 isExactlyA(...), isChildOf(...) and isParentOf(...). 85 85 86 86 You can't directly create an Identifier, it's just the base-class for ClassIdentifier. … … 102 102 BaseObject* fabricate(); 103 103 bool isA(const Identifier* identifier) const; 104 bool is DirectlyA(const Identifier* identifier) const;104 bool isExactlyA(const Identifier* identifier) const; 105 105 bool isChildOf(const Identifier* identifier) const; 106 bool isDirectChildOf(const Identifier* identifier) const; 106 107 bool isParentOf(const Identifier* identifier) const; 108 bool isDirectParentOf(const Identifier* identifier) const; 107 109 108 110 /** @brief Removes all objects of the corresponding class. */ … … 114 116 /** @brief Returns the parents of the class the Identifier belongs to. @return The list of all parents */ 115 117 inline const std::list<const Identifier*>& getParents() const { return this->parents_; } 116 117 118 /** @brief Returns the begin-iterator of the parents-list. @return The begin-iterator */ 118 119 inline std::list<const Identifier*>::const_iterator getParentsBegin() const { return this->parents_.begin(); } 119 120 120 /** @brief Returns the end-iterator of the parents-list. @return The end-iterator */ 121 121 inline std::list<const Identifier*>::const_iterator getParentsEnd() const { return this->parents_.end(); } 122 122 123 /** @brief Returns the children of the class the Identifier belongs to. @return The list of all children */ 124 inline const std::list<const Identifier*>& getChildren() const { return (*this->children_); } 123 125 /** @brief Returns the begin-iterator of the children-list. @return The begin-iterator */ 124 126 inline std::list<const Identifier*>::const_iterator getChildrenBegin() const { return this->children_->begin(); } 125 126 127 /** @brief Returns the end-iterator of the children-list. @return The end-iterator */ 127 128 inline std::list<const Identifier*>::const_iterator getChildrenEnd() const { return this->children_->end(); } 129 130 /** @brief Returns the direct parents of the class the Identifier belongs to. @return The list of all direct parents */ 131 inline const std::list<const Identifier*>& getDirectParents() const { return this->directParents_; } 132 /** @brief Returns the begin-iterator of the direct-parents-list. @return The begin-iterator */ 133 inline std::list<const Identifier*>::const_iterator getDirectParentsBegin() const { return this->directParents_.begin(); } 134 /** @brief Returns the end-iterator of the direct-parents-list. @return The end-iterator */ 135 inline std::list<const Identifier*>::const_iterator getDirectParentsEnd() const { return this->directParents_.end(); } 136 137 /** @brief Returns the direct children the class the Identifier belongs to. @return The list of all direct children */ 138 inline const std::list<const Identifier*>& getDirectChildren() const { return (*this->directChildren_); } 139 /** @brief Returns the begin-iterator of the direct-children-list. @return The begin-iterator */ 140 inline std::list<const Identifier*>::const_iterator getDirectChildrenBegin() const { return this->directChildren_->begin(); } 141 /** @brief Returns the end-iterator of the direct-children-list. @return The end-iterator */ 142 inline std::list<const Identifier*>::const_iterator getDirectChildrenEnd() const { return this->directChildren_->end(); } 128 143 129 144 /** @brief Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents. @return The status of the class-hierarchy creation */ … … 143 158 inline void setConfigValueContainer(const std::string& varname, ConfigValueContainer* container) 144 159 { this->configValues_[varname] = container; } 160 161 static bool identifierIsInList(const Identifier* identifier, const std::list<const Identifier*>& list); 145 162 146 163 private: … … 150 167 void initialize(std::list<const Identifier*>* parents); 151 168 152 /** @brief Returns the parents of the class the Identifier belongs to. @return The list of all parents */153 inline std::list<const Identifier*>& getParents() { return this->parents_; }154 155 169 /** @brief Returns the children of the class the Identifier belongs to. @return The list of all children */ 156 inline std::list<const Identifier*>& getChildren() const { return (*this->children_); } 170 inline std::list<const Identifier*>& getChildrenIntern() const { return (*this->children_); } 171 /** @brief Returns the direct children of the class the Identifier belongs to. @return The list of all direct children */ 172 inline std::list<const Identifier*>& getDirectChildrenIntern() const { return (*this->directChildren_); } 157 173 158 174 /** … … 174 190 } 175 191 176 static bool identifierIsInList(const Identifier* identifier, const std::list<const Identifier*>& list); 177 178 std::list<const Identifier*> parents_; //!< The Parents of the class the Identifier belongs to 179 std::list<const Identifier*>* children_; //!< The Children of the class the Identifier belongs to 192 std::list<const Identifier*> parents_; //!< The parents of the class the Identifier belongs to 193 std::list<const Identifier*>* children_; //!< The children of the class the Identifier belongs to 194 195 std::list<const Identifier*> directParents_; //!< The direct parents of the class the Identifier belongs to 196 std::list<const Identifier*>* directChildren_; //!< The direct children of the class the Identifier belongs to 180 197 181 198 std::string name_; //!< The name of the class the Identifier belongs to … … 188 205 }; 189 206 207 std::ostream& operator<<(std::ostream& out, const std::list<const Identifier*>& list); 208 190 209 191 210 // ############################### … … 215 234 void removeObjects() const; 216 235 void setName(const std::string& name); 236 inline const ObjectList<T>* getObjects() const { return this->objects_; } 217 237 218 238 private: … … 231 251 ClassIdentifier<T>::ClassIdentifier() 232 252 { 233 this->objects_ = ObjectList<T>::getList(); 253 // this->objects_ = ObjectList<T>::getList(); 254 this->objects_ = new ObjectList<T>(); 234 255 this->bSetName_ = false; 235 256 } … … 294 315 void ClassIdentifier<T>::removeObjects() const 295 316 { 296 for (Iterator<T> it = ObjectList<T>::start(); it;)317 for (Iterator<T> it = this->objects_->start(); it;) 297 318 delete *(it++); 298 319 } 320 299 321 300 322 // ############################### … … 409 431 410 432 /** @brief Returns true, if the assigned identifier is exactly of the given type. @param identifier The identifier to compare with */ 411 inline bool is DirectlyA(const Identifier* identifier) const412 { return this->identifier_->is DirectlyA(identifier); }433 inline bool isExactlyA(const Identifier* identifier) const 434 { return this->identifier_->isExactlyA(identifier); } 413 435 414 436 /** @brief Returns true, if the assigned identifier is a child of the given identifier. @param identifier The identifier to compare with */ … … 416 438 { return this->identifier_->isChildOf(identifier); } 417 439 440 /** @brief Returns true, if the assigned identifier is a direct child of the given identifier. @param identifier The identifier to compare with */ 441 inline bool isDirectChildOf(const Identifier* identifier) const 442 { return this->identifier_->isDirectChildOf(identifier); } 443 418 444 /** @brief Returns true, if the assigned identifier is a parent of the given identifier. @param identifier The identifier to compare with */ 419 445 inline bool isParentOf(const Identifier* identifier) const 420 446 { return this->identifier_->isParentOf(identifier); } 447 448 /** @brief Returns true, if the assigned identifier is a direct parent of the given identifier. @param identifier The identifier to compare with */ 449 inline bool isDirectParentOf(const Identifier* identifier) const 450 { return this->identifier_->isDirectParentOf(identifier); } 421 451 422 452 private:
Note: See TracChangeset
for help on using the changeset viewer.