Index: code/branches/objecthierarchie/src/BaseObject.cc
===================================================================
--- code/branches/objecthierarchie/src/BaseObject.cc	(revision 132)
+++ code/branches/objecthierarchie/src/BaseObject.cc	(revision 132)
@@ -0,0 +1,23 @@
+#include "BaseObject.h"
+
+//namespace orxonox
+//{
+    BaseObject::BaseObject()
+    {
+//        registerObject(BaseObject, true);
+    }
+
+    BaseObject::~BaseObject()
+    {
+//        unregisterObject();
+    }
+/*
+    void* BaseObject::operator new (size_t size)
+    {
+        void *pMem = new char[size];
+        memset(pMem,0,size);
+
+        return pMem;
+    }
+*/
+//}
Index: code/branches/objecthierarchie/src/BaseObject.h
===================================================================
--- code/branches/objecthierarchie/src/BaseObject.h	(revision 132)
+++ code/branches/objecthierarchie/src/BaseObject.h	(revision 132)
@@ -0,0 +1,28 @@
+#ifndef _BaseObject_H__
+#define _BaseObject_H__
+
+#include "ClassHierarchy.h"
+
+//namespace orxonox
+//{
+    class BaseObject
+    {
+        public:
+            BaseObject();
+            ~BaseObject();
+
+            bool isA(ClassName* className);
+            bool isChildOf(ClassName* className);
+            bool isParentOf(ClassName* className);
+            static bool getParentOf(ClassName* className);
+
+//            static void operator new (size_t size);
+
+            ClassName *className;
+
+        private:
+
+    };
+//}
+
+#endif
Index: code/branches/objecthierarchie/src/ClassHierarchy.cc
===================================================================
--- code/branches/objecthierarchie/src/ClassHierarchy.cc	(revision 132)
+++ code/branches/objecthierarchie/src/ClassHierarchy.cc	(revision 132)
@@ -0,0 +1,259 @@
+#include "ClassHierarchy.h"
+#include "BaseObject.h"
+
+//namespace orxonox
+//{
+    // ##### ClassName #####
+    ClassName::ClassName(const std::string& name, ClassNameSingleton<class T>* factory)
+    {
+        this->parentClass = NULL;
+        this->childClasses = new ClassList();
+        this->objects = new ObjectList();
+        this->name = name;
+        this->factory = factory;
+    }
+
+    ClassName::~ClassName()
+    {
+        delete this->childClasses;
+        delete this->objects;
+    }
+
+
+    // ##### ClassListItem #####
+    ClassListItem::ClassListItem(ClassName* className)
+    {
+        this->next = NULL;
+        this->className = className;
+    }
+
+    ClassListItem::~ClassListItem()
+    {
+        delete this->className;
+        delete this->next;
+    }
+
+
+    // ##### ClassList #####
+    ClassList::ClassList()
+    {
+        this->first = NULL;
+    }
+
+    ClassList::~ClassList()
+    {
+        delete this->first;
+    }
+
+    void ClassList::add(ClassName* className)
+    {
+        if (!this->first)
+        {
+            this->first = new ClassListItem(className);
+            return;
+        }
+
+        ClassListItem* iterator = this->first;
+        while (iterator != NULL)
+        {
+            if (iterator->next == NULL)
+            {
+                iterator->next = new ClassListItem(className);
+                return;
+            }
+
+            iterator = iterator->next;
+        }
+    }
+
+    // ##### ObjectListItem #####
+    ObjectListItem::ObjectListItem(BaseObject* object)
+    {
+        this->next = NULL;
+        this->object = object;
+    }
+
+    ObjectListItem::~ObjectListItem()
+    {
+        delete this->object;
+        delete this->next;
+    }
+
+
+    // ##### ObjectList #####
+    ObjectList::ObjectList()
+    {
+        this->first = NULL;
+    }
+
+    ObjectList::~ObjectList()
+    {
+        delete this->first;
+    }
+
+    void ObjectList::add(BaseObject* object)
+    {
+        if (!this->first)
+        {
+            this->first = new ObjectListItem(object);
+            return;
+        }
+
+        ObjectListItem* iterator = this->first;
+        while (iterator != NULL)
+        {
+            if (iterator->next == NULL)
+            {
+                iterator->next = new ObjectListItem(object);
+                return;
+            }
+
+            iterator = iterator->next;
+        }
+    }
+
+    void ObjectList::remove(BaseObject* object)
+    {
+        if (!this->first || !object)
+            return;
+
+        if (this->first->object == object)
+        {
+            ObjectListItem* temp = this->first->next;
+            delete this->first;
+            this->first = temp;
+
+            return;
+        }
+
+        ObjectListItem* iterator = this->first;
+        while (iterator->next != NULL)
+        {
+            if (iterator->next->object == object)
+            {
+                ObjectListItem* temp = iterator->next->next;
+                delete iterator->next;
+                iterator->next = temp;
+
+                return;
+            }
+
+            iterator = iterator->next;
+        }
+    }
+
+    // ##### ClassNameTree #####
+    ClassNameTree* ClassNameTree::pointer = NULL;
+
+    ClassNameTree::ClassNameTree()
+    {
+    }
+
+    ClassNameTree::~ClassNameTree()
+    {
+        this->pointer = NULL;
+    }
+
+    ClassNameTree* ClassNameTree::getSingleton()
+    {
+        if (!pointer)
+        {
+            pointer = new ClassNameTree();
+        }
+
+        return pointer;
+    }
+/*
+    BaseObject* ClassNameTree::create(ClassName* className)
+    {
+        return className->factory->create();
+    }
+
+    BaseObject* ClassNameTree::create(std::string& name)
+    {
+        return this->getClassName(name)->factory->create();
+    }
+*/
+    ClassName* ClassNameTree::getClassName(std::string& name)
+    {
+        return getClassName(name, this->rootClass);
+    }
+
+    ClassName* ClassNameTree::getClassName(std::string& name, ClassName* root)
+    {
+        if (root->name == name)
+            return root;
+
+        ClassListItem* temp = root->childClasses->first;
+        while (temp != NULL)
+        {
+            ClassName* temp2 = this->getClassName(name, temp->className);
+            if (temp2)
+                return temp2;
+
+            temp = temp->next;
+        }
+
+        return NULL;
+    }
+
+
+    // ##### ClassNameSingleton #####
+    #define getClassNameString(ClassName) \
+        #ClassName
+
+    template <class T>
+    ClassNameSingleton<T>* ClassNameSingleton<T>::pointer = NULL;
+
+    template <class T>
+    ClassName* ClassNameSingleton<T>::className = NULL;
+
+    template <class T>
+    ClassName* ClassNameSingleton<T>::getClassName(BaseObject* object, bool bIsRootClass)
+    {
+        if (!pointer || !className)
+        {
+            pointer = new ClassNameSingleton<T>();
+            className = new ClassName(getClassNameString(T), pointer);
+
+            if (bIsRootClass)
+            {
+                className->parentClass = NULL;
+                ClassNameTree::getSingleton()->setRootClass(className);
+            }
+            else
+            {
+                className->parentClass = object->className;
+                object->className->childClasses->add(className);
+            }
+        }
+
+        return className;
+    }
+
+    template <class T>
+    ClassName* ClassNameSingleton<T>::getNewClassName()
+    {
+        if (!pointer || !className)
+        {
+            T* temp = new T();
+            delete temp;
+        }
+
+        return className;
+    }
+
+    template <class T>
+    BaseObject* ClassNameSingleton<T>::create()
+    {
+        return new T();
+    }
+
+    template <class T>
+    ClassNameSingleton<T>::~ClassNameSingleton()
+    {
+        this->pointer = NULL;
+        delete this->className;
+        this->className = NULL;
+    }
+//}
Index: code/branches/objecthierarchie/src/ClassHierarchy.h
===================================================================
--- code/branches/objecthierarchie/src/ClassHierarchy.h	(revision 132)
+++ code/branches/objecthierarchie/src/ClassHierarchy.h	(revision 132)
@@ -0,0 +1,124 @@
+#ifndef _ClassHierarchy_H__
+#define _ClassHierarchy_H__
+
+#include <string>
+
+// DONE:
+// - klassenhierarchie aufbauen
+// - klassen-identifier
+
+// TODO:
+// - durch listen iterieren
+// - isA usw vergleiche
+// - new überladen + objekt in liste eintragen
+// - searchtree für classname-strings
+
+//namespace orxonox
+//{
+    class ClassName;
+    class ClassList;
+    class ObjectList;
+    class BaseObject;
+
+    template <class T>
+    class ClassNameSingleton
+    {
+        public:
+            static ClassName* getClassName(BaseObject* object, bool bIsRootClass);
+            static ClassName* getNewClassName();
+            BaseObject* create();
+
+        private:
+            ClassNameSingleton();
+            ~ClassNameSingleton();
+            static ClassNameSingleton *pointer;
+            static ClassName *className;
+    };
+
+    class ClassName
+    {
+        public:
+            ClassName(const std::string& name, ClassNameSingleton<class T>* factory);
+            ~ClassName();
+
+            std::string name;
+            ClassName *parentClass;
+            ClassList *childClasses;
+            ObjectList *objects;
+            ClassNameSingleton<class T> *factory;
+    };
+
+    class ClassListItem
+    {
+        public:
+            ClassListItem(ClassName* className);
+            ~ClassListItem();
+
+            ClassListItem *next;
+            ClassName *className;
+    };
+
+    class ClassList
+    {
+        public:
+            ClassList();
+            ~ClassList();
+            void add(ClassName* className);
+
+            ClassListItem *first;
+    };
+
+    class ObjectListItem
+    {
+        public:
+            ObjectListItem(BaseObject* object);
+            ~ObjectListItem();
+
+            ObjectListItem *next;
+            BaseObject *object;
+    };
+
+    class ObjectList
+    {
+        public:
+            ObjectList();
+            ~ObjectList();
+            void add(BaseObject* object);
+            void remove(BaseObject* object);
+
+            ObjectListItem *first;
+    };
+
+    class ClassNameTree
+    {
+        public:
+            static ClassNameTree* getSingleton();
+            BaseObject* create(ClassName* className);
+            BaseObject* create(std::string& name);
+            ClassName* getClassName(std::string& name);
+            ClassName* getClassName(std::string& name, ClassName* root);
+            ClassName* getRootClass() { return this->rootClass; }
+            void setRootClass(ClassName* className) { this->rootClass = className; }
+
+        private:
+            ClassNameTree();
+            ~ClassNameTree();
+            static ClassNameTree *pointer;
+            ClassName* rootClass;
+    };
+
+
+    #define className(ClassName) \
+        ClassNameSingleton<ClassName>::getNewClassName()
+
+    #define registerObject(ClassName, bIsRootClass) \
+        this->className = ClassNameSingleton<ClassName>::getClassName(this, bIsRootClass)
+
+    #define unregisterObject() \
+        this->className->objects->remove(this)
+
+    #define factory(ClassName) \
+        ClassNameTree::getSingleton()->create(ClassName)
+//}
+
+#endif
