Changeset 10512 for code/branches/core7/src/libraries/core/class
- Timestamp:
- May 30, 2015, 10:59:13 PM (9 years ago)
- Location:
- code/branches/core7/src/libraries/core/class
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/core/class/Identifier.cc
r10483 r10512 79 79 delete this->factory_; 80 80 81 for (std::list<const InheritsFrom*>::const_iterator it = this->manualDirectParents_.begin(); it != this->manualDirectParents_.end(); ++it) 82 delete (*it); 83 81 84 for (std::map<std::string, ConfigValueContainer*>::iterator it = this->configValues_.begin(); it != this->configValues_.end(); ++it) 82 85 delete (it->second); … … 121 124 * @brief Used to define the direct parents of an Identifier of an abstract class. 122 125 */ 123 Identifier& Identifier::inheritsFrom(I dentifier* directParent)124 { 125 if (this-> parents_.empty())126 this-> directParents_.push_back(directParent);127 else 128 orxout(internal_error) << "Trying to add " << directParent->getName() << " as adirect parent of " << this->getName() << " after the latter was already initialized" << endl;126 Identifier& Identifier::inheritsFrom(InheritsFrom* directParent) 127 { 128 if (this->directParents_.empty()) 129 this->manualDirectParents_.push_back(directParent); 130 else 131 orxout(internal_error) << "Trying to manually add direct parent of " << this->getName() << " after the latter was already initialized" << endl; 129 132 130 133 return *this; … … 183 186 this->verifyIdentifierTrace(); 184 187 } 185 else if (!this-> directParents_.empty())188 else if (!this->manualDirectParents_.empty()) 186 189 { 187 190 // no parents defined -> this class was manually initialized by calling inheritsFrom<Class>() 188 191 189 192 // initialize all direct parents 190 for (std::list<const Identifier*>::const_iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it) 191 const_cast<Identifier*>(*it)->finishInitialization(); // initialize parent 193 for (std::list<const InheritsFrom*>::const_iterator it = this->manualDirectParents_.begin(); it != this->manualDirectParents_.end(); ++it) 194 { 195 Identifier* directParent = (*it)->getParent(); 196 this->directParents_.push_back(directParent); 197 directParent->finishInitialization(); // initialize parent 198 } 192 199 193 200 // direct parents and their parents are also parents of this identifier (but only add them once) -
code/branches/core7/src/libraries/core/class/Identifier.h
r10483 r10512 112 112 { 113 113 public: 114 struct InheritsFrom //! helper class to manually define inheritance 115 { 116 virtual ~InheritsFrom() {} 117 virtual Identifier* getParent() const = 0; 118 }; 119 120 public: 114 121 Identifier(const std::string& name, Factory* factory, bool bLoadable); 115 122 Identifier(const Identifier& identifier); // don't copy … … 149 156 ////// Class Hierarchy ////// 150 157 ///////////////////////////// 151 Identifier& inheritsFrom(I dentifier* directParent);158 Identifier& inheritsFrom(InheritsFrom* directParent); 152 159 153 160 void initializeParents(const std::list<const Identifier*>& initializationTrace); … … 219 226 void addIfNotExists(std::list<const Identifier*>& list, const Identifier* identifierToAdd) const; 220 227 228 std::list<const InheritsFrom*> manualDirectParents_; //!< Manually defined direct parents 221 229 std::list<const Identifier*> directParents_; //!< The direct parents of the class the Identifier belongs to (sorted by their order of initialization) 222 230 std::list<const Identifier*> parents_; //!< The parents of the class the Identifier belongs to (sorted by their order of initialization)
Note: See TracChangeset
for help on using the changeset viewer.