Index: code/trunk/src/CMakeLists.txt
===================================================================
--- code/trunk/src/CMakeLists.txt	(revision 250)
+++ code/trunk/src/CMakeLists.txt	(revision 258)
@@ -2,7 +2,6 @@
 
 # create a few variables to simplify life
-
-SET(SRC_FILES orxonox.cc loader/LevelLoader.cc xml/xmlParser.cc)
-SET(INC_FILES loader/LevelLoader.h xml/xmlParser.h)
+SET(SRC_FILES orxonox/orxonox.cc loader/LevelLoader.cc xml/xmlParser.cc orxonox/core/IdentifierList.cc orxonox/core/Identifier.cc orxonox/core/MetaObjectList.cc orxonox/core/Factory.cc orxonox/core/OrxonoxClass.cc orxonox/objects/BaseObject.cc orxonox/objects/test1.cc orxonox/objects/test2.cc orxonox/objects/test3.cc)
+SET(INC_FILES loader/LevelLoader.h xml/xmlParser.h orxonox/core/IdentifierIncludes.h orxonox/core/Identifier.h orxonox/core/Factory.h orxonox/core/ClassFactory.h orxonox/core/IdentifierList.h orxonox/core/ObjectList.h orxonox/core/MetaObjectList.h orxonox/core/Iterator.h orxonox/core/OrxonoxClass.h orxonox/objects/BaseObject.h orxonox/objects/Test.h orxonox/objects/test1.h orxonox/objects/test2.h orxonox/objects/test3.h)
 
 #Creates an executable
