[Orxonox-commit 4893] r9562 - in code/branches/core6/src/libraries/core: . object

landauf at orxonox.net landauf at orxonox.net
Sun Mar 24 16:16:01 CET 2013


Author: landauf
Date: 2013-03-24 16:16:01 +0100 (Sun, 24 Mar 2013)
New Revision: 9562

Added:
   code/branches/core6/src/libraries/core/object/ContextObject.cc
   code/branches/core6/src/libraries/core/object/ContextObject.h
Modified:
   code/branches/core6/src/libraries/core/OrxonoxClass.cc
   code/branches/core6/src/libraries/core/OrxonoxClass.h
   code/branches/core6/src/libraries/core/object/CMakeLists.txt
   code/branches/core6/src/libraries/core/object/Context.cc
   code/branches/core6/src/libraries/core/object/Context.h
Log:
it's probably better to store the context in a seaprate interface instead of adding a constructor argument to OrxonoxClass

Modified: code/branches/core6/src/libraries/core/OrxonoxClass.cc
===================================================================
--- code/branches/core6/src/libraries/core/OrxonoxClass.cc	2013-03-24 13:02:01 UTC (rev 9561)
+++ code/branches/core6/src/libraries/core/OrxonoxClass.cc	2013-03-24 15:16:01 UTC (rev 9562)
@@ -43,12 +43,8 @@
     /**
         @brief Constructor: Sets the default values.
     */
-    OrxonoxClass::OrxonoxClass(Context* context) : context_(context)
+    OrxonoxClass::OrxonoxClass()
     {
-        //assert(context);
-        if (!this->context_)
-            this->context_ = Context::getRootContext();
-
         this->identifier_ = 0;
         this->parents_ = 0;
         this->metaList_ = new MetaObjectList();

Modified: code/branches/core6/src/libraries/core/OrxonoxClass.h
===================================================================
--- code/branches/core6/src/libraries/core/OrxonoxClass.h	2013-03-24 13:02:01 UTC (rev 9561)
+++ code/branches/core6/src/libraries/core/OrxonoxClass.h	2013-03-24 15:16:01 UTC (rev 9562)
@@ -69,7 +69,7 @@
         friend class DestructionListener;
 
         public:
-            OrxonoxClass(Context* context = NULL);
+            OrxonoxClass();
             virtual ~OrxonoxClass();
 
             void destroy();
@@ -81,9 +81,6 @@
             /// Returns the Identifier of the object.
             inline Identifier* getIdentifier() const { return this->identifier_; }
 
-            /// Returns the object's Context.
-            inline Context* getContext() const { return this->context_; }
-
             bool isA(const Identifier* identifier);
             bool isExactlyA(const Identifier* identifier);
             bool isChildOf(const Identifier* identifier);
@@ -169,7 +166,6 @@
                 { this->destructionListeners_.erase(pointer); }
 
             Identifier* identifier_;                                //!< The Identifier of the object
-            Context* context_;                                      //!< The object's context
             std::set<const Identifier*>* parents_;                  //!< List of all parents of the object
             MetaObjectList* metaList_;                              //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in
             int referenceCount_;                                    //!< Counts the references from smart pointers to this object

Modified: code/branches/core6/src/libraries/core/object/CMakeLists.txt
===================================================================
--- code/branches/core6/src/libraries/core/object/CMakeLists.txt	2013-03-24 13:02:01 UTC (rev 9561)
+++ code/branches/core6/src/libraries/core/object/CMakeLists.txt	2013-03-24 15:16:01 UTC (rev 9562)
@@ -1,5 +1,6 @@
 ADD_SOURCE_FILES(CORE_SRC_FILES
   Context.cc
+  ContextObject.cc
   MetaObjectList.cc
   ObjectListBase.cc
 )

Modified: code/branches/core6/src/libraries/core/object/Context.cc
===================================================================
--- code/branches/core6/src/libraries/core/object/Context.cc	2013-03-24 13:02:01 UTC (rev 9561)
+++ code/branches/core6/src/libraries/core/object/Context.cc	2013-03-24 15:16:01 UTC (rev 9562)
@@ -36,7 +36,7 @@
 
 namespace orxonox
 {
-    Context::Context(Context* context) : OrxonoxClass(this), parentContext_(context)
+    Context::Context(Context* context) : ContextObject(this), parentContext_(context)
     {
         RegisterRootObject(Context);
     }

Modified: code/branches/core6/src/libraries/core/object/Context.h
===================================================================
--- code/branches/core6/src/libraries/core/object/Context.h	2013-03-24 13:02:01 UTC (rev 9561)
+++ code/branches/core6/src/libraries/core/object/Context.h	2013-03-24 15:16:01 UTC (rev 9562)
@@ -36,11 +36,11 @@
 
 #include "core/CorePrereqs.h"
 
-#include "core/OrxonoxClass.h"
+#include "ContextObject.h"
 
 namespace orxonox
 {
-    class _CoreExport Context : virtual public OrxonoxClass
+    class _CoreExport Context : public ContextObject
     {
         public:
             Context(Context* context);

Added: code/branches/core6/src/libraries/core/object/ContextObject.cc
===================================================================
--- code/branches/core6/src/libraries/core/object/ContextObject.cc	                        (rev 0)
+++ code/branches/core6/src/libraries/core/object/ContextObject.cc	2013-03-24 15:16:01 UTC (rev 9562)
@@ -0,0 +1,50 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of ContextObject.
+*/
+
+#include "ContextObject.h"
+
+#include <cassert>
+#include "core/CoreIncludes.h"
+#include "Context.h"
+
+namespace orxonox
+{
+    ContextObject::ContextObject(Context* context) : context_(context)
+    {
+        RegisterRootObject(ContextObject);
+
+        //assert(context);
+        if (!this->context_)
+            this->context_ = Context::getRootContext();
+    }
+}


Property changes on: code/branches/core6/src/libraries/core/object/ContextObject.cc
___________________________________________________________________
Added: svn:eol-style
   + native

Added: code/branches/core6/src/libraries/core/object/ContextObject.h
===================================================================
--- code/branches/core6/src/libraries/core/object/ContextObject.h	                        (rev 0)
+++ code/branches/core6/src/libraries/core/object/ContextObject.h	2013-03-24 15:16:01 UTC (rev 9562)
@@ -0,0 +1,56 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @ingroup Object
+*/
+
+#ifndef _ContextObject_H__
+#define _ContextObject_H__
+
+#include "core/CorePrereqs.h"
+
+#include "core/OrxonoxClass.h"
+
+namespace orxonox
+{
+    class _CoreExport ContextObject : virtual public OrxonoxClass
+    {
+        public:
+            ContextObject(Context* context);
+
+            /// Returns the object's Context.
+            inline Context* getContext() const { return this->context_; }
+
+        private:
+            Context* context_; //!< The object's context
+    };
+}
+
+#endif /* _ContextObject_H__ */


Property changes on: code/branches/core6/src/libraries/core/object/ContextObject.h
___________________________________________________________________
Added: svn:eol-style
   + native




More information about the Orxonox-commit mailing list