Index: code/branches/objecthierarchie/src/BaseObject.cc
===================================================================
--- code/branches/objecthierarchie/src/BaseObject.cc	(revision 217)
+++ code/branches/objecthierarchie/src/BaseObject.cc	(revision 218)
@@ -3,4 +3,6 @@
 namespace orxonox
 {
+    CreateFactory(BaseObject);
+
     BaseObject::BaseObject()
     {
Index: code/branches/objecthierarchie/src/CMakeLists.txt
===================================================================
--- code/branches/objecthierarchie/src/CMakeLists.txt	(revision 217)
+++ code/branches/objecthierarchie/src/CMakeLists.txt	(revision 218)
@@ -2,6 +2,6 @@
 
 # create a few variables to simplify life
-SET(SRC_FILES orxonox.cc IdentifierList.cc ObjectList.cc Identifier.cc ClassHierarchy.cc OrxonoxClass.cc BaseObject.cc test1.cc test2.cc test3.cc)
-SET(INC_FILES ClassHierarchy.h Identifier.h IdentifierList.h ObjectList.h OrxonoxClass.h BaseObject.h Test.h test1.h test2.h test3.h)
+SET(SRC_FILES orxonox.cc IdentifierList.cc ObjectList.cc Identifier.cc Factory.cc ClassHierarchy.cc OrxonoxClass.cc BaseObject.cc test1.cc test2.cc test3.cc)
+SET(INC_FILES IdentifierIncludes.h ClassHierarchy.h Identifier.h Factory.h IdentifierList.h ObjectList.h OrxonoxClass.h BaseObject.h Test.h test1.h test2.h test3.h)
 
 #Creates an executable
Index: code/branches/objecthierarchie/src/ClassHierarchy.h
===================================================================
--- code/branches/objecthierarchie/src/ClassHierarchy.h	(revision 217)
+++ code/branches/objecthierarchie/src/ClassHierarchy.h	(revision 218)
@@ -11,11 +11,10 @@
 // - ClassIdentifier
 // - BaseIdentifier
+// - Factory
 
 // IN WORK:
-// - Factory
 
 // TO DO:
 // - iterate through lists
-// - searchtree for classname-strings
 
 
@@ -37,4 +36,5 @@
         private:
             ClassHierarchy();
+            ClassHierarchy(const ClassHierarchy& hierarchy);
             ~ClassHierarchy();
             void startCreatingHierarchy() { this->hierarchyCreatingCounter_++; std::cout << "*** Increased Hierarchy-Creating-Counter to " << this->hierarchyCreatingCounter_ << "\n"; }
@@ -91,6 +91,9 @@
         ClassIdentifier<ClassName>::getIdentifier()
 
-    #define Factory(ClassName) \
-        ClassIdentifier<ClassName>::create()
+    #define CreateFactory(ClassName) \
+        Identifier* global_##ClassName##_Identifier = ClassIdentifier<ClassName>::getIdentifier()
+
+    #define Factory(Name) \
+        ClassFactory::fabricate(Name)
 }
 
Index: code/branches/objecthierarchie/src/Factory.cc
===================================================================
--- code/branches/objecthierarchie/src/Factory.cc	(revision 218)
+++ code/branches/objecthierarchie/src/Factory.cc	(revision 218)
@@ -0,0 +1,23 @@
+#include "Factory.h"
+#include "Identifier.h"
+
+namespace orxonox
+{
+    ClassFactory* ClassFactory::pointer_ = NULL;
+
+    OrxonoxClass* ClassFactory::fabricate(const std::string& name)
+    {
+        if (!pointer_)
+            pointer_ = new ClassFactory;
+
+        return pointer_->identifierMap_[name]->fabricate();
+    }
+
+    void ClassFactory::add(const std::string& name, Identifier* identifier)
+    {
+        if (!pointer_)
+            pointer_ = new ClassFactory;
+
+        pointer_->identifierMap_[name] = identifier;
+    }
+}
Index: code/branches/objecthierarchie/src/Factory.h
===================================================================
--- code/branches/objecthierarchie/src/Factory.h	(revision 218)
+++ code/branches/objecthierarchie/src/Factory.h	(revision 218)
@@ -0,0 +1,28 @@
+#ifndef _Factory_H__
+#define _Factory_H__
+
+#include <map>
+#include <string>
+
+namespace orxonox
+{
+    class Identifier;
+    class OrxonoxClass;
+
+    class ClassFactory
+    {
+        public:
+            static OrxonoxClass* fabricate(const std::string& name);
+            static void add(const std::string& name, Identifier* identifier);
+
+        private:
+            ClassFactory() {}
+            ClassFactory(const ClassFactory& factory) {}
+            ~ClassFactory() {}
+
+            static ClassFactory* pointer_;
+            std::map<std::string, Identifier*> identifierMap_;
+    };
+}
+
+#endif
Index: code/branches/objecthierarchie/src/Identifier.h
===================================================================
--- code/branches/objecthierarchie/src/Identifier.h	(revision 217)
+++ code/branches/objecthierarchie/src/Identifier.h	(revision 218)
@@ -6,4 +6,5 @@
 #include "ObjectList.h"
 #include "OrxonoxClass.h"
+#include "Factory.h"
 
 namespace orxonox
@@ -21,4 +22,6 @@
             void addObject(OrxonoxClass* object);
             void removeObject(OrxonoxClass* object);
+
+            virtual OrxonoxClass* fabricate() {};
 
             bool isA(Identifier* identifier);
@@ -61,4 +64,6 @@
             static ClassIdentifier<T>* registerClass(IdentifierList* parents, std::string name, bool bRootClass, bool bIsAbstractClass);
             static ClassIdentifier<T>* getIdentifier();
+            OrxonoxClass* fabricate();
+            T* fabricateClass();
 
         private:
@@ -83,4 +88,16 @@
     {
         this->pointer_ = NULL;
+    }
+
+    template <class T>
+    OrxonoxClass* ClassIdentifier<T>::fabricate()
+    {
+        return this->fabricateClass();
+    }
+
+    template <class T>
+    T* ClassIdentifier<T>::fabricateClass()
+    {
+        return new T;
     }
 
@@ -97,4 +114,7 @@
                 pointer_->name_ = name;
                 pointer_->bIsAbstractClass_ = bIsAbstractClass;
+
+                ClassFactory::add(name, pointer_);
+
                 pointer_->initialize(parents);
             }
