Changeset 10916 for code/branches/cpp11_v2/src/libraries/core/class
- Timestamp:
- Dec 2, 2015, 11:22:03 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/libraries/core/class
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/core/class/Identifier.cc
r10821 r10916 87 87 for (std::list<const Identifier*>::const_iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it) 88 88 const_cast<Identifier*>(*it)->directChildren_.erase(this); 89 for (const auto & elem: this->children_)90 const_cast<Identifier*>( elem)->parents_.remove(this);91 for (const auto & elem: this->directChildren_)92 const_cast<Identifier*>( elem)->directParents_.remove(this);93 94 for (auto & elem: this->configValues_)95 delete ( elem.second);96 for (auto & elem: this->xmlportParamContainers_)97 delete ( elem.second);98 for (auto & elem: this->xmlportObjectContainers_)99 delete ( elem.second);89 for (const Identifier* child : this->children_) 90 const_cast<Identifier*>(child)->parents_.remove(this); 91 for (const Identifier* directChild : this->directChildren_) 92 const_cast<Identifier*>(directChild)->directParents_.remove(this); 93 94 for (auto& mapEntry : this->configValues_) 95 delete (mapEntry.second); 96 for (auto& mapEntry : this->xmlportParamContainers_) 97 delete (mapEntry.second); 98 for (auto& mapEntry : this->xmlportObjectContainers_) 99 delete (mapEntry.second); 100 100 } 101 101 … … 157 157 if (this->directParents_.empty()) 158 158 { 159 for (const auto & elem: initializationTrace)160 if ( elem!= this)161 this->parents_.push_back( elem);159 for (const Identifier* identifier : initializationTrace) 160 if (identifier != this) 161 this->parents_.push_back(identifier); 162 162 } 163 163 else … … 261 261 262 262 // if any parent class is virtual, it will be instantiated first, so we need to add them first. 263 for (const auto & elem: this->parents_)264 { 265 if ( (elem)->isVirtualBase())263 for (const Identifier* parent : this->parents_) 264 { 265 if (parent->isVirtualBase()) 266 266 { 267 for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>( elem)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(elem)->parents_.end(); ++it_parent_parent)267 for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(parent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(parent)->parents_.end(); ++it_parent_parent) 268 268 this->addIfNotExists(expectedIdentifierTrace, *it_parent_parent); 269 this->addIfNotExists(expectedIdentifierTrace, elem);269 this->addIfNotExists(expectedIdentifierTrace, parent); 270 270 } 271 271 } 272 272 273 273 // now all direct parents get created recursively. already added identifiers (e.g. virtual base classes) are not added again. 274 for (const auto & elem: this->directParents_)275 { 276 for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>( elem)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(elem)->parents_.end(); ++it_parent_parent)274 for (const Identifier* directParent : this->directParents_) 275 { 276 for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(directParent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(directParent)->parents_.end(); ++it_parent_parent) 277 277 this->addIfNotExists(expectedIdentifierTrace, *it_parent_parent); 278 this->addIfNotExists(expectedIdentifierTrace, elem);278 this->addIfNotExists(expectedIdentifierTrace, directParent); 279 279 } 280 280 … … 285 285 286 286 orxout(internal_warning) << " Actual trace (after creating a sample instance):" << endl << " "; 287 for (const auto & elem: this->parents_)288 orxout(internal_warning) << " " << (elem)->getName();287 for (const Identifier* parent : this->parents_) 288 orxout(internal_warning) << " " << parent->getName(); 289 289 orxout(internal_warning) << endl; 290 290 … … 295 295 296 296 orxout(internal_warning) << " Direct parents (according to class hierarchy definitions):" << endl << " "; 297 for (const auto & elem: this->directParents_)298 orxout(internal_warning) << " " << (elem)->getName();297 for (const Identifier* directParent : this->directParents_) 298 orxout(internal_warning) << " " << directParent->getName(); 299 299 orxout(internal_warning) << endl; 300 300 } -
code/branches/cpp11_v2/src/libraries/core/class/Identifier.h
r10821 r10916 462 462 463 463 if (updateChildren) 464 for (const auto & elem: this->getChildren())465 (elem)->updateConfigValues(false);464 for (const Identifier* child : this->getChildren()) 465 child->updateConfigValues(false); 466 466 } 467 467 -
code/branches/cpp11_v2/src/libraries/core/class/IdentifierManager.cc
r10821 r10916 93 93 { 94 94 Context temporaryContext(nullptr); 95 for ( autoidentifier : this->identifiers_)95 for (Identifier* identifier : this->identifiers_) 96 96 { 97 98 97 if (identifier->isInitialized()) 99 98 continue; … … 127 126 128 127 // finish the initialization of all identifiers 129 for ( const auto &initializedIdentifier : initializedIdentifiers)130 (initializedIdentifier)->finishInitialization();128 for (Identifier* initializedIdentifier : initializedIdentifiers) 129 initializedIdentifier->finishInitialization(); 131 130 132 131 // only check class hierarchy in dev mode because it's an expensive operation and it requires a developer to fix detected problems anyway. … … 144 143 { 145 144 // check if there are any uninitialized identifiers remaining 146 for ( const auto & elem: this->identifiers_)147 if (! (elem)->isInitialized())148 orxout(internal_error) << "Identifier was registered late and is not initialized: " << (elem)->getName() << " / " << (elem)->getTypeInfo().name() << endl;145 for (Identifier* identifier : this->identifiers_) 146 if (!identifier->isInitialized()) 147 orxout(internal_error) << "Identifier was registered late and is not initialized: " << identifier->getName() << " / " << identifier->getTypeInfo().name() << endl; 149 148 150 149 // for all initialized identifiers, check if a sample instance behaves as expected according to the class hierarchy 151 150 Context temporaryContext(nullptr); 152 for ( const auto &initializedIdentifier : initializedIdentifiers)151 for (Identifier* initializedIdentifier : initializedIdentifiers) 153 152 { 154 if (! (initializedIdentifier)->hasFactory())153 if (!initializedIdentifier->hasFactory()) 155 154 continue; 156 155 157 Identifiable* temp = (initializedIdentifier)->fabricate(&temporaryContext);158 159 for ( const auto & elem: this->identifiers_)156 Identifiable* temp = initializedIdentifier->fabricate(&temporaryContext); 157 158 for (Identifier* identifier : this->identifiers_) 160 159 { 161 bool isA_AccordingToRtti = (elem)->canDynamicCastObjectToIdentifierClass(temp);162 bool isA_AccordingToClassHierarchy = temp->isA( (elem));160 bool isA_AccordingToRtti = identifier->canDynamicCastObjectToIdentifierClass(temp); 161 bool isA_AccordingToClassHierarchy = temp->isA(identifier); 163 162 164 163 if (isA_AccordingToRtti != isA_AccordingToClassHierarchy) 165 164 { 166 orxout(internal_error) << "Class hierarchy does not match RTTI: Class hierarchy claims that " << (initializedIdentifier)->getName() <<167 (isA_AccordingToClassHierarchy ? " is a " : " is not a ") << (elem)->getName() << " but RTTI says the opposite." << endl;165 orxout(internal_error) << "Class hierarchy does not match RTTI: Class hierarchy claims that " << initializedIdentifier->getName() << 166 (isA_AccordingToClassHierarchy ? " is a " : " is not a ") << identifier->getName() << " but RTTI says the opposite." << endl; 168 167 } 169 168 } … … 184 183 { 185 184 orxout(internal_status) << "Destroy class-hierarchy" << endl; 186 for ( const auto & elem: this->identifiers_)187 (elem)->reset();185 for (Identifier* identifier : this->identifiers_) 186 identifier->reset(); 188 187 } 189 188 … … 260 259 { 261 260 // TODO: use std::type_index and a map to find identifiers by type_info (only with c++11) 262 for ( const auto & elem: this->identifiers_)263 if ( (elem)->getTypeInfo() == typeInfo)264 return (elem);261 for (Identifier* identifer : this->identifiers_) 262 if (identifer->getTypeInfo() == typeInfo) 263 return identifer; 265 264 return nullptr; 266 265 }
Note: See TracChangeset
for help on using the changeset viewer.