[Orxonox-commit 4892] r9561 - in code/branches/core6/src/libraries/core: . object
landauf at orxonox.net
landauf at orxonox.net
Sun Mar 24 14:02:02 CET 2013
Author: landauf
Date: 2013-03-24 14:02:01 +0100 (Sun, 24 Mar 2013)
New Revision: 9561
Added:
code/branches/core6/src/libraries/core/object/Context.cc
code/branches/core6/src/libraries/core/object/Context.h
Modified:
code/branches/core6/src/libraries/core/CorePrereqs.h
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
Log:
OrxonoxClass now takes a 'Context' object as constructor argument. Not yet enforced nor used
Modified: code/branches/core6/src/libraries/core/CorePrereqs.h
===================================================================
--- code/branches/core6/src/libraries/core/CorePrereqs.h 2013-03-23 21:48:53 UTC (rev 9560)
+++ code/branches/core6/src/libraries/core/CorePrereqs.h 2013-03-24 13:02:01 UTC (rev 9561)
@@ -140,6 +140,7 @@
class ConfigFileManager;
class ConfigFileSection;
class ConfigValueContainer;
+ class Context;
class Core;
class DestructionListener;
class DynLib;
Modified: code/branches/core6/src/libraries/core/OrxonoxClass.cc
===================================================================
--- code/branches/core6/src/libraries/core/OrxonoxClass.cc 2013-03-23 21:48:53 UTC (rev 9560)
+++ code/branches/core6/src/libraries/core/OrxonoxClass.cc 2013-03-24 13:02:01 UTC (rev 9561)
@@ -35,6 +35,7 @@
#include <cassert>
#include "object/MetaObjectList.h"
+#include "object/Context.h"
#include "Identifier.h"
namespace orxonox
@@ -42,8 +43,12 @@
/**
@brief Constructor: Sets the default values.
*/
- OrxonoxClass::OrxonoxClass()
+ OrxonoxClass::OrxonoxClass(Context* context) : context_(context)
{
+ //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-23 21:48:53 UTC (rev 9560)
+++ code/branches/core6/src/libraries/core/OrxonoxClass.h 2013-03-24 13:02:01 UTC (rev 9561)
@@ -69,7 +69,7 @@
friend class DestructionListener;
public:
- OrxonoxClass();
+ OrxonoxClass(Context* context = NULL);
virtual ~OrxonoxClass();
void destroy();
@@ -81,6 +81,9 @@
/// 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);
@@ -166,6 +169,7 @@
{ 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-23 21:48:53 UTC (rev 9560)
+++ code/branches/core6/src/libraries/core/object/CMakeLists.txt 2013-03-24 13:02:01 UTC (rev 9561)
@@ -1,4 +1,5 @@
ADD_SOURCE_FILES(CORE_SRC_FILES
+ Context.cc
MetaObjectList.cc
ObjectListBase.cc
)
Added: code/branches/core6/src/libraries/core/object/Context.cc
===================================================================
--- code/branches/core6/src/libraries/core/object/Context.cc (rev 0)
+++ code/branches/core6/src/libraries/core/object/Context.cc 2013-03-24 13:02:01 UTC (rev 9561)
@@ -0,0 +1,53 @@
+/*
+ * 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 Context.
+*/
+
+#include "Context.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ Context::Context(Context* context) : OrxonoxClass(this), parentContext_(context)
+ {
+ RegisterRootObject(Context);
+ }
+
+ Context::~Context()
+ {
+ }
+
+ /*static*/ Context* Context::getRootContext()
+ {
+ static Context rootContext(NULL);
+ return &rootContext;
+ }
+}
Property changes on: code/branches/core6/src/libraries/core/object/Context.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/core6/src/libraries/core/object/Context.h
===================================================================
--- code/branches/core6/src/libraries/core/object/Context.h (rev 0)
+++ code/branches/core6/src/libraries/core/object/Context.h 2013-03-24 13:02:01 UTC (rev 9561)
@@ -0,0 +1,59 @@
+/*
+ * 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 _Context_H__
+#define _Context_H__
+
+#include "core/CorePrereqs.h"
+
+#include "core/OrxonoxClass.h"
+
+namespace orxonox
+{
+ class _CoreExport Context : virtual public OrxonoxClass
+ {
+ public:
+ Context(Context* context);
+ virtual ~Context();
+
+ inline Context* getParentContext() const
+ { return this->parentContext_; }
+
+ static Context* getRootContext();
+
+ private:
+ Context* parentContext_;
+ };
+}
+
+#endif /* _Context_H__ */
Property changes on: code/branches/core6/src/libraries/core/object/Context.h
___________________________________________________________________
Added: svn:eol-style
+ native
More information about the Orxonox-commit
mailing list