@@ -124,14 +144,12 @@
     }
 
-
     // ##### BaseIdentifier #####
     template <class B>
-    class BaseIdentifier// : public Identifier
+    class BaseIdentifier
     {
         public:
             BaseIdentifier();
 
-            //template <class T>
-            BaseIdentifier<B>& operator= (/*Class*/Identifier/*<T>*/* identifier)
+            BaseIdentifier<B>& operator= (Identifier* identifier)
             {
                 if (!identifier->isA(ClassIdentifier<B>::getIdentifier()))
@@ -145,4 +163,40 @@
                 return *this;
             }
+
+            Identifier* operator* ()
+            {
+                return this->identifier_;
+            }
+
+            Identifier* operator-> () const
+            {
+                return this->identifier_;
+            }
+
+            B* fabricate()
+            {
+                OrxonoxClass* 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 Identifier* getIdentifier()
                 { return this->identifier_; }
Index: code/branches/objecthierarchie/src/IdentifierIncludes.h
===================================================================
--- code/branches/objecthierarchie/src/IdentifierIncludes.h	(revision 217)
+++ code/branches/objecthierarchie/src/IdentifierIncludes.h	(revision 218)
@@ -1,4 +1,5 @@
 #include "ClassHierarchy.h"
 #include "Identifier.h"
+#include "Factory.h"
 #include "IdentifierList.h"
 #include "ObjectList.h"
Index: code/branches/objecthierarchie/src/OrxonoxClass.h
===================================================================
--- code/branches/objecthierarchie/src/OrxonoxClass.h	(revision 217)
+++ code/branches/objecthierarchie/src/OrxonoxClass.h	(revision 218)
@@ -11,5 +11,5 @@
         public:
             OrxonoxClass();
-            ~OrxonoxClass();
+            virtual ~OrxonoxClass();
             Identifier* getIdentifier() { return this->identifier_; }
             void setIdentifier(Identifier* identifier) { this->identifier_ = identifier; }
Index: code/branches/objecthierarchie/src/Test.h
===================================================================
--- code/branches/objecthierarchie/src/Test.h	(revision 217)
+++ code/branches/objecthierarchie/src/Test.h	(revision 218)
@@ -2,4 +2,5 @@
 #define _Test_H__
 
+#include "BaseObject.h"
 #include "IdentifierIncludes.h"
 
@@ -125,4 +126,23 @@
             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);
 }
 