Index: code/trunk/src/orxonox.cc
===================================================================
--- code/trunk/src/orxonox.cc	(revision 250)
+++ 	(revision )
@@ -1,277 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- *   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 3 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, see <http://www.gnu.org/licenses/>.
- *
- *
- *   Author:
- *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
- *   Co-authors:
- *      ...
- *
- */
-
-/**
- @file  orxonox.cc
- @brief Orxonox Main File
- */
-
-#include <Ogre.h>
-#include <OIS/OIS.h>
-#include <CEGUI/CEGUI.h>
-#include <OgreCEGUIRenderer.h>
-
-#include <string>
-#include <iostream>
-
-#include "xml/xmlParser.h"
-#include "loader/LevelLoader.h"
-
-
-// some tests to see if enet works without includsion
-//#include <enet/enet.h>
-//#include <enet/protocol.h>
-
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
-#include <CoreFoundation/CoreFoundation.h>
-
-// This function will locate the path to our application on OS X,
-// unlike windows you can not rely on the curent working directory
-// for locating your configuration files and resources.
-std::string macBundlePath()
-{
-  char path[1024];
-  CFBundleRef mainBundle = CFBundleGetMainBundle();
-  assert(mainBundle);
-
-  CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
-  assert(mainBundleURL);
-
-  CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
-  assert(cfStringRef);
-
-  CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);
-
-  CFRelease(mainBundleURL);
-  CFRelease(cfStringRef);
-
-  return std::string(path);
-}
-#endif
-
-using namespace Ogre;
-
-class OrxExitListener : public FrameListener
-{
-  public:
-    OrxExitListener(OIS::Keyboard *keyboard)
-  : mKeyboard(keyboard)
-    {
-    }
-
-    bool frameStarted(const FrameEvent& evt)
-    {
-      mKeyboard->capture();
-      return !mKeyboard->isKeyDown(OIS::KC_ESCAPE);
-    }
-
-  private:
-    OIS::Keyboard *mKeyboard;
-};
-
-class OrxApplication
-{
-  public:
-    void go()
-    {
-      createRoot();
-      defineResources();
-      setupRenderSystem();
-      createRenderWindow();
-      initializeResourceGroups();
-      createScene();
-      setupScene();
-      setupInputSystem();
-      setupCEGUI();
-      createFrameListener();
-      startRenderLoop();
-    }
-
-    ~OrxApplication()
-    {
-      mInputManager->destroyInputObject(mKeyboard);
-      OIS::InputManager::destroyInputSystem(mInputManager);
-
-//       delete mRenderer;
-//       delete mSystem;
-
-      delete mListener;
-      delete mRoot;
-    }
-
-  private:
-    Root *mRoot;
-    OIS::Keyboard *mKeyboard;
-    OIS::Mouse *mMouse;
-    OIS::InputManager *mInputManager;
-    CEGUI::OgreCEGUIRenderer *mRenderer;
-    CEGUI::System *mSystem;
-    OrxExitListener *mListener;
-
-    void createRoot()
-    {
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
-      mRoot = new Root(macBundlePath() + "/Contents/Resources/plugins.cfg");
-#else
-      mRoot = new Root();
-#endif
-    }
-
-    void defineResources()
-    {
-      String secName, typeName, archName;
-      ConfigFile cf;
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
-      cf.load(macBundlePath() + "/Contents/Resources/resources.cfg");
-#else
-      cf.load("resources.cfg");
-#endif
-
-      ConfigFile::SectionIterator seci = cf.getSectionIterator();
-      while (seci.hasMoreElements())
-      {
-        secName = seci.peekNextKey();
-        ConfigFile::SettingsMultiMap *settings = seci.getNext();
-        ConfigFile::SettingsMultiMap::iterator i;
-        for (i = settings->begin(); i != settings->end(); ++i)
-        {
-          typeName = i->first;
-          archName = i->second;
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
-          ResourceGroupManager::getSingleton().addResourceLocation( String(macBundlePath() + "/" + archName), typeName, secName);
-#else
-          ResourceGroupManager::getSingleton().addResourceLocation( archName, typeName, secName);
-#endif
-        }
-      }
-    }
-
-    void setupRenderSystem()
-    {
-      if (!mRoot->restoreConfig() && !mRoot->showConfigDialog())
-        throw Exception(52, "User canceled the config dialog!", "OrxApplication::setupRenderSystem()");
-    }
-
-    void createRenderWindow()
-    {
-      mRoot->initialise(true, "Ogre Render Window");
-    }
-
-    void initializeResourceGroups()
-    {
-      TextureManager::getSingleton().setDefaultNumMipmaps(5);
-      ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
-    }
-
-    void createScene(void)
-    {
-
-      string levelFile = "sp_level_moonstation.oxw";
-      loader::LevelLoader* loader = new loader::LevelLoader(levelFile);
-    }
-    
-    void setupScene()
-    {
-      SceneManager *mgr = mRoot->createSceneManager(ST_GENERIC, "Default SceneManager");
-      Camera *cam = mgr->createCamera("Camera");
-      Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam);
-    }
-
-    void setupInputSystem()
-    {
-      size_t windowHnd = 0;
-      std::ostringstream windowHndStr;
-      OIS::ParamList pl;
-      RenderWindow *win = mRoot->getAutoCreatedWindow();
-
-      win->getCustomAttribute("WINDOW", &windowHnd);
-      windowHndStr << windowHnd;
-      pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
-      mInputManager = OIS::InputManager::createInputSystem(pl);
-
-      try
-      {
-        mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, false));
-        mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject(OIS::OISMouse, false));
-      }
-      catch (const OIS::Exception &e)
-      {
-        throw new Exception(42, e.eText, "OrxApplication::setupInputSystem");
-      }
-    }
-
-    void setupCEGUI()
-    {
-      SceneManager *mgr = mRoot->getSceneManager("Default SceneManager");
-      RenderWindow *win = mRoot->getAutoCreatedWindow();
-
-      // CEGUI setup
-//       mRenderer = new CEGUI::OgreCEGUIRenderer(win, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mgr);
-//       mSystem = new CEGUI::System(mRenderer);
-
-      // Other CEGUI setup here.
-    }
-
-    void createFrameListener()
-    {
-      mListener = new OrxExitListener(mKeyboard);
-      mRoot->addFrameListener(mListener);
-    }
-
-    void startRenderLoop()
-    {
-      mRoot->startRendering();
-    }
-};
-
-#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
-#define WIN32_LEAN_AND_MEAN
-#include "windows.h"
-
-             INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
-#else
-             int main(int argc, char **argv)
-#endif
-{
-  try
-  {
-    OrxApplication orxonox;
-    orxonox.go();
-  }
-  catch(Exception& e)
-  {
-#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
-    MessageBoxA(NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
-#else
-    fprintf(stderr, "An exception has occurred: %s\n",
-            e.getFullDescription().c_str());
-#endif
-  }
-
-  return 0;
-}
-
Index: code/trunk/src/orxonox/core/ClassFactory.h
===================================================================
--- code/trunk/src/orxonox/core/ClassFactory.h	(revision 258)
+++ code/trunk/src/orxonox/core/ClassFactory.h	(revision 258)
@@ -0,0 +1,55 @@
+#ifndef _ClassFactory_H__
+#define _ClassFactory_H__
+
+#include "Identifier.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###      ClassFactory       ###
+    // ###############################
+    template <class T>
+    class ClassFactory : public BaseFactory
+    {
+        public:
+            static bool create();
+            BaseObject* fabricate();
+
+        private:
+            ClassFactory() {}
+            ClassFactory(const ClassFactory& factory) {}
+            ~ClassFactory() {}
+
+            static T* createNewObject();
+    };
+
+    template <class T>
+    bool ClassFactory<T>::create()
+    {
+        ClassIdentifier<T>::getIdentifier()->addFactory(new ClassFactory<T>);
+
+        ClassIdentifier<T>::getIdentifier()->startCreatingHierarchy();
+#if HIERARCHY_VERBOSE
+        std::cout << "*** Create Factory -> Create Class\n";
+#endif
+        BaseObject* temp = ClassIdentifier<T>::getIdentifier()->fabricate();
+        delete temp;
+        ClassIdentifier<T>::getIdentifier()->stopCreatingHierarchy();
+
+        return true;
+    }
+
+    template <class T>
+    BaseObject* ClassFactory<T>::fabricate()
+    {
+        return ClassFactory<T>::createNewObject();
+    }
+
+    template <class T>
+    T* ClassFactory<T>::createNewObject()
+    {
+        return new T;
+    }
+}
+
+#endif
Index: code/trunk/src/orxonox/core/Factory.cc
===================================================================
--- code/trunk/src/orxonox/core/Factory.cc	(revision 258)
+++ code/trunk/src/orxonox/core/Factory.cc	(revision 258)
@@ -0,0 +1,23 @@
+#include "Factory.h"
+#include "Identifier.h"
+
+namespace orxonox
+{
+    Factory* Factory::pointer_s = NULL;
+
+    Identifier* Factory::getIdentifier(const std::string& name)
+    {
+        if (!pointer_s)
+            pointer_s = new Factory;
+
+        return pointer_s->identifierMap_[name];
+    }
+
+    void Factory::add(const std::string& name, Identifier* identifier)
+    {
+        if (!pointer_s)
+            pointer_s = new Factory;
+
+        pointer_s->identifierMap_[name] = identifier;
+    }
+}
Index: code/trunk/src/orxonox/core/Factory.h
===================================================================
--- code/trunk/src/orxonox/core/Factory.h	(revision 258)
+++ code/trunk/src/orxonox/core/Factory.h	(revision 258)
@@ -0,0 +1,40 @@
+#ifndef _Factory_H__
+#define _Factory_H__
+
+#include <map>
+#include <string>
+
+namespace orxonox
+{
+    class BaseObject;
+    class Identifier;
+
+    // ###############################
+    // ###         Factory         ###
+    // ###############################
+    class Factory
+    {
+        public:
+            static Identifier* getIdentifier(const std::string& name);
+            static void add(const std::string& name, Identifier* identifier);
+
+        private:
+            Factory() {}
+            Factory(const Factory& factory) {}
+            ~Factory() {}
+
+            static Factory* pointer_s;
+            std::map<std::string, Identifier*> identifierMap_;
+    };
+
+    // ###############################
+    // ###       BaseFactory       ###
+    // ###############################
+    class BaseFactory
+    {
+        public:
+            virtual BaseObject* fabricate() = 0;
+    };
+}
+
+#endif
Index: code/trunk/src/orxonox/core/Identifier.cc
===================================================================
--- code/trunk/src/orxonox/core/Identifier.cc	(revision 258)
+++ code/trunk/src/orxonox/core/Identifier.cc	(revision 258)
@@ -0,0 +1,78 @@
+#include "Identifier.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###       Identifier        ###
+    // ###############################
+    int Identifier::hierarchyCreatingCounter_s = 0;
+
+    Identifier::Identifier()
+    {
+        this->bCreatedOneObject_ = false;
+        this->factory_ = 0;
+
+        this->children_ = new IdentifierList;
+    }
+
+    Identifier::~Identifier()
+    {
+        delete &this->name_;
+
+        delete this->children_;
+    }
+
+    void Identifier::initialize(const IdentifierList* parents)
+    {
+#if HIERARCHY_VERBOSE
+        std::cout << "*** Initialize " << this->name_ << "-Singleton.\n";
+#endif
+        this->bCreatedOneObject_ = true;
+
+        if (parents)
+        {
+            IdentifierListElement* temp1 = parents->first_;
+            while (temp1)
+            {
+                this->parents_.add(temp1->identifier_);
+                temp1->identifier_->getChildren().add(this);
+
+                temp1 = temp1->next_;
+            }
+        }
+    }
+
+    BaseObject* Identifier::fabricate()
+    {
+        if (this->factory_)
+        {
+            return this->factory_->fabricate();
+        }
+        else
+        {
+            std::cout << "Error: Cannot create an object of type '" << this->name_ << "'. Class is abstract.\n";
+            std::cout << "Aborting...";
+            abort();
+        }
+    }
+
+    bool Identifier::isA(const Identifier* identifier) const
+    {
+        return (identifier == this || this->parents_.isInList(identifier));
+    }
+
+    bool Identifier::isDirectlyA(const Identifier* identifier) const
+    {
+        return (identifier == this);
+    }
+
+    bool Identifier::isChildOf(const Identifier* identifier) const
+    {
+        return this->parents_.isInList(identifier);
+    }
+
+    bool Identifier::isParentOf(const Identifier* identifier) const
+    {
+        return this->children_->isInList(identifier);
+    }
+}
Index: code/trunk/src/orxonox/core/Identifier.h
===================================================================
--- code/trunk/src/orxonox/core/Identifier.h	(revision 258)
+++ code/trunk/src/orxonox/core/Identifier.h	(revision 258)
@@ -0,0 +1,249 @@
+#ifndef _Identifier_H__
+#define _Identifier_H__
+
+#include <iostream>
+
+#include "IdentifierList.h"
+#include "ObjectList.h"
+#include "Factory.h"
+
+#define HIERARCHY_VERBOSE false
+
+
+namespace orxonox
+{
+    class BaseObject;
+
+    // ###############################
+    // ###       Identifier        ###
+    // ###############################
+    class Identifier
+    {
+        template <class T>
+        friend class ClassIdentifier;
+
+        template <class T>
+        friend class SubclassIdentifier;
+
+        template <class T>
+        friend class ClassFactory;
+
+        public:
+            inline void addFactory(BaseFactory* factory) { this->factory_ = factory; }
+            BaseObject* fabricate();
+
+            bool isA(const Identifier* identifier) const;
+            bool isDirectlyA(const Identifier* identifier) const;
+            bool isChildOf(const Identifier* identifier) const;
+            bool isParentOf(const Identifier* identifier) const;
+
+            inline const std::string& getName() const { return this->name_; }
+            inline const IdentifierList& getParents() const { return this->parents_; }
+            inline IdentifierList& getChildren() const { return *this->children_; }
+
+            inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); }
+
+        private:
+            Identifier();
+            Identifier(const Identifier& identifier) {}
+            virtual ~Identifier();
+            void initialize(const IdentifierList* parents);
+
+            inline static void startCreatingHierarchy()
+            {
+                hierarchyCreatingCounter_s++;
+#if HIERARCHY_VERBOSE
+                std::cout << "*** Increased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << "\n";
+#endif
+            }
+
+            inline static void stopCreatingHierarchy()
+            {
+                hierarchyCreatingCounter_s--;
+#if HIERARCHY_VERBOSE
+                std::cout << "*** Decreased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << "\n";
+#endif
+            }
+
+            IdentifierList parents_;
+            IdentifierList* children_;
+
+            std::string name_;
+
+            BaseFactory* factory_;
+            bool bCreatedOneObject_;
+            static int hierarchyCreatingCounter_s;
+    };
+
+
+    // ###############################
+    // ###     ClassIdentifier     ###
+    // ###############################
+    template <class T>
+    class ClassIdentifier : public Identifier
+    {
+        public:
+            static ClassIdentifier<T>* registerClass(const IdentifierList* parents, const std::string& name, bool bRootClass);
+            static ClassIdentifier<T>* getIdentifier();
+            static void addObject(T* object);
+
+        private:
+            ClassIdentifier();
+            ClassIdentifier(const ClassIdentifier<T>& identifier) {}
+            ~ClassIdentifier();
+
+            static ClassIdentifier<T>* pointer_s;
+            ObjectList<T>* objects_;
+    };
+
+    template <class T>
+    ClassIdentifier<T>* ClassIdentifier<T>::pointer_s = NULL;
+
+    template <class T>
+    ClassIdentifier<T>::ClassIdentifier()
+    {
+        this->objects_ = new ObjectList<T>;
+    }
+
+    template <class T>
+    ClassIdentifier<T>::~ClassIdentifier()
+    {
+        delete this->objects_;
+        this->pointer_s = NULL;
+    }
+
+    template <class T>
+    ClassIdentifier<T>* ClassIdentifier<T>::registerClass(const IdentifierList* parents, const std::string& name, bool bRootClass)
+    {
+#if HIERARCHY_VERBOSE
+        std::cout << "*** Register Class in " << name << "-Singleton.\n";
+#endif
+        if (!pointer_s)
+        {
+#if HIERARCHY_VERBOSE
+            std::cout << "*** Register Class in " << name << "-Singleton -> Create Singleton.\n";
+#endif
+            pointer_s = new ClassIdentifier();
+        }
+
+        if (!pointer_s->bCreatedOneObject_)
+        {
+#if HIERARCHY_VERBOSE
+            std::cout << "*** Register Class in " << name << "-Singleton -> Initialize Singleton.\n";
+#endif
+            pointer_s->name_ = name;
+            Factory::add(name, pointer_s);
+
+            if (bRootClass)
+                pointer_s->initialize(NULL);
+            else
+                pointer_s->initialize(parents);
+        }
+
+        return pointer_s;
+    }
+
+    template <class T>
+    ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier()
+    {
+        if (!pointer_s)
+        {
+#if HIERARCHY_VERBOSE
+            std::cout << "*** Create Singleton.\n";
+#endif
+            pointer_s = new ClassIdentifier();
+        }
+
+        return pointer_s;
+    }
+
+    template <class T>
+    void ClassIdentifier<T>::addObject(T* object)
+    {
+#if HIERARCHY_VERBOSE
+        std::cout << "*** Added object to " << ClassIdentifier<T>::getIdentifier()->getName() << "-list.\n";
+#endif
+        object->getMetaList()->add(ClassIdentifier<T>::getIdentifier()->objects_, ClassIdentifier<T>::getIdentifier()->objects_->add(object));
+    }
+
+
+    // ###############################
+    // ###   SubclassIdentifier    ###
+    // ###############################
+    template <class B>
+    class SubclassIdentifier
+    {
+        public:
+            SubclassIdentifier();
+
+            SubclassIdentifier<B>& operator=(Identifier* identifier)
+            {
+                if (!identifier->isA(ClassIdentifier<B>::getIdentifier()))
+                {
+                    std::cout << "Error: Class " << identifier->getName() << " is not a " << ClassIdentifier<B>::getIdentifier()->getName() << "!\n";
+                    std::cout << "Error: SubclassIdentifier<" << ClassIdentifier<B>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden.\n";
+                    std::cout << "Aborting...\n";
+                    abort();
+                }
+                this->identifier_ = identifier;
+                return *this;
+            }
+
+            Identifier* operator*()
+            {
+                return this->identifier_;
+            }
+
+            Identifier* operator->() const
+            {
+                return this->identifier_;
+            }
+
+            B* fabricate()
+            {
+                BaseObject* newObject = this->identifier_->fabricate();
+                if (newObject)
+                {
+                    return dynamic_cast<B*>(newObject);
+                }
+                else
+                {
+                    if (this->identifier_)
+                    {
+                        std::cout << "Error: Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<B>::getIdentifier()->getName() << "!\n";
+                        std::cout << "Error: Couldn't fabricate a new Object.\n";
+                        std::cout << "Aborting...\n";
+                    }
+                    else
+                    {
+                        std::cout << "Error: Couldn't fabricate a new Object - Identifier is undefined.\n";
+                        std::cout << "Aborting...\n";
+                    }
+
+                    abort();
+                }
+            }
+
+            inline const Identifier* getIdentifier() const
+                { return this->identifier_; }
+            inline bool isA(const Identifier* identifier) const
+                { return this->identifier_->isA(identifier); }
+            inline bool isDirectlyA(const Identifier* identifier) const
+                { return this->identifier_->isDirectlyA(identifier); }
+            inline bool isChildOf(const Identifier* identifier) const
+                { return this->identifier_->isChildOf(identifier); }
+            inline bool isParentOf(const Identifier* identifier) const
+                { return this->identifier_->isParentOf(identifier); }
+
+        private:
+            Identifier* identifier_;
+    };
+
+    template <class B>
+    SubclassIdentifier<B>::SubclassIdentifier()
+    {
+        this->identifier_ = ClassIdentifier<B>::getIdentifier();
+    }
+}
+
+#endif
Index: code/trunk/src/orxonox/core/IdentifierIncludes.h
===================================================================
--- code/trunk/src/orxonox/core/IdentifierIncludes.h	(revision 258)
+++ code/trunk/src/orxonox/core/IdentifierIncludes.h	(revision 258)
@@ -0,0 +1,44 @@
+#include "Identifier.h"
+#include "Factory.h"
+#include "ClassFactory.h"
+#include "Iterator.h"
+#include "OrxonoxClass.h"
+
+
+#define InternRegisterObject(ClassName, bRootClass) \
+    this->setIdentifier(ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, bRootClass)); \
+    if (Identifier::isCreatingHierarchy() && this->getParents()) \
+        this->getParents()->add(this->getIdentifier()); \
+    ClassIdentifier<ClassName>::addObject(this)
+
+#define InternRegisterRootObject(ClassName) \
+    if (Identifier::isCreatingHierarchy() && !this->getParents()) \
+        this->setParents(new IdentifierList()); \
+    InternRegisterObject(ClassName, true)
+
+#if HIERARCHY_VERBOSE
+#define RegisterObject(ClassName) \
+    std::cout << "*** Register Object: " << #ClassName << "\n"; \
+    InternRegisterObject(ClassName, false)
+#else
+#define RegisterObject(ClassName) \
+    InternRegisterObject(ClassName, false)
+#endif
+
+#if HIERARCHY_VERBOSE
+#define RegisterRootObject(ClassName) \
+    std::cout << "*** Register Root-Object: " << #ClassName << "\n"; \
+    InternRegisterRootObject(ClassName)
+#else
+#define RegisterRootObject(ClassName) \
+    InternRegisterRootObject(ClassName)
+#endif
+
+#define Class(ClassName) \
+    ClassIdentifier<ClassName>::getIdentifier()
+
+#define CreateFactory(ClassName) \
+    bool bCreated##ClassName##Factory = ClassFactory<ClassName>::create()
+
+#define ID(Name) \
+    Factory::getIdentifier(Name)
Index: code/trunk/src/orxonox/core/IdentifierList.cc
===================================================================
--- code/trunk/src/orxonox/core/IdentifierList.cc	(revision 258)
+++ code/trunk/src/orxonox/core/IdentifierList.cc	(revision 258)
@@ -0,0 +1,105 @@
+#include "IdentifierList.h"
+#include "Identifier.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###     IdentifierList      ###
+    // ###############################
+    IdentifierList::IdentifierList()
+    {
+        this->first_ = 0;
+    }
+
+    IdentifierList::~IdentifierList()
+    {
+        IdentifierListElement* temp;
+        while (this->first_)
+        {
+            temp = this->first_->next_;
+            delete this->first_;
+            this->first_ = temp;
+        }
+    }
+
+    void IdentifierList::add(const Identifier* identifier)
+    {
+        IdentifierListElement* temp = this->first_;
+        this->first_ = new IdentifierListElement(identifier);
+        this->first_->next_ = temp;
+    }
+
+    void IdentifierList::remove(const Identifier* identifier)
+    {
+        if (!identifier)
+            return;
+
+        if (this->first_->identifier_ == identifier)
+        {
+            IdentifierListElement* temp = this->first_->next_;
+            delete this->first_;
+            this->first_ = temp;
+
+            return;
+        }
+
+        IdentifierListElement* temp = this->first_;
+        while (temp->next_)
+        {
+            if (temp->next_->identifier_ == identifier)
+            {
+                IdentifierListElement* temp2 = temp->next_->next_;
+                delete temp->next_;
+                temp->next_ = temp2;
+
+                return;
+            }
+
+            temp = temp->next_;
+        }
+    }
+
+    bool IdentifierList::isInList(const Identifier* identifier) const
+    {
+        IdentifierListElement* temp = this->first_;
+        while (temp)
+        {
+            if (temp->identifier_ == identifier)
+                return true;
+
+            temp = temp->next_;
+        }
+
+        return false;
+    }
+
+    std::string IdentifierList::toString() const
+    {
+        IdentifierListElement* temp = this->first_;
+        std::string output = "";
+
+        while (temp)
+        {
+            output += temp->identifier_->getName();
+            output += " ";
+
+            temp = temp->next_;
+        }
+
+        return output;
+    }
+
+
+    // ###############################
+    // ###  IdentifierListElement  ###
+    // ###############################
+    IdentifierListElement::IdentifierListElement(const Identifier* identifier)
+    {
+        this->identifier_ = identifier;
+        this->next_ = 0;
+    }
+
+    IdentifierListElement::~IdentifierListElement()
+    {
+    }
+}
Index: code/trunk/src/orxonox/core/IdentifierList.h
===================================================================
--- code/trunk/src/orxonox/core/IdentifierList.h	(revision 258)
+++ code/trunk/src/orxonox/core/IdentifierList.h	(revision 258)
@@ -0,0 +1,34 @@
+#ifndef _IdentifierList_H__
+#define _IdentifierList_H__
+
+#include <string>
+
+namespace orxonox
+{
+    class Identifier;
+
+    class IdentifierListElement
+    {
+        public:
+            IdentifierListElement(const Identifier* identifier);
+            ~IdentifierListElement();
+
+            const Identifier* identifier_;
+            IdentifierListElement* next_;
+    };
+
+    class IdentifierList
+    {
+        public:
+            IdentifierList();
+            ~IdentifierList();
+            void add(const Identifier* identifier);
+            void remove(const Identifier* identifier);
+            bool isInList(const Identifier* identifier) const;
+            std::string toString() const;
+
+            IdentifierListElement* first_;
+    };
+}
+
+#endif
Index: code/trunk/src/orxonox/core/Iterator.h
===================================================================
--- code/trunk/src/orxonox/core/Iterator.h	(revision 258)
+++ code/trunk/src/orxonox/core/Iterator.h	(revision 258)
@@ -0,0 +1,61 @@
+#ifndef _Iterator_H__
+#define _Iterator_H__
+
+namespace orxonox
+{
+    template <class T>
+    class Iterator
+    {
+        public:
+            Iterator()
+            {
+                this->element_ = 0;
+            }
+
+            Iterator(ObjectListElement<T>* element)
+            {
+                this->element_ = element;
+            }
+
+            Iterator<T> operator++()
+            {
+                this->element_ = this->element_->next_;
+                return *this;
+            }
+
+            Iterator<T> operator--()
+            {
+                this->element_ = this->element_->prev_;
+                return *this;
+            }
+
+            T* operator*()
+            {
+                return this->element_->object_;
+            }
+
+            T* operator->() const
+            {
+                return this->element_->object_;
+
+            }
+
+            operator bool()
+            {
+                return (this->element_ != 0);
+            }
+
+            bool operator!=(int compare)
+            {
+                if (compare != 0)
+                    std::cout << "Warning: Comparing the " << ClassIdentifier<T>::getIdentifier()->getName() << "-List-Iterator with " << compare << " has no effect. Only comparison with 0 works.\n";
+
+                return (this->element_ != 0);
+            }
+
+        private:
+            ObjectListElement<T>* element_;
+    };
+}
+
+#endif
Index: code/trunk/src/orxonox/core/MetaObjectList.cc
===================================================================
--- code/trunk/src/orxonox/core/MetaObjectList.cc	(revision 258)
+++ code/trunk/src/orxonox/core/MetaObjectList.cc	(revision 258)
@@ -0,0 +1,20 @@
+#include "MetaObjectList.h"
+
+namespace orxonox
+{
+    MetaObjectList::MetaObjectList()
+    {
+        this->first_ = 0;
+    }
+
+    MetaObjectList::~MetaObjectList()
+    {
+        BaseMetaObjectListElement* temp;
+        while (this->first_)
+        {
+            temp = this->first_->next_;
+            delete this->first_;
+            this->first_ = temp;
+        }
+    }
+}
Index: code/trunk/src/orxonox/core/MetaObjectList.h
===================================================================
--- code/trunk/src/orxonox/core/MetaObjectList.h	(revision 258)
+++ code/trunk/src/orxonox/core/MetaObjectList.h	(revision 258)
@@ -0,0 +1,83 @@
+#ifndef _MetaObjectList_H__
+#define _MetaObjectList_H__
+
+#include "ObjectList.h"
+#include "Identifier.h"
+
+namespace orxonox
+{
+    class BaseMetaObjectListElement
+    {
+        public:
+            virtual ~BaseMetaObjectListElement() {};
+
+            BaseMetaObjectListElement* next_;
+    };
+
+    // ###############################
+    // ###  MetaObjectListElement  ###
+    // ###############################
+    template <class T>
+    class MetaObjectListElement : public BaseMetaObjectListElement
+    {
+        public:
+            MetaObjectListElement(ObjectList<T>* list, ObjectListElement<T>* element);
+            ~MetaObjectListElement();
+
+            ObjectListElement<T>* element_;
+            ObjectList<T>* list_;
+    };
+
+    template <class T>
+    MetaObjectListElement<T>::MetaObjectListElement(ObjectList<T>* list, ObjectListElement<T>* element)
+    {
+        this->element_ = element;
+        this->list_ = list;
+        this->next_ = 0;
+    }
+
+    template <class T>
+    MetaObjectListElement<T>::~MetaObjectListElement()
+    {
+        if (this->element_->next_)
+            this->element_->next_->prev_ = this->element_->prev_;
+        else
+            this->list_->last_ = this->element_->prev_;
+
+        if (this->element_->prev_)
+            this->element_->prev_->next_ = this->element_->next_;
+        else
+            this->list_->first_ = this->element_->next_;
+
+
+#if HIERARCHY_VERBOSE
+        std::cout << "*** Removing Object from " << ClassIdentifier<T>::getIdentifier()->getName() << "-list.\n";
+#endif
+        delete this->element_;
+    }
+
+
+    // ###############################
+    // ###       ObjectList        ###
+    // ###############################
+    class MetaObjectList
+    {
+        public:
+            MetaObjectList();
+            ~MetaObjectList();
+            template <class T>
+            void add(ObjectList<T>* list, ObjectListElement<T>* element);
+
+            BaseMetaObjectListElement* first_;
+    };
+
+    template <class T>
+    void MetaObjectList::add(ObjectList<T>* list, ObjectListElement<T>* element)
+    {
+        BaseMetaObjectListElement* temp = this->first_;
+        this->first_ = new MetaObjectListElement<T>(list, element);
+        this->first_->next_ = temp;
+    }
+}
+
+#endif
Index: code/trunk/src/orxonox/core/ObjectList.h
===================================================================
--- code/trunk/src/orxonox/core/ObjectList.h	(revision 258)
+++ code/trunk/src/orxonox/core/ObjectList.h	(revision 258)
@@ -0,0 +1,190 @@
+#ifndef _ObjectList_H__
+#define _ObjectList_H__
+
+namespace orxonox
+{
+    class OrxonoxClass;
+
+    // ###############################
+    // ###    ObjectListElement    ###
+    // ###############################
+    template <class T>
+    class ObjectListElement
+    {
+        public:
+            ObjectListElement(T* object);
+            ~ObjectListElement();
+
+            T* object_;
+            ObjectListElement* next_;
+            ObjectListElement* prev_;
+    };
+
+    template <class T>
+    ObjectListElement<T>::ObjectListElement(T* object)
+    {
+        this->object_ = object;
+        this->next_ = 0;
+        this->prev_ = 0;
+    }
+
+    template <class T>
+    ObjectListElement<T>::~ObjectListElement()
+    {
+    }
+
+
+    // ###############################
+    // ###       ObjectList        ###
+    // ###############################
+    template <class T>
+    class Iterator;
+
+    template <class T>
+    class ObjectList
+    {
+        public:
+            ObjectList();
+            ~ObjectList();
+            ObjectListElement<T>* add(T* object);
+            void remove(OrxonoxClass* object, bool bIterateForwards = true);
+
+            inline static Iterator<T> start()
+                { return Iterator<T>(pointer_s->first_); }
+            inline static Iterator<T> end()
+                { return Iterator<T>(pointer_s->last_); }
+
+            ObjectListElement<T>* first_;
+            ObjectListElement<T>* last_;
+
+        private:
+            static ObjectList<T>* pointer_s;
+    };
+
+    template <class T>
+    ObjectList<T>* ObjectList<T>::pointer_s = 0;
+
+    template <class T>
+    ObjectList<T>::ObjectList()
+    {
+        this->first_ = 0;
+        this->last_ = 0;
+
+        this->pointer_s = this;
+    }
+
+    template <class T>
+    ObjectList<T>::~ObjectList()
+    {
+        ObjectListElement<T>* temp;
+        while (this->first_)
+        {
+            temp = this->first_->next_;
+            delete this->first_;
+            this->first_ = temp;
+        }
+    }
+
+    template <class T>
+    ObjectListElement<T>* ObjectList<T>::add(T* object)
+    {
+        if (!this->last_)
+        {
+            this->last_ = new ObjectListElement<T>(object);
+            this->first_ = this->last_;
+        }
+        else
+        {
+            ObjectListElement<T>* temp = this->last_;
+            this->last_ = new ObjectListElement<T>(object);
+            this->last_->prev_ = temp;
+            temp->next_ = this->last_;
+        }
+
+        return this->last_;
+    }
+
+    template <class T>
+    void ObjectList<T>::remove(OrxonoxClass* object, bool bIterateForwards)
+    {
+        if (!object || !this->first_ || !this->last_)
+            return;
+
+        if (this->first_ == this->last_)
+        {
+            if (this->first_->object_ == object)
+            {
+                delete this->first_;
+                this->first_ = 0;
+                this->last_ = 0;
+            }
+
+            return;
+        }
+
+        if (bIterateForwards)
+        {
+            if (this->first_->object_ == object)
+            {
+                ObjectListElement<T>* temp = this->first_->next_;
+                delete this->first_;
+                this->first_ = temp;
+                this->first_->prev_ = 0;
+
+                return;
+            }
+
+            ObjectListElement<T>* temp = this->first_;
+            while (temp->next_)
+            {
+                if (temp->next_->object_ == object)
+                {
+                    ObjectListElement<T>* temp2 = temp->next_->next_;
+                    delete temp->next_;
+                    temp->next_ = temp2;
+                    if (temp2)
+                        temp2->prev_ = temp;
+                    else
+                        this->last_ = temp;
+
+                    return;
+                }
+
+                temp = temp->next_;
+            }
+        }
+        else
+        {
+            if (this->last_->object_ == object)
+            {
+                ObjectListElement<T>* temp = this->last_->prev_;
+                delete this->last_;
+                this->last_ = temp;
+                this->last_->next_ = 0;
+
+                return;
+            }
+
+            ObjectListElement<T>* temp = this->last_;
+            while (temp->prev_)
+            {
+                if (temp->prev_->object_ == object)
+                {
+                    ObjectListElement<T>* temp2 = temp->prev_->prev_;
+                    delete temp->prev_;
+                    temp->prev_ = temp2;
+                    if (temp2)
+                        temp2->next_ = temp;
+                    else
+                        this->first_ = temp;
+
+                    return;
+                }
+
+                temp = temp->prev_;
+            }
+        }
+    }
+}
+
+#endif
Index: code/trunk/src/orxonox/core/OrxonoxClass.cc
===================================================================
--- code/trunk/src/orxonox/core/OrxonoxClass.cc	(revision 258)
+++ code/trunk/src/orxonox/core/OrxonoxClass.cc	(revision 258)
@@ -0,0 +1,20 @@
+#include "OrxonoxClass.h"
+
+namespace orxonox
+{
+    OrxonoxClass::OrxonoxClass()
+    {
+        this->identifier_ = 0;
+        this->parents_ = 0;
+
+        this->metaList_ = new MetaObjectList;
+    }
+
+    OrxonoxClass::~OrxonoxClass()
+    {
+        if (this->parents_)
+            delete this->parents_;
+
+        delete this->metaList_;
+    }
+}
Index: code/trunk/src/orxonox/core/OrxonoxClass.h
===================================================================
--- code/trunk/src/orxonox/core/OrxonoxClass.h	(revision 258)
+++ code/trunk/src/orxonox/core/OrxonoxClass.h	(revision 258)
@@ -0,0 +1,29 @@
+#ifndef _OrxonoxClass_H__
+#define _OrxonoxClass_H__
+
+#include "Identifier.h"
+#include "IdentifierList.h"
+#include "ObjectList.h"
+#include "MetaObjectList.h"
+
+namespace orxonox
+{
+    class OrxonoxClass
+    {
+        public:
+            OrxonoxClass();
+            virtual ~OrxonoxClass();
+            inline Identifier* getIdentifier() const { return this->identifier_; }
+            inline void setIdentifier(Identifier* identifier) { this->identifier_ = identifier; }
+            inline IdentifierList* getParents() const { return this->parents_; }
+            inline void setParents(IdentifierList* parents) { this->parents_ = parents; }
+            inline MetaObjectList* getMetaList() { return this->metaList_; }
+
+        private:
+            Identifier* identifier_;
+            IdentifierList* parents_;
+            MetaObjectList* metaList_;
+    };
+}
+
+#endif
Index: code/trunk/src/orxonox/objects/BaseObject.cc
===================================================================
--- code/trunk/src/orxonox/objects/BaseObject.cc	(revision 258)
+++ code/trunk/src/orxonox/objects/BaseObject.cc	(revision 258)
@@ -0,0 +1,15 @@
+#include "BaseObject.h"
+
+namespace orxonox
+{
+    CreateFactory(BaseObject);
+
+    BaseObject::BaseObject()
+    {
+        RegisterRootObject(BaseObject);
+    }
+
+    BaseObject::~BaseObject()
+    {
+    }
+}
Index: code/trunk/src/orxonox/objects/BaseObject.h
===================================================================
--- code/trunk/src/orxonox/objects/BaseObject.h	(revision 258)
+++ code/trunk/src/orxonox/objects/BaseObject.h	(revision 258)
@@ -0,0 +1,55 @@
+#ifndef _BaseObject_H__
+#define _BaseObject_H__
+
+#include "../core/IdentifierIncludes.h"
+
+namespace orxonox
+{
+    class BaseObject : virtual public OrxonoxClass
+    {
+        public:
+            BaseObject();
+            virtual ~BaseObject();
+
+            inline bool isA(const Identifier* identifier)
+                { this->getIdentifier()->isA(identifier); }
+            inline bool isDirectlyA(const Identifier* identifier)
+                { this->getIdentifier()->isDirectlyA(identifier); }
+            inline bool isChildOf(const Identifier* identifier)
+                { this->getIdentifier()->isChildOf(identifier); }
+            inline bool isParentOf(const Identifier* identifier)
+                { this->getIdentifier()->isParentOf(identifier); }
+
+            inline bool isA(const SubclassIdentifier<class B>* identifier)
+                { this->getIdentifier()->isA(identifier->getIdentifier()); }
+            inline bool isDirectlyA(const SubclassIdentifier<class B>* identifier)
+                { this->getIdentifier()->isDirectlyA(identifier->getIdentifier()); }
+            inline bool isChildOf(const SubclassIdentifier<class B>* identifier)
+                { this->getIdentifier()->isChildOf(identifier->getIdentifier()); }
+            inline bool isParentOf(const SubclassIdentifier<class B>* identifier)
+                { this->getIdentifier()->isParentOf(identifier->getIdentifier()); }
+
+            inline bool isA(const SubclassIdentifier<class B> identifier)
+                { this->getIdentifier()->isA(identifier.getIdentifier()); }
+            inline bool isDirectlyA(const SubclassIdentifier<class B> identifier)
+                { this->getIdentifier()->isDirectlyA(identifier.getIdentifier()); }
+            inline bool isChildOf(const SubclassIdentifier<class B> identifier)
+                { this->getIdentifier()->isChildOf(identifier.getIdentifier()); }
+            inline bool isParentOf(const SubclassIdentifier<class B> identifier)
+                { this->getIdentifier()->isParentOf(identifier.getIdentifier()); }
+
+            inline bool isA(const OrxonoxClass* object)
+                { this->getIdentifier()->isA(object->getIdentifier()); }
+            inline bool isDirectlyA(const OrxonoxClass* object)
+                { this->getIdentifier()->isDirectlyA(object->getIdentifier()); }
+            inline bool isChildOf(const OrxonoxClass* object)
+                { this->getIdentifier()->isChildOf(object->getIdentifier()); }
+            inline bool isParentOf(const OrxonoxClass* object)
+                { this->getIdentifier()->isParentOf(object->getIdentifier()); }
+
+            std::string name_; // test
+
+    };
+}
+
+#endif
Index: code/trunk/src/orxonox/objects/Test.h
===================================================================
--- code/trunk/src/orxonox/objects/Test.h	(revision 258)
+++ code/trunk/src/orxonox/objects/Test.h	(revision 258)
@@ -0,0 +1,149 @@
+#ifndef _Test_H__
+#define _Test_H__
+
+#include "BaseObject.h"
+#include "../core/IdentifierIncludes.h"
+
+namespace orxonox
+{
+    class Interface1 : virtual public OrxonoxClass
+    {
+        protected:
+            Interface1() { RegisterRootObject(Interface1); }
+    };
+
+    class Interface2 : virtual public OrxonoxClass
+    {
+        protected:
+            Interface2() { RegisterRootObject(Interface2); }
+    };
+
+    class A1 : public BaseObject
+    {
+        public:
+            A1() { RegisterObject(A1); }
+    };
+
+    class A2 : public BaseObject
+    {
+        public:
+            A2() { RegisterObject(A2); }
+    };
+
+    class A3: public BaseObject, public Interface1
+    {
+        public:
+            A3() { RegisterObject(A3); }
+    };
+
+    class A1B1 : public A1
+    {
+        public:
+            A1B1() { RegisterObject(A1B1); }
+    };
+
+    class A1B2 : public A1
+    {
+        public:
+            A1B2() { RegisterObject(A1B2); }
+    };
+
+    class A2B1 : public A2
+    {
+        public:
+            A2B1() { RegisterObject(A2B1); }
+    };
+
+    class A2B2 : public A2, Interface1
+    {
+        public:
+            A2B2() { RegisterObject(A2B2); }
+    };
+
+    class A3B1 : public A3
+    {
+        public:
+            A3B1() { RegisterObject(A3B1); }
+    };
+
+    class A3B2 : public A3, Interface2
+    {
+        public:
+            A3B2() { RegisterObject(A3B2); }
+    };
+
+    class A1B1C1 : public A1B1
+    {
+        public:
+            A1B1C1() { RegisterObject(A1B1C1); }
+    };
+
+    class A1B1C2 : public A1B1
+    {
+        public:
+            A1B1C2() { RegisterObject(A1B1C2); }
+    };
+
+    class A1B2C1 : public A1B2
+    {
+        public:
+            A1B2C1() { RegisterObject(A1B2C1); }
+    };
+
+    class A2B1C1 : public A2B1, Interface2
+    {
+        public:
+            A2B1C1() { RegisterObject(A2B1C1); }
+    };
+
+    class A2B2C1 : public A2B2
+    {
+        public:
+            A2B2C1() { RegisterObject(A2B2C1); }
+    };
+
+    class A3B1C1 : public A3B1
+    {
+        public:
+            A3B1C1() { RegisterObject(A3B1C1); }
+    };
+
+    class A3B1C2 : public A3B1, Interface2
+    {
+        public:
+            A3B1C2() { RegisterObject(A3B1C2); }
+    };
+
+    class A3B2C1 : public A3B2
+    {
+        public:
+            A3B2C1() { RegisterObject(A3B2C1); }
+    };
+
+    class A3B2C2 : public A3B2
+    {
+        public:
+            A3B2C2() { RegisterObject(A3B2C2); }
+    };
+
+    CreateFactory(A1);
+    CreateFactory(A2);
+    CreateFactory(A3);
+    CreateFactory(A1B1);
+    CreateFactory(A1B2);
+    CreateFactory(A2B1);
+    CreateFactory(A2B2);
+    CreateFactory(A3B1);
+    CreateFactory(A3B2);
+    CreateFactory(A1B1C1);
+    CreateFactory(A1B1C2);
+    CreateFactory(A1B2C1);
+    CreateFactory(A2B1C1);
+    CreateFactory(A2B2C1);
+    CreateFactory(A3B1C1);
+    CreateFactory(A3B1C2);
+    CreateFactory(A3B2C1);
+    CreateFactory(A3B2C2);
+}
+
+#endif
Index: code/trunk/src/orxonox/objects/test1.cc
===================================================================
--- code/trunk/src/orxonox/objects/test1.cc	(revision 258)
+++ code/trunk/src/orxonox/objects/test1.cc	(revision 258)
@@ -0,0 +1,63 @@
+#include "test1.h"
+#include "test2.h"
+#include "test3.h"
+
+namespace orxonox
+{
+    CreateFactory(Test1);
+
+    Test1::Test1()
+    {
+        RegisterObject(Test1);
+
+        this->usefullClass1_ = Class(Test1);
+        this->usefullClass2_ = Class(Test2);
+        this->usefullClass3_ = Class(Test3);
+    }
+
+    Test1::~Test1()
+    {
+    }
+
+    bool Test1::usefullClass1isA(Identifier* identifier)
+    {
+        return this->usefullClass1_->isA(identifier);
+    }
+
+    bool Test1::usefullClass2isA(Identifier* identifier)
+    {
+        return this->usefullClass2_->isA(identifier);
+    }
+
+    bool Test1::usefullClass3isA(Identifier* identifier)
+    {
+        return this->usefullClass3_.isA(identifier);
+    }
+
+    void Test1::setUsefullClass1(Identifier* identifier)
+    {
+        std::cout << "\n";
+        std::cout << "Test1: usefullClass1->isA(Class(Test1)): " << identifier->isA(Class(Test1)) << "\n";
+        std::cout << "Test1: usefullClass1->isA(Class(Test2)): " << identifier->isA(Class(Test2)) << "\n";
+        std::cout << "Test1: usefullClass1->isA(Class(Test3)): " << identifier->isA(Class(Test3)) << "\n";
+        this->usefullClass1_ = identifier;
+    }
+
+    void Test1::setUsefullClass2(Identifier* identifier)
+    {
+        std::cout << "\n";
+        std::cout << "Test1: usefullClass2->isA(Class(Test1)): " << identifier->isA(Class(Test1)) << "\n";
+        std::cout << "Test1: usefullClass2->isA(Class(Test2)): " << identifier->isA(Class(Test2)) << "\n";
+        std::cout << "Test1: usefullClass2->isA(Class(Test3)): " << identifier->isA(Class(Test3)) << "\n";
+        this->usefullClass2_ = identifier;
+    }
+
+    void Test1::setUsefullClassOfTypeTest3(Identifier* identifier)
+    {
+        std::cout << "\n";
+        std::cout << "Test1: usefullClass3->isA(Class(Test1)): " << identifier->isA(Class(Test1)) << "\n";
+        std::cout << "Test1: usefullClass3->isA(Class(Test2)): " << identifier->isA(Class(Test2)) << "\n";
+        std::cout << "Test1: usefullClass3->isA(Class(Test3)): " << identifier->isA(Class(Test3)) << "\n";
+        this->usefullClass3_ = identifier;
+    }
+}
Index: code/trunk/src/orxonox/objects/test1.h
===================================================================
--- code/trunk/src/orxonox/objects/test1.h	(revision 258)
+++ code/trunk/src/orxonox/objects/test1.h	(revision 258)
@@ -0,0 +1,30 @@
+#ifndef _Test1_H__
+#define _Test1_H__
+
+#include "BaseObject.h"
+#include "test3.h"
+
+namespace orxonox
+{
+    class Test1 : public BaseObject
+    {
+        public:
+            Test1();
+            virtual ~Test1();
+
+            bool usefullClass1isA(Identifier* identifier);
+            bool usefullClass2isA(Identifier* identifier);
+            bool usefullClass3isA(Identifier* identifier);
+            void setUsefullClass1(Identifier* identifier);
+            void setUsefullClass2(Identifier* identifier);
+            void setUsefullClassOfTypeTest3(Identifier* identifier);
+
+        private:
+            Identifier* usefullClass1_;
+            Identifier* usefullClass2_;
+            SubclassIdentifier<Test3> usefullClass3_;
+
+    };
+}
+
+#endif
Index: code/trunk/src/orxonox/objects/test2.cc
===================================================================
--- code/trunk/src/orxonox/objects/test2.cc	(revision 258)
+++ code/trunk/src/orxonox/objects/test2.cc	(revision 258)
@@ -0,0 +1,63 @@
+#include "test1.h"
+#include "test2.h"
+#include "test3.h"
+
+namespace orxonox
+{
+    CreateFactory(Test2);
+
+    Test2::Test2()
+    {
+        RegisterObject(Test2);
+
+        this->usefullClass1_ = Class(Test1);
+        this->usefullClass2_ = Class(Test2);
+        this->usefullClass3_ = Class(Test3);
+    }
+
+    Test2::~Test2()
+    {
+    }
+
+    bool Test2::usefullClass1isA(Identifier* identifier)
+    {
+        return this->usefullClass1_->isA(identifier);
+    }
+
+    bool Test2::usefullClass2isA(Identifier* identifier)
+    {
+        return this->usefullClass2_->isA(identifier);
+    }
+
+    bool Test2::usefullClass3isA(Identifier* identifier)
+    {
+        return this->usefullClass3_.isA(identifier);
+    }
+
+    void Test2::setUsefullClass1(Identifier* identifier)
+    {
+        std::cout << "\n";
+        std::cout << "Test2: usefullClass1->isA(Class(Test1)): " << identifier->isA(Class(Test1)) << "\n";
+        std::cout << "Test2: usefullClass1->isA(Class(Test2)): " << identifier->isA(Class(Test2)) << "\n";
+        std::cout << "Test2: usefullClass1->isA(Class(Test3)): " << identifier->isA(Class(Test3)) << "\n";
+        this->usefullClass1_ = identifier;
+    }
+
+    void Test2::setUsefullClass2(Identifier* identifier)
+    {
+        std::cout << "\n";
+        std::cout << "Test2: usefullClass2->isA(Class(Test1)): " << identifier->isA(Class(Test1)) << "\n";
+        std::cout << "Test2: usefullClass2->isA(Class(Test2)): " << identifier->isA(Class(Test2)) << "\n";
+        std::cout << "Test2: usefullClass2->isA(Class(Test3)): " << identifier->isA(Class(Test3)) << "\n";
+        this->usefullClass2_ = identifier;
+    }
+
+    void Test2::setUsefullClassOfTypeTest3(Identifier* identifier)
+    {
+        std::cout << "\n";
+        std::cout << "Test2: usefullClass3->isA(Class(Test1)): " << identifier->isA(Class(Test1)) << "\n";
+        std::cout << "Test2: usefullClass3->isA(Class(Test2)): " << identifier->isA(Class(Test2)) << "\n";
+        std::cout << "Test2: usefullClass3->isA(Class(Test3)): " << identifier->isA(Class(Test3)) << "\n";
+        this->usefullClass3_ = identifier;
+    }
+}
Index: code/trunk/src/orxonox/objects/test2.h
===================================================================
--- code/trunk/src/orxonox/objects/test2.h	(revision 258)
+++ code/trunk/src/orxonox/objects/test2.h	(revision 258)
@@ -0,0 +1,31 @@
+#ifndef _Test2_H__
+#define _Test2_H__
+
+#include "BaseObject.h"
+
+namespace orxonox
+{
+    class Test3;
+
+    class Test2 : public BaseObject
+    {
+        public:
+            Test2();
+            virtual ~Test2();
+
+            bool usefullClass1isA(Identifier* identifier);
+            bool usefullClass2isA(Identifier* identifier);
+            bool usefullClass3isA(Identifier* identifier);
+            void setUsefullClass1(Identifier* identifier);
+            void setUsefullClass2(Identifier* identifier);
+            void setUsefullClassOfTypeTest3(Identifier* identifier);
+
+        private:
+            Identifier* usefullClass1_;
+            Identifier* usefullClass2_;
+            SubclassIdentifier<Test3> usefullClass3_;
+
+    };
+}
+
+#endif
Index: code/trunk/src/orxonox/objects/test3.cc
===================================================================
--- code/trunk/src/orxonox/objects/test3.cc	(revision 258)
+++ code/trunk/src/orxonox/objects/test3.cc	(revision 258)
@@ -0,0 +1,53 @@
+#include "test1.h"
+#include "test2.h"
+#include "test3.h"
+
+namespace orxonox
+{
+    CreateFactory(Test3);
+
+    Test3::Test3()
+    {
+        RegisterObject(Test3);
+    }
+
+    Test3::~Test3()
+    {
+    }
+        #define testandcout(code) \
+          std::cout << #code << " " << code << "\n"
+
+    bool Test3::usefullClassesIsATest(Test1* test1)
+    {
+        std::cout << "\n";
+        std::cout << "Test1:\n";
+        testandcout(test1->usefullClass1isA(Class(Test1)));
+        testandcout(test1->usefullClass1isA(Class(Test2)));
+        testandcout(test1->usefullClass1isA(Class(Test3)));
+        std::cout << "\n";
+        testandcout(test1->usefullClass2isA(Class(Test1)));
+        testandcout(test1->usefullClass2isA(Class(Test2)));
+        testandcout(test1->usefullClass2isA(Class(Test3)));
+        std::cout << "\n";
+        testandcout(test1->usefullClass3isA(Class(Test1)));
+        testandcout(test1->usefullClass3isA(Class(Test2)));
+        testandcout(test1->usefullClass3isA(Class(Test3)));
+    }
+
+    bool Test3::usefullClassesIsATest(Test2* test2)
+    {
+        std::cout << "\n";
+        std::cout << "Test2:\n";
+        testandcout(test2->usefullClass1isA(Class(Test1)));
+        testandcout(test2->usefullClass1isA(Class(Test2)));
+        testandcout(test2->usefullClass1isA(Class(Test3)));
+        std::cout << "\n";
+        testandcout(test2->usefullClass2isA(Class(Test1)));
+        testandcout(test2->usefullClass2isA(Class(Test2)));
+        testandcout(test2->usefullClass2isA(Class(Test3)));
+        std::cout << "\n";
+        testandcout(test2->usefullClass3isA(Class(Test1)));
+        testandcout(test2->usefullClass3isA(Class(Test2)));
+        testandcout(test2->usefullClass3isA(Class(Test3)));
+    }
+}
Index: code/trunk/src/orxonox/objects/test3.h
===================================================================
--- code/trunk/src/orxonox/objects/test3.h	(revision 258)
+++ code/trunk/src/orxonox/objects/test3.h	(revision 258)
@@ -0,0 +1,22 @@
+#ifndef _Test3_H__
+#define _Test3_H__
+
+#include "BaseObject.h"
+
+namespace orxonox
+{
+    class Test1;
+    class Test2;
+
+    class Test3 : public BaseObject
+    {
+        public:
+            Test3();
+            virtual ~Test3();
+
+            bool usefullClassesIsATest(Test1* test1);
+            bool usefullClassesIsATest(Test2* test2);
+    };
+}
+
+#endif
Index: code/trunk/src/orxonox/orxonox.cc
===================================================================
--- code/trunk/src/orxonox/orxonox.cc	(revision 258)
+++ code/trunk/src/orxonox/orxonox.cc	(revision 258)
@@ -0,0 +1,277 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ @file  orxonox.cc
+ @brief Orxonox Main File
+ */
+
+#include <Ogre.h>
+#include <OIS/OIS.h>
+#include <CEGUI/CEGUI.h>
+#include <OgreCEGUIRenderer.h>
+
+#include <string>
+#include <iostream>
+
+#include "../xml/xmlParser.h"
+#include "../loader/LevelLoader.h"
+
+
+// some tests to see if enet works without includsion
+//#include <enet/enet.h>
+//#include <enet/protocol.h>
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+#include <CoreFoundation/CoreFoundation.h>
+
+// This function will locate the path to our application on OS X,
+// unlike windows you can not rely on the curent working directory
+// for locating your configuration files and resources.
+std::string macBundlePath()
+{
+  char path[1024];
+  CFBundleRef mainBundle = CFBundleGetMainBundle();
+  assert(mainBundle);
+
+  CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
+  assert(mainBundleURL);
+
+  CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
+  assert(cfStringRef);
+
+  CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);
+
+  CFRelease(mainBundleURL);
+  CFRelease(cfStringRef);
+
+  return std::string(path);
+}
+#endif
+
+using namespace Ogre;
+
+class OrxExitListener : public FrameListener
+{
+  public:
+    OrxExitListener(OIS::Keyboard *keyboard)
+  : mKeyboard(keyboard)
+    {
+    }
+
+    bool frameStarted(const FrameEvent& evt)
+    {
+      mKeyboard->capture();
+      return !mKeyboard->isKeyDown(OIS::KC_ESCAPE);
+    }
+
+  private:
+    OIS::Keyboard *mKeyboard;
+};
+
+class OrxApplication
+{
+  public:
+    void go()
+    {
+      createRoot();
+      defineResources();
+      setupRenderSystem();
+      createRenderWindow();
+      initializeResourceGroups();
+      createScene();
+      setupScene();
+      setupInputSystem();
+      setupCEGUI();
+      createFrameListener();
+      startRenderLoop();
+    }
+
+    ~OrxApplication()
+    {
+      mInputManager->destroyInputObject(mKeyboard);
+      OIS::InputManager::destroyInputSystem(mInputManager);
+
+//       delete mRenderer;
+//       delete mSystem;
+
+      delete mListener;
+      delete mRoot;
+    }
+
+  private:
+    Root *mRoot;
+    OIS::Keyboard *mKeyboard;
+    OIS::Mouse *mMouse;
+    OIS::InputManager *mInputManager;
+    CEGUI::OgreCEGUIRenderer *mRenderer;
+    CEGUI::System *mSystem;
+    OrxExitListener *mListener;
+
+    void createRoot()
+    {
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+      mRoot = new Root(macBundlePath() + "/Contents/Resources/plugins.cfg");
+#else
+      mRoot = new Root();
+#endif
+    }
+
+    void defineResources()
+    {
+      String secName, typeName, archName;
+      ConfigFile cf;
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+      cf.load(macBundlePath() + "/Contents/Resources/resources.cfg");
+#else
+      cf.load("resources.cfg");
+#endif
+
+      ConfigFile::SectionIterator seci = cf.getSectionIterator();
+      while (seci.hasMoreElements())
+      {
+        secName = seci.peekNextKey();
+        ConfigFile::SettingsMultiMap *settings = seci.getNext();
+        ConfigFile::SettingsMultiMap::iterator i;
+        for (i = settings->begin(); i != settings->end(); ++i)
+        {
+          typeName = i->first;
+          archName = i->second;
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+          ResourceGroupManager::getSingleton().addResourceLocation( String(macBundlePath() + "/" + archName), typeName, secName);
+#else
+          ResourceGroupManager::getSingleton().addResourceLocation( archName, typeName, secName);
+#endif
+        }
+      }
+    }
+
+    void setupRenderSystem()
+    {
+      if (!mRoot->restoreConfig() && !mRoot->showConfigDialog())
+        throw Exception(52, "User canceled the config dialog!", "OrxApplication::setupRenderSystem()");
+    }
+
+    void createRenderWindow()
+    {
+      mRoot->initialise(true, "Ogre Render Window");
+    }
+
+    void initializeResourceGroups()
+    {
+      TextureManager::getSingleton().setDefaultNumMipmaps(5);
+      ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+    }
+
+    void createScene(void)
+    {
+
+      string levelFile = "sp_level_moonstation.oxw";
+      loader::LevelLoader* loader = new loader::LevelLoader(levelFile);
+    }
+
+    void setupScene()
+    {
+      SceneManager *mgr = mRoot->createSceneManager(ST_GENERIC, "Default SceneManager");
+      Camera *cam = mgr->createCamera("Camera");
+      Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam);
+    }
+
+    void setupInputSystem()
+    {
+      size_t windowHnd = 0;
+      std::ostringstream windowHndStr;
+      OIS::ParamList pl;
+      RenderWindow *win = mRoot->getAutoCreatedWindow();
+
+      win->getCustomAttribute("WINDOW", &windowHnd);
+      windowHndStr << windowHnd;
+      pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
+      mInputManager = OIS::InputManager::createInputSystem(pl);
+
+      try
+      {
+        mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, false));
+        mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject(OIS::OISMouse, false));
+      }
+      catch (const OIS::Exception &e)
+      {
+        throw new Exception(42, e.eText, "OrxApplication::setupInputSystem");
+      }
+    }
+
+    void setupCEGUI()
+    {
+      SceneManager *mgr = mRoot->getSceneManager("Default SceneManager");
+      RenderWindow *win = mRoot->getAutoCreatedWindow();
+
+      // CEGUI setup
+//       mRenderer = new CEGUI::OgreCEGUIRenderer(win, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mgr);
+//       mSystem = new CEGUI::System(mRenderer);
+
+      // Other CEGUI setup here.
+    }
+
+    void createFrameListener()
+    {
+      mListener = new OrxExitListener(mKeyboard);
+      mRoot->addFrameListener(mListener);
+    }
+
+    void startRenderLoop()
+    {
+      mRoot->startRendering();
+    }
+};
+
+#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include "windows.h"
+
+             INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
+#else
+             int main(int argc, char **argv)
+#endif
+{
+  try
+  {
+    OrxApplication orxonox;
+    orxonox.go();
+  }
+  catch(Exception& e)
+  {
+#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+    MessageBoxA(NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
+#else
+    fprintf(stderr, "An exception has occurred: %s\n",
+            e.getFullDescription().c_str());
+#endif
+  }
+
+  return 0;
+}
+
