- Timestamp:
- Nov 21, 2015, 7:05:53 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/core/class/IdentifierManager.cc
r10768 r10821 93 93 { 94 94 Context temporaryContext(nullptr); 95 for ( std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)95 for (auto identifier : this->identifiers_) 96 96 { 97 Identifier* identifier = (*it);97 98 98 if (identifier->isInitialized()) 99 99 continue; … … 127 127 128 128 // finish the initialization of all identifiers 129 for ( std::set<Identifier*>::const_iterator it = initializedIdentifiers.begin(); it != initializedIdentifiers.end(); ++it)130 ( *it)->finishInitialization();129 for (const auto & initializedIdentifier : initializedIdentifiers) 130 (initializedIdentifier)->finishInitialization(); 131 131 132 132 // only check class hierarchy in dev mode because it's an expensive operation and it requires a developer to fix detected problems anyway. … … 144 144 { 145 145 // check if there are any uninitialized identifiers remaining 146 for ( std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)147 if (!( *it)->isInitialized())148 orxout(internal_error) << "Identifier was registered late and is not initialized: " << ( *it)->getName() << " / " << (*it)->getTypeInfo().name() << endl;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; 149 149 150 150 // for all initialized identifiers, check if a sample instance behaves as expected according to the class hierarchy 151 151 Context temporaryContext(nullptr); 152 for ( std::set<Identifier*>::const_iterator it1 = initializedIdentifiers.begin(); it1 != initializedIdentifiers.end(); ++it1)152 for (const auto & initializedIdentifier : initializedIdentifiers) 153 153 { 154 if (!( *it1)->hasFactory())154 if (!(initializedIdentifier)->hasFactory()) 155 155 continue; 156 156 157 Identifiable* temp = ( *it1)->fabricate(&temporaryContext);158 159 for ( std::set<Identifier*>::const_iterator it2 = this->identifiers_.begin(); it2 != this->identifiers_.end(); ++it2)157 Identifiable* temp = (initializedIdentifier)->fabricate(&temporaryContext); 158 159 for (const auto & elem : this->identifiers_) 160 160 { 161 bool isA_AccordingToRtti = ( *it2)->canDynamicCastObjectToIdentifierClass(temp);162 bool isA_AccordingToClassHierarchy = temp->isA(( *it2));161 bool isA_AccordingToRtti = (elem)->canDynamicCastObjectToIdentifierClass(temp); 162 bool isA_AccordingToClassHierarchy = temp->isA((elem)); 163 163 164 164 if (isA_AccordingToRtti != isA_AccordingToClassHierarchy) 165 165 { 166 orxout(internal_error) << "Class hierarchy does not match RTTI: Class hierarchy claims that " << ( *it1)->getName() <<167 (isA_AccordingToClassHierarchy ? " is a " : " is not a ") << ( *it2)->getName() << " but RTTI says the opposite." << endl;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; 168 168 } 169 169 } … … 184 184 { 185 185 orxout(internal_status) << "Destroy class-hierarchy" << endl; 186 for ( std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)187 ( *it)->reset();186 for (const auto & elem : this->identifiers_) 187 (elem)->reset(); 188 188 } 189 189 … … 260 260 { 261 261 // TODO: use std::type_index and a map to find identifiers by type_info (only with c++11) 262 for ( std::set<Identifier*>::iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)263 if (( *it)->getTypeInfo() == typeInfo)264 return ( *it);262 for (const auto & elem : this->identifiers_) 263 if ((elem)->getTypeInfo() == typeInfo) 264 return (elem); 265 265 return nullptr; 266 266 }
Note: See TracChangeset
for help on using the changeset viewer.