Index: code/branches/objecthierarchie/src/orxonox.cc
===================================================================
--- code/branches/objecthierarchie/src/orxonox.cc	(revision 217)
+++ code/branches/objecthierarchie/src/orxonox.cc	(revision 218)
@@ -31,4 +31,5 @@
 #include <OgreCEGUIRenderer.h>
 
+#include "IdentifierIncludes.h"
 #include "BaseObject.h"
 #include "Test.h"
@@ -446,6 +447,6 @@
         test7_02 = Class(A1B1);
 
-        std::cout << test7_01.getIdentifier()->getName() << "\n";
-        std::cout << test7_02.getIdentifier()->getName() << "\n";
+        std::cout << test7_01->getName() << "\n";
+        std::cout << test7_02->getName() << "\n";
 */
 /*
@@ -461,5 +462,5 @@
         test7_05 = Class(A2);
 */
-
+/*
         std::cout << "Test 8\n";
 
@@ -498,5 +499,31 @@
         delete test8_02;
         delete test8_03;
-
+*/
+
+        std::cout << "Test 9\n";
+        std::cout << "1\n";
+        Identifier* test9_01 = Class(A3);
+        OrxonoxClass* test9_02 = test9_01->fabricate();
+        std::cout << test9_02->getIdentifier()->getName() << "\n";
+
+        std::cout << "\n2\n";
+        OrxonoxClass* test9_03 = Class(A1B2)->fabricate();
+        std::cout << test9_03->getIdentifier()->getName() << "\n";
+
+        std::cout << "\n3\n";
+        BaseIdentifier<A1> test9_04;
+        test9_04 = Class(A1B1C1);
+        A1* test9_05 = test9_04.fabricate();
+        std::cout << test9_05->getIdentifier()->getName() << "\n";
+
+        std::cout << "\n4\n";
+        OrxonoxClass* test9_06 = Factory("A2B2");
+        std::cout << test9_06->getIdentifier()->getName() << "\n";
+
+        std::cout << "\n5\n";
+        delete test9_02;
+        delete test9_03;
+        delete test9_05;
+        delete test9_06;
 
       }
Index: code/branches/objecthierarchie/src/test1.cc
===================================================================
--- code/branches/objecthierarchie/src/test1.cc	(revision 217)
+++ code/branches/objecthierarchie/src/test1.cc	(revision 218)
@@ -5,4 +5,6 @@
 namespace orxonox
 {
+    CreateFactory(Test1);
+
     Test1::Test1()
     {
Index: code/branches/objecthierarchie/src/test2.cc
===================================================================
--- code/branches/objecthierarchie/src/test2.cc	(revision 217)
+++ code/branches/objecthierarchie/src/test2.cc	(revision 218)
@@ -5,4 +5,6 @@
 namespace orxonox
 {
+    CreateFactory(Test2);
+
     Test2::Test2()
     {
Index: code/branches/objecthierarchie/src/test3.cc
===================================================================
--- code/branches/objecthierarchie/src/test3.cc	(revision 217)
+++ code/branches/objecthierarchie/src/test3.cc	(revision 218)
@@ -5,4 +5,6 @@
 namespace orxonox
 {
+    CreateFactory(Test3);
+
     Test3::Test3()
     {
