[Orxonox-commit 5719] r10379 - in code/branches/core7/src/libraries/core: . class

landauf at orxonox.net landauf at orxonox.net
Wed Apr 22 22:29:21 CEST 2015


Author: landauf
Date: 2015-04-22 22:29:21 +0200 (Wed, 22 Apr 2015)
New Revision: 10379

Modified:
   code/branches/core7/src/libraries/core/CoreIncludes.h
   code/branches/core7/src/libraries/core/class/Identifier.cc
   code/branches/core7/src/libraries/core/class/Identifier.h
Log:
check if all classes are registered

Modified: code/branches/core7/src/libraries/core/CoreIncludes.h
===================================================================
--- code/branches/core7/src/libraries/core/CoreIncludes.h	2015-04-21 20:26:30 UTC (rev 10378)
+++ code/branches/core7/src/libraries/core/CoreIncludes.h	2015-04-22 20:29:21 UTC (rev 10379)
@@ -79,6 +79,7 @@
 
 #include "CorePrereqs.h"
 
+#include "util/OrxAssert.h"
 #include "util/Output.h"
 #include "class/IdentifierManager.h"
 #include "object/ClassFactory.h"
@@ -136,6 +137,7 @@
     if (ClassIdentifier<ClassName>::getIdentifier(#ClassName)->initializeObject(this)) \
         return; \
     else \
+        OrxVerify(ClassIdentifier<ClassName>::getIdentifier()->isRegistered(), "Assertion failed in ClassIdentifier of type " << typeid(ClassName).name()); \
         ((void)0)
 
 /**
@@ -170,6 +172,7 @@
         Identifier* identifier = ClassIdentifier<T>::getIdentifier(name);
         identifier->setFactory(factory);
         identifier->setLoadable(bLoadable);
+        identifier->setRegistered(true);
         return identifier;
     }
 

Modified: code/branches/core7/src/libraries/core/class/Identifier.cc
===================================================================
--- code/branches/core7/src/libraries/core/class/Identifier.cc	2015-04-21 20:26:30 UTC (rev 10378)
+++ code/branches/core7/src/libraries/core/class/Identifier.cc	2015-04-22 20:29:21 UTC (rev 10379)
@@ -54,6 +54,7 @@
     {
         this->factory_ = 0;
         this->bInitialized_ = false;
+        this->bRegistered_ = false;
         this->bLoadable_ = false;
         this->bIsVirtualBase_ = false;
 

Modified: code/branches/core7/src/libraries/core/class/Identifier.h
===================================================================
--- code/branches/core7/src/libraries/core/class/Identifier.h	2015-04-21 20:26:30 UTC (rev 10378)
+++ code/branches/core7/src/libraries/core/class/Identifier.h	2015-04-22 20:29:21 UTC (rev 10379)
@@ -133,6 +133,9 @@
 
             Identifiable* fabricate(Context* context);
 
+            inline bool isRegistered() const { return this->bRegistered_; }
+            inline void setRegistered(bool bRegistered) { this->bRegistered_ = bRegistered; }
+
             /// Returns true if the class can be loaded through XML.
             inline bool isLoadable() const { return this->bLoadable_; }
             /// Set the class to be loadable through XML or not.
@@ -224,6 +227,7 @@
             std::set<const Identifier*> children_;                         //!< The children of the class the Identifier belongs to
 
             bool bInitialized_;                                            //!< Is true if the Identifier was completely initialized
+            bool bRegistered_;
             bool bLoadable_;                                               //!< False = it's not permitted to load the object through XML
             bool bIsVirtualBase_;                                          //!< If true, it is recommended to inherit virtually from this class. This changes the order of initialization of child classes, thus this information is necessary to check the class hierarchy.
             std::string name_;                                             //!< The name of the class the Identifier belongs to




More information about the Orxonox-commit mailing list