Index: /orxonox/trunk/src/garbage_collector.cc
===================================================================
--- /orxonox/trunk/src/garbage_collector.cc	(revision 3647)
+++ /orxonox/trunk/src/garbage_collector.cc	(revision 3647)
@@ -0,0 +1,108 @@
+
+
+/* 
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Patrick Boenzli
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
+
+#include "garbage_collector.h"
+
+#include "world.h"
+#include "world_entity.h"
+#include "null_parent.h"
+
+#include "list.h"
+
+using namespace std;
+
+
+GarbageCollector* GarbageCollector::singletonRef = 0;
+
+/**
+   \brief standard constructor
+   \todo this constructor is not jet implemented - do it
+*/
+GarbageCollector::GarbageCollector () 
+{
+   this->setClassName ("GarbageCollection");
+   this->time = 0;
+   this->delay = 3.0f; /* clean up all 5.0 seconds */
+}
+
+
+/**
+   \brief standard deconstructor
+
+*/
+GarbageCollector::~GarbageCollector () 
+{
+  // delete what has to be deleted here
+}
+
+
+/**
+   \brief this returns the singleton reference this this class
+   \returns singleton reference
+*/
+GarbageCollector* GarbageCollector::getInstance()
+{
+  if( singletonRef == NULL)
+    singletonRef = new GarbageCollector();
+  return singletonRef;
+}
+
+
+void GarbageCollector::setCollectionDelay(float delay)
+{}
+
+
+void GarbageCollector::forceCollection()
+{
+  
+}
+
+void GarbageCollector::tick(float time)
+{
+  this->time += time;
+}
+
+
+void GarbageCollector::update()
+{
+  if( this->time < this->delay)
+    return;
+  /* garbage collect */
+  PRINTF(3)("GarbageCollection is been done\n");
+  WorldInterface* wi = WorldInterface::getInstance();
+  tList<WorldEntity>* list = wi->getEntityList();
+  //WorldEntity* entity = list->enumerate(); 
+ // while( entity != NULL) 
+  //  { 
+  //  if( entity->isFinalized())
+  //{
+  //  PRINTF(3)("Finalizing object in list - not yet done realy\n");
+	  /* first remove out of entity list */
+	  //list->remove(entity);
+	  /* second remove out of pnode tree */
+	  //NullParent* np = NullParent::getInstance();
+	  //np->removeChild(np);
+	  
+  //}
+  //   entity = list->nextElement();
+  //}
+  
+  /* reset time to count again up to this->delay */
+  this->time = 0;
+}
Index: /orxonox/trunk/src/garbage_collector.h
===================================================================
--- /orxonox/trunk/src/garbage_collector.h	(revision 3647)
+++ /orxonox/trunk/src/garbage_collector.h	(revision 3647)
@@ -0,0 +1,42 @@
+/*! 
+    \file proto_class.h
+    \brief Definition of the proto class template, used quickly start work
+    \todo Example: this shows how to use simply add a Marker that here has to be done something.
+
+    The Protoclass exists, to help you quikly getting the run for how to develop in orxonox.
+    It is an example for the CODING-CONVENTION, and a starting-point for every class.
+*/
+
+#ifndef _GARBAGE_COLLECTOR_H
+#define _GARBAGE_COLLECTOR_H
+
+#include "base_object.h"
+
+
+//! this class maintains the garbage collection.
+/**
+   the class is been ticked by the world.cc and goes through the 
+   world_entity list to clean out all unused entities.
+*/
+class GarbageCollector : public BaseObject {
+
+ public:
+  GarbageCollector();
+  virtual ~GarbageCollector();
+  static GarbageCollector* getInstance();
+
+  void setCollectionDelay(float delay);
+
+  void forceCollection();
+
+  void tick(float time);
+  void update();
+
+ private:
+  static GarbageCollector* singletonRef;
+  float delay;                                        //!< this is the delay to wait until collection
+  float time;                                         //!< the current time
+
+};
+
+#endif /* _GARBAGE_COLLECTOR_H */
