Index: orxonox/trunk/src/util/loading/factory.h
===================================================================
--- orxonox/trunk/src/util/loading/factory.h	(revision 4931)
+++ orxonox/trunk/src/util/loading/factory.h	(revision 4932)
@@ -48,10 +48,12 @@
 
   static void registerFactory( Factory* factory);
-  /** sets the Next factory in the list @param nextFactory the next factory */
-  inline void setNext( Factory* nextFactory) { this->next = nextFactory; };
   /** @returns the first factory */
   static Factory* getFirst() { return Factory::first; };
-  /** @returns the next factory */
-  Factory* getNext() const { return this->next; };
+
+  protected:
+    /** sets the Next factory in the list @param nextFactory the next factory */
+    inline void setNext( Factory* nextFactory) { this->next = nextFactory; };
+    /** @returns the next factory */
+    Factory* getNext() const { return this->next; };
 
   private:
Index: orxonox/trunk/src/util/object_manager.cc
===================================================================
--- orxonox/trunk/src/util/object_manager.cc	(revision 4931)
+++ orxonox/trunk/src/util/object_manager.cc	(revision 4932)
@@ -24,4 +24,69 @@
 
 
+
+
+/**
+ *  constructor, sets everything to zero and define factoryName
+ */
+FastFactory::FastFactory (const char* fastFactoryName, ClassID classID)
+{
+  this->setClassID(CL_FAST_FACTORY, "FastFactory");
+  this->setName(fastFactoryName);
+
+  this->storedClassID = classID;
+  this->next = NULL;
+
+  FastFactory::registerFastFactory(this);
+}
+
+/** a reference to the First FastFactory */
+FastFactory* FastFactory::first = NULL;
+
+/**
+ *  destructor
+ *  clear the Q
+ */
+FastFactory::~FastFactory ()
+{
+  if (this == first)
+    this->first = NULL;
+
+  if (this->next)
+    delete this->next;
+}
+
+/**
+ * add a FastFactory to the FastFactory Queue
+ * @param factory a FastFactory to be registered
+ */
+void FastFactory::registerFastFactory( FastFactory* factory)
+{
+  PRINTF(3)("Registered FastFactory for '%s'\n", factory->getName());
+
+  if( FastFactory::first == NULL)
+    FastFactory::first = factory;
+  else
+  {
+    FastFactory* tmpFac = FastFactory::first;
+    while( tmpFac->next != NULL)
+    {
+      tmpFac = tmpFac->next;
+    }
+    tmpFac->setNext(factory);
+  }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
 /**
  *  standard constructor
@@ -32,9 +97,4 @@
   this->setName("ObjectManager");
 
-  this->managedObjectList = new tList<BaseObject>*[CL_NUMBER];
-  for(int i = 0; i < CL_NUMBER; ++i)
-    {
-      this->managedObjectList[i] = NULL;
-    }
 }
 
@@ -54,41 +114,4 @@
 
 /**
- *  adds an element to the list of dead objects
- * @param index: The type of object to add
- * @param object: pointer to the object at hand
-*/
-void ObjectManager::addToDeadList(int index, BaseObject* object)
-{
-  if( likely(this->managedObjectList[index] != NULL))
-    this->managedObjectList[index]->add(object);
-  else
-    PRINTF(0)(" Critical: unable to add object to the list nr. %i: no list initialized - ignoring\n", index);
-}
-
-/**
- *  resurects an object
- * @param index: the type of resource to load
- * @param number: how many of them
-
-   @todo if it is unable to get an object from the deadList, it should create it
-*/
-BaseObject* ObjectManager::getFromDeadList(int index, int number)
-{
-  if( likely(this->managedObjectList[index] != NULL))
-    {
-      BaseObject* obj = this->managedObjectList[index]->firstElement();
-      this->managedObjectList[index]->remove(obj);
-      if( unlikely(obj == NULL))
-        {
-          PRINTF(0)("Critical: there was no object anymore in the dead list! This could result in Segfaults\n");
-        }
-      return obj;
-    }
-  else
-    PRINTF(0)(" Critical: unable to get object from the list nr. %i: no elements initialized - ignoring\n", index);
-  return NULL;
-}
-
-/**
  *  outputs some simple debug information about the ObjectManage
 */
@@ -96,69 +119,15 @@
 {
   PRINT(0)("\n==========================| ObjectManager::debug() |===\n");
-  PRINT(0)("=  Number of registerable classes: %i\n", CL_NUMBER );
-  PRINT(0)("=  Currently cached objects: \n");
-  for(int i = 0; i < CL_NUMBER; ++i)
-    {
+/* PRINT(0)("=  Number of registerable classes: %i\n", CL_NUMBER );
+ PRINT(0)("=  Currently cached objects: \n");
+ for(int i = 0; i < CL_NUMBER; ++i)
+   {
       if( this->managedObjectList[i] != NULL)
         PRINT(0)("=   o Class Nr. %i has cached %i object(s)\n", i, this->managedObjectList[i]->getSize());
       else
         PRINT(0)("=   o Class Nr. %i has cached 0 object(s)\n", i);
-    }
+    }*/
   PRINT(0)("=======================================================\n");
 }
 
 
-
-/**
- *  constructor
-
-   set everything to zero and define factoryName
- */
-FastObject::FastObject (const char* fastObjectName, ClassID classID)
-{
-  this->setClassID(CL_FACTORY, "FastObject");
-  this->setName(fastObjectName);
-
-  this->storedClassID = classID;
-  this->next = NULL;
-
-  FastObject::registerFastObject(this);
-}
-
-/** a reference to the First FastObject */
-FastObject* FastObject::first = NULL;
-
-/**
- *  destructor
-
-   clear the Q
- */
-FastObject::~FastObject ()
-{
-  //  printf("%s\n", this->factoryName);
-  //  FastObject* tmpDel = this->next;
-  //  this->next = NULL;
-  if (this->next)
-    delete this->next;
-}
-
-/**
- *  add a FastObject to the FastObject Queue
- * @param factory a FastObject to be registered
- */
-void FastObject::registerFastObject( FastObject* factory)
-{
-  PRINTF(4)("Registered FastObject for '%s'\n", factory->getName());
-
-  if( FastObject::first == NULL)
-    FastObject::first = factory;
-  else
-  {
-    FastObject* tmpFac = FastObject::first;
-    while( tmpFac->next != NULL)
-    {
-      tmpFac = tmpFac->next;
-    }
-    tmpFac->setNext(factory);
-  }
-}
Index: orxonox/trunk/src/util/object_manager.h
===================================================================
--- orxonox/trunk/src/util/object_manager.h	(revision 4931)
+++ orxonox/trunk/src/util/object_manager.h	(revision 4932)
@@ -26,4 +26,95 @@
 class GarbageCollector;
 
+
+/**
+ * Creates a FastFactory to a Loadable FastFactory.
+ */
+#define CREATE_FAST_FACTORY(CLASS_NAME, CLASS_ID) \
+    tFastFactory<CLASS_NAME>* global_##CLASS_NAME##_FastFactory = new tFastFactory<CLASS_NAME>(#CLASS_NAME, CLASS_ID)
+
+//! A struct, that holds Lists of Objects of a certain type.
+typedef struct FastObjectMember
+{
+  BaseObject*          objectPointer;
+
+  FastObjectMember*    next;
+};
+
+//! The FastFactory is a fast loadable object creator, and Dynamic List of dead object handler.
+class FastFactory : public BaseObject {
+
+  public:
+    FastFactory (const char* fastFactoryName, ClassID classID);
+    virtual ~FastFactory ();
+
+
+    BaseObject* resurect(ClassID classID);
+    void kill(ClassID classID, BaseObject* object);
+
+    virtual BaseObject* fabricate(ClassID classID) = NULL;
+
+    static void registerFastFactory(FastFactory* fastFactory);
+    static void registerFastFactory(const char* fastFactoryName, ClassID classID);
+
+    /** @returns the first FastFactory */
+    static FastFactory* getFirst() { return FastFactory::first; };
+
+  protected:
+    /** sets the Next factory in the list @param nextFactory the next factory */
+    inline void setNext( FastFactory* nextFastFactory) { this->next = nextFastFactory; };
+    /** @returns the next FastFactory */
+    FastFactory* getNext() const { return this->next; };
+
+  protected:
+    ClassID               storedClassID;        //!< The classID of the specified class.
+
+  private:
+    static FastFactory*   first;                //!< A pointer to the first FastFactory.
+
+    FastFactory*          next;                 //!< pointer to the next FastFactory.
+};
+
+/**
+ *  a FastFactory that is able to load any kind of Object from a ClassID
+ * (this is a Functor)
+ */
+template<class T> class tFastFactory : public FastFactory
+{
+  public:
+    tFastFactory(const char* fastFactoryName, ClassID fastFactory);
+
+  private:
+    virtual BaseObject* fabricate(ClassID classID);
+};
+
+/**
+ * construnts a FastFactory with
+ * @param fastFactoryName the name of the FastFactory
+ * @param fastFactory the ID of the class
+ */
+template<class T>
+    tFastFactory<T>::tFastFactory(const char* fastFactoryName, ClassID fastFactory) : FastFactory(fastFactoryName, fastFactory)
+{
+  PRINTF(5)("Class: %s loadable as a FastFactory\n", this->getName());
+}
+
+template<class T>
+BaseObject* tFastFactory<T>::fabricate(ClassID classID)
+{
+  if (this->storedClassID == classID)
+    return new T ();
+  else if( getNext() != NULL)
+    return getNext()->fabricate(classID);
+  else
+    return NULL;
+}
+
+
+
+
+////////////////////
+// OBJECT MANAGER //
+////////////////////
+
 //! the object manager itself
 class ObjectManager : public BaseObject {
@@ -35,8 +126,4 @@
 
   void registerClass(ClassID classID);
-
-  /** a class handled by the objectManage */
-  void addToDeadList(int index, BaseObject* object);
-  BaseObject* getFromDeadList(int index, int number = 1);
 
   BaseObject* resurect();
@@ -52,74 +139,7 @@
   static ObjectManager*      singletonRef;          //!< The singleton reference to the only reference of this class
 
-  tList<BaseObject>**        managedObjectList;     //!< A list of managed objects (handles different types and lists of them)
 };
 
 
 
-/**
- * Creates a factory to a Loadable FastObject.
- */
-#define CREATE_FAST_OBJECT(CLASS_NAME, CLASS_ID) \
-    tFastObject<CLASS_NAME>* global_##CLASS_NAME##_FastObject = new tFastObject<CLASS_NAME>(#CLASS_NAME, CLASS_ID)
-
-//! The FastObject is a loadable object handler
-class FastObject : public BaseObject {
-
-  public:
-    FastObject (const char* fastObjectName = NULL, ClassID classID = CL_NULL);
-    virtual ~FastObject ();
-
-    virtual BaseObject* fabricate(ClassID classID) = NULL;
-
-    static void registerFastObject(FastObject* fastObject);
-    /** sets the Next factory in the list @param nextFactory the next factory */
-    inline void setNext( FastObject* nextFastObject) { this->next = nextFastObject; };
-    /** @returns the first FastObject */
-    static FastObject* getFirst() { return FastObject::first; };
-    /** @returns the next FastObject */
-    FastObject* getNext() const { return this->next; };
-
-  protected:
-    ClassID              storedClassID;        //!< The classID of the specified class.
-
-  private:
-    FastObject*          next;                 //!< pointer to the next FastObject.
-    static FastObject*   first;                //!< A pointer to the first FastObject.
-};
-
-/**
- *  a FastObject that is able to load any kind of Object
- * (this is a Functor)
- */
-template<class T> class tFastObject : public FastObject
-{
-  public:
-    tFastObject(const char* fastObjectName, ClassID fastObject);
-
-  private:
-    virtual BaseObject* fabricate(ClassID fastObject);
-};
-
-/**
- * construnts a FastObject with
- * @param fastObjectName the name of the FastObject
- * @param fastObject the ID of the class
- */
-template<class T>
-tFastObject<T>::tFastObject(const char* fastObjectName, ClassID fastObject) : FastObject(fastObjectName, fastObject)
-{
-  PRINTF(5)("Class: %s loadable as a FastObject\n", this->getName());
-}
-
-template<class T>
-BaseObject* tFastObject<T>::fabricate(ClassID fastObject)
-{
-//  if(this->classID == fastObject)
-    //return new T ();
-  //else if( getNext() != NULL)
-//    return getNext()->fabricate();
-//  else
-    return NULL;
-}
-
 #endif /* _OBJECT_MANAGER_H */
