[Orxonox-commit 4917] r9586 - code/branches/core6/src/libraries/core/class

landauf at orxonox.net landauf at orxonox.net
Tue Mar 26 23:30:57 CET 2013


Author: landauf
Date: 2013-03-26 23:30:57 +0100 (Tue, 26 Mar 2013)
New Revision: 9586

Modified:
   code/branches/core6/src/libraries/core/class/Identifier.h
Log:
call setConfigValues() only if the class is actually a Configurable

Modified: code/branches/core6/src/libraries/core/class/Identifier.h
===================================================================
--- code/branches/core6/src/libraries/core/class/Identifier.h	2013-03-26 22:01:08 UTC (rev 9585)
+++ code/branches/core6/src/libraries/core/class/Identifier.h	2013-03-26 22:30:57 UTC (rev 9586)
@@ -288,6 +288,9 @@
 
             bool initialiseObject(T* object, const std::string& className, bool bRootClass);
 
+            void setConfigValues(T* object, Configurable*) const;
+            void setConfigValues(T* object, Identifiable*) const;
+
             void addObjectToList(T* object, Listable*);
             void addObjectToList(T* object, Identifiable*);
 
@@ -389,7 +392,7 @@
                 object->parents_->insert(object->parents_->end(), this);
             }
 
-            object->setConfigValues();
+            this->setConfigValues(object, object);
             return true;
         }
         else
@@ -403,6 +406,21 @@
     }
 
     /**
+     * @brief Only configures the object if is a @ref Configurable
+     */
+    template <class T>
+    void ClassIdentifier<T>::setConfigValues(T* object, Configurable*) const
+    {
+        object->setConfigValues();
+    }
+
+    template <class T>
+    void ClassIdentifier<T>::setConfigValues(T*, Identifiable*) const
+    {
+        // no action
+    }
+
+    /**
      * @brief Only adds the object to the object list if is a @ref Listable
      */
     template <class T>
@@ -428,7 +446,7 @@
             return;
 
         for (ObjectListIterator<T> it = ObjectList<T>::begin(); it; ++it)
-            it->setConfigValues();
+            this->setConfigValues(*it, *it);
 
         if (updateChildren)
             for (std::set<const Identifier*>::const_iterator it = this->getChildrenBegin(); it != this->getChildrenEnd(); ++it)




More information about the Orxonox-commit mailing list