[Orxonox-commit 5871] r10531 - in code/branches/core7/src/libraries/core: . module
landauf at orxonox.net
landauf at orxonox.net
Sat Jun 6 15:56:40 CEST 2015
Author: landauf
Date: 2015-06-06 15:56:39 +0200 (Sat, 06 Jun 2015)
New Revision: 10531
Added:
code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.cc
code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.h
code/branches/core7/src/libraries/core/module/StaticInitializationHandler.cc
code/branches/core7/src/libraries/core/module/StaticInitializationHandler.h
code/branches/core7/src/libraries/core/module/StaticInitializationHandlerIncludes.cc
code/branches/core7/src/libraries/core/module/StaticInitializationHandlerIncludes.h
code/branches/core7/src/libraries/core/module/StaticInitializationManager.cc
code/branches/core7/src/libraries/core/module/StaticInitializationManager.h
Modified:
code/branches/core7/src/libraries/core/CMakeLists.txt
code/branches/core7/src/libraries/core/Core.cc
code/branches/core7/src/libraries/core/CorePrereqs.h
code/branches/core7/src/libraries/core/module/CMakeLists.txt
Log:
added draft for StaticInitializationHandler
Modified: code/branches/core7/src/libraries/core/CMakeLists.txt
===================================================================
--- code/branches/core7/src/libraries/core/CMakeLists.txt 2015-06-06 12:45:20 UTC (rev 10530)
+++ code/branches/core7/src/libraries/core/CMakeLists.txt 2015-06-06 13:56:39 UTC (rev 10531)
@@ -44,6 +44,7 @@
BaseObject.cc
Core.cc
CoreConfig.cc
+ CoreStaticInitializationHandler.cc
BUILD_UNIT OgreBuildUnit.cc
GraphicsManager.cc
Modified: code/branches/core7/src/libraries/core/Core.cc
===================================================================
--- code/branches/core7/src/libraries/core/Core.cc 2015-06-06 12:45:20 UTC (rev 10530)
+++ code/branches/core7/src/libraries/core/Core.cc 2015-06-06 13:56:39 UTC (rev 10531)
@@ -122,6 +122,7 @@
// Create a new dynamic library manager
this->dynLibManager_ = new DynLibManager();
+ // TODO: initialize StaticInitializationManager
// TODO: initialize Root-Context
// TODO: initialize IdentifierManager here
// TODO: initialize ScopeManager here
Modified: code/branches/core7/src/libraries/core/CorePrereqs.h
===================================================================
--- code/branches/core7/src/libraries/core/CorePrereqs.h 2015-06-06 12:45:20 UTC (rev 10530)
+++ code/branches/core7/src/libraries/core/CorePrereqs.h 2015-06-06 13:56:39 UTC (rev 10531)
@@ -206,6 +206,8 @@
template <class T>
class SmartPtr;
class StaticallyInitializedInstance;
+ class StaticInitializationHandler;
+ class StaticInitializationManager;
template <class T>
class SubclassIdentifier;
class Template;
Added: code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.cc
===================================================================
--- code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.cc (rev 0)
+++ code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.cc 2015-06-06 13:56:39 UTC (rev 10531)
@@ -0,0 +1,33 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+#include "CoreStaticInitializationHandler.h"
+
+namespace orxonox
+{
+}
Property changes on: code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.h
===================================================================
--- code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.h (rev 0)
+++ code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.h 2015-06-06 13:56:39 UTC (rev 10531)
@@ -0,0 +1,46 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+#ifndef _CoreStaticInitializationHandler_H__
+#define _CoreStaticInitializationHandler_H__
+
+#include "core/CorePrereqs.h"
+
+#include "module/StaticInitializationHandler.h"
+
+namespace orxonox
+{
+ class _CoreExport CoreStaticInitializationHandler : public StaticInitializationHandler
+ {
+ public:
+ CoreStaticInitializationHandler() {}
+ virtual ~CoreStaticInitializationHandler() {}
+ };
+}
+
+#endif /* _CoreStaticInitializationHandler_H__ */
Property changes on: code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/branches/core7/src/libraries/core/module/CMakeLists.txt
===================================================================
--- code/branches/core7/src/libraries/core/module/CMakeLists.txt 2015-06-06 12:45:20 UTC (rev 10530)
+++ code/branches/core7/src/libraries/core/module/CMakeLists.txt 2015-06-06 13:56:39 UTC (rev 10531)
@@ -1,4 +1,7 @@
ADD_SOURCE_FILES(CORE_SRC_FILES
ModuleInstance.cc
StaticallyInitializedInstance.cc
+ StaticInitializationHandler.cc
+ StaticInitializationHandlerIncludes.cc
+ StaticInitializationManager.cc
)
Added: code/branches/core7/src/libraries/core/module/StaticInitializationHandler.cc
===================================================================
--- code/branches/core7/src/libraries/core/module/StaticInitializationHandler.cc (rev 0)
+++ code/branches/core7/src/libraries/core/module/StaticInitializationHandler.cc 2015-06-06 13:56:39 UTC (rev 10531)
@@ -0,0 +1,33 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+#include "StaticInitializationHandler.h"
+
+namespace orxonox
+{
+}
Property changes on: code/branches/core7/src/libraries/core/module/StaticInitializationHandler.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/core7/src/libraries/core/module/StaticInitializationHandler.h
===================================================================
--- code/branches/core7/src/libraries/core/module/StaticInitializationHandler.h (rev 0)
+++ code/branches/core7/src/libraries/core/module/StaticInitializationHandler.h 2015-06-06 13:56:39 UTC (rev 10531)
@@ -0,0 +1,44 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+#ifndef _StaticInitializationHandler_H__
+#define _StaticInitializationHandler_H__
+
+#include "core/CorePrereqs.h"
+
+namespace orxonox
+{
+ class _CoreExport StaticInitializationHandler
+ {
+ public:
+ StaticInitializationHandler() {}
+ virtual ~StaticInitializationHandler() {}
+ };
+}
+
+#endif /* _StaticInitializationHandler_H__ */
Property changes on: code/branches/core7/src/libraries/core/module/StaticInitializationHandler.h
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/core7/src/libraries/core/module/StaticInitializationHandlerIncludes.cc
===================================================================
--- code/branches/core7/src/libraries/core/module/StaticInitializationHandlerIncludes.cc (rev 0)
+++ code/branches/core7/src/libraries/core/module/StaticInitializationHandlerIncludes.cc 2015-06-06 13:56:39 UTC (rev 10531)
@@ -0,0 +1,44 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+#include "StaticInitializationHandlerIncludes.h"
+
+#include "StaticInitializationManager.h"
+
+namespace orxonox
+{
+ void StaticallyInitializedStaticInitializationHandler::load()
+ {
+ StaticInitializationManager::getInstance().addHandler(this->handler_);
+ }
+
+ void StaticallyInitializedStaticInitializationHandler::unload()
+ {
+ StaticInitializationManager::getInstance().removeHandler(this->handler_);
+ }
+}
Property changes on: code/branches/core7/src/libraries/core/module/StaticInitializationHandlerIncludes.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/core7/src/libraries/core/module/StaticInitializationHandlerIncludes.h
===================================================================
--- code/branches/core7/src/libraries/core/module/StaticInitializationHandlerIncludes.h (rev 0)
+++ code/branches/core7/src/libraries/core/module/StaticInitializationHandlerIncludes.h 2015-06-06 13:56:39 UTC (rev 10531)
@@ -0,0 +1,68 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+#ifndef _StaticInitializationHandlerIncludes_H__
+#define _StaticInitializationHandlerIncludes_H__
+
+#include "core/CorePrereqs.h"
+
+#include "StaticInitializationHandler.h"
+#include "StaticallyInitializedInstance.h"
+
+/**
+ * Registers a StaticInitializationHandler
+ */
+#define RegisterStaticInitializationHandler(className) \
+ static StaticInitializationHandler& className##StaticInitializationHandler \
+ = (new orxonox::SI_SIH(new className()))->getHandler()
+
+namespace orxonox
+{
+ class _CoreExport StaticallyInitializedStaticInitializationHandler : public StaticallyInitializedInstance
+ {
+ public:
+ StaticallyInitializedStaticInitializationHandler(StaticInitializationHandler* handler)
+ : StaticallyInitializedInstance(0)
+ , handler_(handler)
+ {}
+ ~StaticallyInitializedStaticInitializationHandler() { delete handler_; }
+
+ virtual void load();
+ virtual void unload();
+
+ inline StaticInitializationHandler& getHandler()
+ { return *this->handler_; }
+
+ private:
+ StaticInitializationHandler* handler_;
+ };
+
+ typedef StaticallyInitializedStaticInitializationHandler SI_SIH;
+}
+
+#endif /* _StaticInitializationHandlerIncludes_H__ */
Property changes on: code/branches/core7/src/libraries/core/module/StaticInitializationHandlerIncludes.h
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/core7/src/libraries/core/module/StaticInitializationManager.cc
===================================================================
--- code/branches/core7/src/libraries/core/module/StaticInitializationManager.cc (rev 0)
+++ code/branches/core7/src/libraries/core/module/StaticInitializationManager.cc 2015-06-06 13:56:39 UTC (rev 10531)
@@ -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:
+ * ...
+ *
+ */
+
+#include "StaticInitializationManager.h"
+
+namespace orxonox
+{
+ /* static */ StaticInitializationManager& StaticInitializationManager::getInstance()
+ {
+ static StaticInitializationManager instance;
+ return instance;
+ }
+
+ void StaticInitializationManager::addHandler(StaticInitializationHandler* handler)
+ {
+ this->handlers_.push_back(handler);
+ }
+
+ void StaticInitializationManager::removeHandler(StaticInitializationHandler* handler)
+ {
+ this->handlers_.remove(handler);
+ }
+
+ void StaticInitializationManager::addCoreHandler()
+ {
+ // TODO
+ }
+}
Property changes on: code/branches/core7/src/libraries/core/module/StaticInitializationManager.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/core7/src/libraries/core/module/StaticInitializationManager.h
===================================================================
--- code/branches/core7/src/libraries/core/module/StaticInitializationManager.h (rev 0)
+++ code/branches/core7/src/libraries/core/module/StaticInitializationManager.h 2015-06-06 13:56:39 UTC (rev 10531)
@@ -0,0 +1,58 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+#ifndef _StaticInitializationManager_H__
+#define _StaticInitializationManager_H__
+
+#include "core/CorePrereqs.h"
+
+#include <list>
+
+namespace orxonox
+{
+ class _CoreExport StaticInitializationManager
+ {
+ friend class Core;
+
+ public:
+ static StaticInitializationManager& getInstance();
+
+ StaticInitializationManager() {}
+ virtual ~StaticInitializationManager() {}
+
+ void addHandler(StaticInitializationHandler* handler);
+ void removeHandler(StaticInitializationHandler* handler);
+
+ private:
+ void addCoreHandler();
+
+ std::list<StaticInitializationHandler*> handlers_;
+ };
+}
+
+#endif /* _StaticInitializationManager_H__ */
Property changes on: code/branches/core7/src/libraries/core/module/StaticInitializationManager.h
___________________________________________________________________
Added: svn:eol-style
+ native
More information about the Orxonox-commit
mailing list