[Orxonox-commit 5859] r10519 - code/branches/core7/src/libraries/core/class
landauf at orxonox.net
landauf at orxonox.net
Sun May 31 11:26:33 CEST 2015
Author: landauf
Date: 2015-05-31 11:26:33 +0200 (Sun, 31 May 2015)
New Revision: 10519
Modified:
code/branches/core7/src/libraries/core/class/IdentifierManager.cc
code/branches/core7/src/libraries/core/class/IdentifierManager.h
Log:
only verify freshly initialized identifiers
Modified: code/branches/core7/src/libraries/core/class/IdentifierManager.cc
===================================================================
--- code/branches/core7/src/libraries/core/class/IdentifierManager.cc 2015-05-31 08:56:32 UTC (rev 10518)
+++ code/branches/core7/src/libraries/core/class/IdentifierManager.cc 2015-05-31 09:26:33 UTC (rev 10519)
@@ -130,19 +130,12 @@
}
// finish the initialization of all identifiers
- for (std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
- {
- Identifier* identifier = (*it);
+ for (std::set<Identifier*>::const_iterator it = initializedIdentifiers.begin(); it != initializedIdentifiers.end(); ++it)
+ (*it)->finishInitialization();
- if (initializedIdentifiers.find(identifier) != initializedIdentifiers.end())
- identifier->finishInitialization();
- else if (!identifier->isInitialized())
- orxout(internal_error) << "Identifier was registered late and is not initialized: " << identifier->getName() << " / " << identifier->getTypeInfo().name() << endl;
- }
-
// only check class hierarchy in dev mode because it's an expensive operation and it requires a developer to fix detected problems anyway.
if (!Core::exists() || Core::getInstance().getConfig()->inDevMode())
- this->verifyClassHierarchy();
+ this->verifyClassHierarchy(initializedIdentifiers);
this->stopCreatingHierarchy();
orxout(internal_status) << "Finished class-hierarchy creation" << endl;
@@ -151,10 +144,16 @@
/**
* Verifies if the class hierarchy is consistent with the RTTI.
*/
- void IdentifierManager::verifyClassHierarchy()
+ void IdentifierManager::verifyClassHierarchy(const std::set<Identifier*>& initializedIdentifiers)
{
+ // check if there are any uninitialized identifiers remaining
+ for (std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
+ if (!(*it)->isInitialized())
+ orxout(internal_error) << "Identifier was registered late and is not initialized: " << (*it)->getName() << " / " << (*it)->getTypeInfo().name() << endl;
+
+ // for all initialized identifiers, check if a sample instance behaves as expected according to the class hierarchy
Context temporaryContext(NULL);
- for (std::set<Identifier*>::const_iterator it1 = this->identifiers_.begin(); it1 != this->identifiers_.end(); ++it1)
+ for (std::set<Identifier*>::const_iterator it1 = initializedIdentifiers.begin(); it1 != initializedIdentifiers.end(); ++it1)
{
if (!(*it1)->hasFactory())
continue;
Modified: code/branches/core7/src/libraries/core/class/IdentifierManager.h
===================================================================
--- code/branches/core7/src/libraries/core/class/IdentifierManager.h 2015-05-31 08:56:32 UTC (rev 10518)
+++ code/branches/core7/src/libraries/core/class/IdentifierManager.h 2015-05-31 09:26:33 UTC (rev 10519)
@@ -56,7 +56,7 @@
////// Class Hierarchy //////
/////////////////////////////
void createClassHierarchy();
- void verifyClassHierarchy();
+ void verifyClassHierarchy(const std::set<Identifier*>& initializedIdentifiers);
void destroyClassHierarchy();
void createdObject(Identifiable* identifiable);
More information about the Orxonox-commit
mailing list