Index: trunk/src/lib/util/Makefile.am
===================================================================
--- trunk/src/lib/util/Makefile.am	(revision 9675)
+++ trunk/src/lib/util/Makefile.am	(revision 9869)
@@ -2,5 +2,10 @@
 include $(MAINSRCDIR)/defs/include_paths.am
 
-noinst_LIBRARIES = libORXlibutil.a
+noinst_LIBRARIES = \
+		libORXlibutil.a \
+		libORXexecutor.a
+
+libORXexecutor_a_SOURCES = \
+		executor/executor_substring.cc
 
 libORXlibutil_a_SOURCES = \
@@ -9,7 +14,5 @@
 		helper_functions.cc \
 		multi_type.cc \
-		executor/executor.cc \
-		executor/executor_functional.cc \
-		executor/executor_lua.cc \
+		debug_buffer.cc \
 		\
 		loading/resource_manager.cc \
@@ -18,6 +21,7 @@
 		loading/load_param.cc \
 		loading/load_param_description.cc \
+		loading/load_param_class_description.cc \
 		loading/factory.cc \
-		loading/dynamic_loader.cc \
+		loading/fast_factory.cc \
 		\
 		filesys/file.cc \
@@ -25,7 +29,8 @@
 		filesys/net_link.cc \
 		\
-		preferences.cc \
 		threading.cc \
 		timer.cc
+
+#		loading/dynamic_loader.cc
 
 
@@ -35,9 +40,22 @@
 		color.h \
 		helper_functions.h \
+		debug.h \
+		debug_buffer.h \
+		\
+		\
 		executor/executor.h \
-		executor/executor_functional.h \
 		executor/executor_xml.h \
-		executor/executor_lua.h \
+		executor/executor_substring.h \
+		executor/executor_generic.h \
+		executor/executor_member.h \
+		executor/executor_const_member.h \
+		executor/executor_static.h \
+		\
 		executor/functor_list.h \
+		executor/functor_generic.h \
+		executor/functor_member.h \
+		executor/functor_const_member.h \
+		executor/functor_static.h \
+		\
 		\
 		filesys/file.h \
@@ -45,5 +63,4 @@
 		filesys/net_link.h \
 		\
-		preferences.h \
 		threading.h \
 		timer.h \
@@ -53,6 +70,9 @@
 		loading/game_loader.h \
 		loading/load_param.h \
+		loading/load_param_xml.h \
 		loading/load_param_description.h \
+		loading/load_param_class_description.h \
 		loading/factory.h \
+		loading/fast_factory.h \
 		loading/dynamic_loader.h \
 		\
Index: trunk/src/lib/util/color.cc
===================================================================
--- trunk/src/lib/util/color.cc	(revision 9675)
+++ trunk/src/lib/util/color.cc	(revision 9869)
@@ -30,8 +30,10 @@
 //! Black Color
 const Color Color::black(0,0,0,1);
-//! Orx Color
-const Color Color::orx(.2, .5, .7, .8);  //!< TODO Define the ORX-color :)
-
-
+
+/**
+ * @brief slerps the Color in the HSV color space into the direction of c
+ * @param c the Color to slerp to
+ * @param v the Value to slerp 0 means stay at *this, 1 means at c.
+ */
 void Color::slerpHSV(const Color& c, float v)
 {
@@ -52,4 +54,11 @@
 }
 
+/**
+ * @brief simple slerp wrapper.
+ * @param from from this color
+ * @param to to this one
+ * @param v how much
+ * @see void Color::slerpHSV(const Color& c, float v)
+ */
 Color Color::slerpHSVColor(const Color& from, const Color& to, float v)
 {
@@ -59,5 +68,7 @@
 }
 
-
+/**
+ * @brief nice and simple debug output for the colors (colorless :) )
+ */
 void Color::debug() const
 {
@@ -214,5 +225,10 @@
 
 
-// Needed by rgb2hsv()
+/**
+ * @returns the maximum of r g and a.
+ * @param r Red.
+ * @param g Green
+ * @param b Blue
+ */
 float Color::maxrgb(float r, float g, float b)
 {
@@ -227,6 +243,10 @@
 }
 
-
-// Needed by rgb2hsv()
+/**
+ * @returns the minimum of r g and a.
+ * @param r Red.
+ * @param g Green
+ * @param b Blue
+ */
 float Color::minrgb(float r,float g,float b)
 {
Index: trunk/src/lib/util/color.h
===================================================================
--- trunk/src/lib/util/color.h	(revision 9675)
+++ trunk/src/lib/util/color.h	(revision 9869)
@@ -14,44 +14,78 @@
 #include "vector.h"
 
-//! a very abstract Class that helps transforming Colors into different Systems
+//! A Class that handles Colors.
+/**
+ * A Color is a collection of 4 values:
+ * <ul>
+ *  <li>Red</li>
+ *  <li>Green</li>
+ *  <li>Blue</li>
+ *  <li>Alpha</li>
+ * </ul>
+ * With these four values any color of the entire spectrum can be defined.
+ *
+ * By default a Color lies between 0 and 1 for each component.
+ * for example [1,0,0,.5] means red and half visible.
+ */
 class Color
 {
 public:
+  /** @param r red, @param g green @param b blue @param a alpha @brief constructs a Color. */
   Color(float r = 0.0f, float g = 0.0f, float b = 0.0f, float a = 1.0f) { _rgba[0] = r; _rgba[1] = g; _rgba[2] = b; _rgba[3] = a; };
+  /** @param c Color @brief copy constructor */
   Color(const Color& c) { _rgba[0] = c.r(); _rgba[1] = c.g(); _rgba[2] = c.b(); _rgba[3] = c.a(); }
 
+  /** @param c the Color to set to this color @returns the copied color */
   inline const Color& operator=(const Color& c) { _rgba[0] = c.r(); _rgba[1] = c.g(); _rgba[2] = c.b(); _rgba[3] = c.a(); return *this; };
+  /** @param c the color to compare @returns true on match. @brief compares two colors */
   inline bool operator==(const Color& c) const { return (r() == c.r() && g() == c.g() && b() == c.b() && a() == c.a()); };
 
+  /** @returns the i'th Value of the Color @param i part of the color 0:r, 1:g, 2:b, 3:a */
   inline float& operator[](unsigned int i) { return _rgba[i]; }
+  /** @returns a Constant Value of the color. @param i part of the color 0:r, 1:g, 2:b, 3:a */
   inline const float& operator[](unsigned int i) const { return _rgba[i]; }
 
+  /** @returns the red part. */
   inline float r() const { return _rgba[0]; }
+  /** @returns the reference to the red part */
   inline float& r() { return _rgba[0]; }
+  /** @returns the green part. */
   inline float g() const { return _rgba[1]; }
+  /** @returns the reference to the green part */
   inline float& g() { return _rgba[1]; }
+  /** @returns the blue part */
   inline float b() const { return _rgba[2]; }
+  /** @returns the reference to the blue part */
   inline float& b() { return _rgba[2]; }
+  /** @returns the alpha part */
   inline float a() const { return _rgba[3]; }
+  /** @returns the reference to the alpha part */
   inline float& a() { return _rgba[3]; }
 
 
-
-
+  /** @param r red, @param g green @param b blue @param a alpha @brief sets the color. */
   void setColor(float r = 0.0f, float g = 0.0f, float b = 0.0f, float a = 1.0f) { _rgba[0] = r; _rgba[1] = g; _rgba[2] = b; _rgba[3] = a; };
+  /** @param c the color to set. @brief sets the color. */
   void setColor(const Color& c) { r() = c.r();  g()= c.g(); b() = c.b(); a() = c.a(); };
 
+  /** @returns the distance to the color @param c the color to calculate the distance to. */
   inline float dist(const Color& c) const { return (sqrt((r()-c.r())*(r()-c.r()) + (g()-c.g())*(g()-c.g()) + (b()-c.b())*(b()-c.b()) + (a()-c.a())*(a()-c.a()))); }
   /// Maths
+  /** @param c the color to add to this one @returns the two added colors */
   inline const Color& operator+=(const Color& c) { r()+=c.r(); g()+=c.g(); b()+=c.b(); a()+=c.a(); return *this; };
+  /** @returns the result of the added colors @param c the color to add */
   inline Color operator+(const Color& c) const { return Color(r()+c.r(), g()+c.g(), b()+c.b(), a()+c.a()); };
+  /** @param c the color to substract to this one @returns the two substracted colors */
   inline const Color& operator-=(const Color& c) { r()-=c.r(); g()-=c.g(); b()-=c.b(); a()-=c.a(); return *this; };
+  /** @returns the result of the substracted colors @param c the color to substract */
   inline Color operator-(const Color& c) const { return Color(r()-c.r(), g()-c.g(), b()-c.b(), a()-c.a()); };
+  /** @param v the multiplier @returns the Color multiplied by v */
   inline const Color& operator*=(float v) { r()*=v, g()*=v, b()*=v, a()*=v; return *this; };
+  /** @param v the multiplier @returns a multiplied color */
   inline Color operator*(float v) const { return Color(r()*v, g()*v, b()*v, a()*v); };
 
+  /** @param c the color to slerp to @param v how much to slerp [0:1] @brief moves the color into the direction of another color */
   void slerp(const Color& c, float v) { *this += (c - *this) * v; };
   void slerpHSV(const Color& c, float v);
-
   static Color slerpHSVColor(const Color& from, const Color& to, float v);
 
@@ -75,13 +109,7 @@
   static const Color white;
   static const Color black;
-  static const Color orx;
 
 private:
-  float       _rgba[4]; //!< Color Values
-
-  /*  float       _r;     //!< Red Value.
-  float       _g;     //!< Green Value.
-  float       _b;     //!< Blue Value.
-  float       _a;     //!< Alpha Value.*/
+  float       _rgba[4]; //!< Color Values [r,g,b,a] (red green blue alpha)
 };
 
Index: trunk/src/lib/util/count_pointer.h
===================================================================
--- trunk/src/lib/util/count_pointer.h	(revision 9675)
+++ trunk/src/lib/util/count_pointer.h	(revision 9869)
@@ -9,48 +9,54 @@
 {
 public:
-    explicit CountPointer(X* p = 0) // allocate a new counter
-        : itsCounter(0) { if (p) itsCounter = new counter(p); }
-    virtual ~CountPointer() { release(); }
-    CountPointer(const CountPointer& r) { acquire(r.itsCounter); }
-    CountPointer& operator=(const CountPointer& r)
+  explicit CountPointer(X* p = NULL) // allocate a new counter
+      : itsCounter(NULL) { if (p) itsCounter = new counter(p); }
+  ~CountPointer() { release(); }
+  CountPointer(const CountPointer& r) { acquire(r.itsCounter); }
+  CountPointer& operator=(const CountPointer& r)
+  {
+    if (this != &r)
     {
-        if (this != &r) {
-            release();
-            acquire(r.itsCounter);
-        }
-        return *this;
+      release();
+      acquire(r.itsCounter);
     }
-    bool operator==(const CountPointer& r) const { return this->itsCounter->ptr == r.itsCounter->ptr; };
-    X& operator*()  const { return *itsCounter->ptr; }
-    X* operator->() const { return itsCounter->ptr; }
-    X* get()        const { return itsCounter ? itsCounter->ptr : 0; }
-    bool unique()   const { return (itsCounter ? itsCounter->count == 1 : true); }
-    virtual unsigned int count() const { return (this->itsCounter ? itsCounter->count : 0); }
+    return *this;
+  }
+  bool operator==(const CountPointer& r) const { return this->itsCounter->ptr == r.itsCounter->ptr; };
+  inline X& operator*()  const { return *itsCounter->ptr; }
+  inline X* operator->() const { return itsCounter->ptr; }
+  inline bool unique()   const { return (itsCounter ? itsCounter->count == 1 : true); }
+  inline bool isNull()   const { return (!itsCounter); }
+
+  unsigned int count() const { return (this->itsCounter ? itsCounter->count : 0); }
 private:
 
-    struct counter {
-        counter(X* p = 0, unsigned c = 1) : ptr(p), count(c) {}
-        X*          ptr;
-        unsigned    count;
-    }* itsCounter;
+  struct counter
+  {
+    counter(X* p = NULL, unsigned c = 1) : ptr(p), count(c) {}
+    X*          ptr;
+    unsigned    count;
+  }
+  * itsCounter;
 
-    void acquire(counter* c)
+  void acquire(counter* c)
+  {
+    // increment the count
+    itsCounter = c;
+    if (c) ++c->count;
+  }
+
+  void release()
+  {
+    // decrement the count, delete if it is 0
+    if (itsCounter)
     {
-      // increment the count
-        itsCounter = c;
-        if (c) ++c->count;
+      if (--itsCounter->count == 0)
+      {
+        delete itsCounter->ptr;
+        delete itsCounter;
+      }
+      itsCounter = NULL;
     }
-
-    void release()
-    {
-      // decrement the count, delete if it is 0
-        if (itsCounter) {
-            if (--itsCounter->count == 0) {
-                delete itsCounter->ptr;
-                delete itsCounter;
-            }
-            itsCounter = 0;
-        }
-    }
+  }
 };
 
Index: trunk/src/lib/util/debug.h
===================================================================
--- trunk/src/lib/util/debug.h	(revision 9869)
+++ trunk/src/lib/util/debug.h	(revision 9869)
@@ -0,0 +1,313 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+/*!
+ * @file debug.h
+ * @briefHandles output to console for different Verbose-Modes.
+ *
+ * There are two main modes HARD and SOFT. HARD is precessed during compileTime where SOFT is for runtime.
+ * @li HARD: One can choose between different modes. see: // DEFINE_MODULES
+ * @li SOFT: If you want each module can have its own variable for processing. just pass it to DEBUG_MODULE_SOFT
+ */
+
+#ifndef _DEBUG_H
+#define _DEBUG_H
+
+#include "defs/confincl.h"
+#ifndef NO_BUFFER
+#include "debug_buffer.h"
+#endif /* NO_BUFFER */
+
+#include <stdio.h>
+
+// DEFINE ERROR MODES
+#define ORX_NONE            0
+#define ORX_ERR             1
+#define ORX_WARN            2
+#define ORX_INFO            3
+#define ORX_DEBUG           4
+#define ORX_vDEBUG          5
+
+extern int verbose;
+
+//definitions
+#ifndef MODULAR_DEBUG
+ #define HARD_DEBUG_LEVEL ORX_DEBUG
+ #define SOFT_DEBUG_LEVEL verbose
+#else /* MODULAR_DEBUG */
+ #ifndef DEBUG_MODULE_SOFT
+  #define SOFT_DEBUG_LEVEL verbose
+ #else /* DEBUG_MODULE_SOFT */
+  #define SOFT_DEBUG_LEVEL DEBUG_MODULE_SOFT
+ #endif /* DEBUG_MODULE_SOFT */
+
+ #ifndef DEBUG_SPECIAL_MODULE
+  #define HARD_DEBUG_LEVEL DEBUG
+ #else /* DEBUG_SPECIAL_MODULE */
+  ////////////////////
+  // DEFINE MODULES //
+  ////////////////////
+  // FRAMEWORK
+  #define DEBUG_MODULE_BASE                  2
+  #define DEBUG_MODULE_ORXONOX               2
+  #define DEBUG_MODULE_WORLD                 2
+  #define DEBUG_MODULE_NETWORK               2
+
+  // LOADING
+  #define DEBUG_MODULE_LOAD                  2
+  #define DEBUG_MODULE_IMPORTER              2
+
+  // ENGINES
+  #define DEBUG_MODULE_GRAPHICS              2
+  #define DEBUG_MODULE_EVENT                 2
+  #define DEBUG_MODULE_PHYSICS               2
+  #define DEBUG_MODULE_GARBAGE_COLLECTOR     2
+  #define DEBUG_MODULE_OBJECT_MANAGER        2
+  #define DEBUG_MODULE_ANIM                  2
+  #define DEBUG_MODULE_COLLISION_DETECTION   2
+  #define DEBUG_MODULE_COLLISION_REACTION    2
+  #define DEBUG_MODULE_SPATIAL_SEPARATION    2
+  #define DEBUG_MODULE_GUI                   2
+  #define DEBUG_MODULE_SOUND                 2
+
+  // MISC
+  #define DEBUG_MODULE_TRACK_MANAGER         2
+  #define DEBUG_MODULE_MATH                  2
+
+  #define DEBUG_MODULE_PNODE                 2
+  #define DEBUG_MODULE_WORLD_ENTITY          2
+
+  #define DEBUG_MODULE_STORY_ENTITY          2
+  #define DEBUG_MODULE_GAME_RULES            2
+
+  #define DEBUG_MODULE_WEAPON                2
+
+  #define HARD_DEBUG_LEVEL DEBUG_SPECIAL_MODULE
+
+ #endif /* DEBUG_SPECIAL_MODULE */
+#endif /* MODULAR_DEBUG */
+
+///////////////////////////////////////////////////
+/// PRINTF: prints with filename and linenumber ///
+///////////////////////////////////////////////////
+#define PRINTFORX_NONE    PRINTF0
+#define PRINTFORX_ERR     PRINTF1
+#define PRINTFORX_WARN    PRINTF2
+#define PRINTFORX_INFO    PRINTF3
+#define PRINTFORX_DEBUG   PRINTF4
+#define PRINTFORX_VDEBUG  PRINTF5
+
+#if DEBUG_LEVEL <= 3
+#define PRINTF(x)        PRINT(x)
+#endif
+#ifndef NO_SHELL
+#define PRINT_EXEC       DebugBuffer::addBufferLineStatic
+#define COUT_EXEC        std::cout
+#else /* NO_SHELL */
+#define PRINT_EXEC       printf
+#define COUT_EXEC        std::cout
+#endif
+
+#ifndef PRINTF
+#ifdef ORX_DEBUG
+
+#define PRINTF(x) \
+           PRINTF ## x
+
+#if HARD_DEBUG_LEVEL >= ORX_ERR
+#define PRINTF1 \
+    if (SOFT_DEBUG_LEVEL >= ORX_ERR) \
+      printf("(EE)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
+#else
+#define PRINTF1 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_WARN
+#define PRINTF2 \
+     if (SOFT_DEBUG_LEVEL >= ORX_WARN) \
+       printf("(WW)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
+
+#else
+#define PRINTF2 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_INFO
+#define PRINTF3 \
+     if (SOFT_DEBUG_LEVEL >= ORX_INFO) \
+       printf("(II)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
+#else
+#define PRINTF3 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_DEBUG
+#define PRINTF4 \
+     if (SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
+       printf("(DD)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
+#else
+#define PRINTF4 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_vDEBUG
+#define PRINTF5 \
+     if (SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
+       printf("(VD)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
+#else
+#define PRINTF5 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#else
+#define PRINTF(x) if (ORX_NONE) PRINT_EXEC
+#endif
+
+#define PRINTF0 \
+    printf("%s:%d::", __FILE__, __LINE__), PRINT_EXEC
+#endif
+
+///////////////////////////////////////////////////
+///  PRINT: just prints output as is            ///
+///////////////////////////////////////////////////
+#define PRINTORX_NONE    PRINT0
+#define PRINTORX_ERR     PRINT1
+#define PRINTORX_WARN    PRINT2
+#define PRINTORX_INFO    PRINT3
+#define PRINTORX_DEBUG   PRINT4
+#define PRINTORX_vDEBUG  PRINT5
+
+#ifdef  DEBUG_LEVEL
+#define PRINT(x) \
+  PRINT ## x
+
+#if HARD_DEBUG_LEVEL >= ORX_ERR
+#define PRINT1  \
+  if (SOFT_DEBUG_LEVEL >= ORX_ERR)  \
+    PRINT_EXEC
+#else
+#define PRINT1 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_WARN
+#define PRINT2 \
+  if (SOFT_DEBUG_LEVEL >= ORX_WARN) \
+    PRINT_EXEC
+
+#else
+#define PRINT2 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_INFO
+#define PRINT3 \
+  if (SOFT_DEBUG_LEVEL >= ORX_INFO) \
+    PRINT_EXEC
+#else
+#define PRINT3 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_DEBUG
+#define PRINT4 \
+  if (SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
+    PRINT_EXEC
+#else
+#define PRINT4 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_vDEBUG
+#define PRINT5 \
+     if (SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
+       PRINT_EXEC
+#else
+#define PRINT5 if (ORX_NONE) PRINT_EXEC
+#endif
+
+
+#else
+#define PRINT(x) if (ORX_NONE) PRINT_EXEC
+#endif
+
+#define PRINT0 \
+  PRINT_EXEC
+
+
+
+////////////////////////////////////////////////////////
+///  COUT: just prints output as is with std::cout   ///
+////////////////////////////////////////////////////////
+#define COUTORX_NONE    COUT0
+#define COUTORX_ERR     COUT1
+#define COUTORX_WARN    COUT2
+#define COUTORX_INFO    COUT3
+#define COUTORX_DEBUG   COUT4
+#define COUTORX_vDEBUG  COUT5
+
+#ifdef  DEBUG_LEVEL
+#define COUT(x) \
+  COUT ## x
+
+#if HARD_DEBUG_LEVEL >= ORX_ERR
+#define COUT1  \
+  if (SOFT_DEBUG_LEVEL >= ORX_ERR)  \
+    COUT_EXEC
+#else
+#define COUT1 if (ORX_NONE)\
+    COUT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_WARN
+#define COUT2 \
+  if (SOFT_DEBUG_LEVEL >= ORX_WARN) \
+    COUT_EXEC
+
+#else
+#define COUT2 if (ORX_NONE) \
+    COUT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_INFO
+#define COUT3 \
+  if (SOFT_DEBUG_LEVEL >= ORX_INFO) \
+    COUT_EXEC
+#else
+#define COUT3 if (ORX_NONE) \
+    COUT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_DEBUG
+#define COUT4 \
+  if (SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
+    COUT_EXEC
+#else
+#define COUT4 if (ORX_NONE) \
+    COUT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_vDEBUG
+#define COUT5 \
+     if (SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
+       COUT_EXEC
+#else
+#define COUT5 if (ORX_NONE) \
+    COUT_EXEC
+#endif
+
+
+#else
+#define COUT(x) if (ORX_NONE) \
+    COUT_EXEC
+#endif
+
+#define COUT0 \
+  COUT_EXEC
+
+
+#endif /* _DEBUG_H */
Index: trunk/src/lib/util/debug_buffer.cc
===================================================================
--- trunk/src/lib/util/debug_buffer.cc	(revision 9869)
+++ trunk/src/lib/util/debug_buffer.cc	(revision 9869)
@@ -0,0 +1,133 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#include "debug_buffer.h"
+
+#include <stdarg.h>
+
+#include "debug.h"
+#include "compiler.h"
+#include "threading.h"
+
+/**
+ * @brief standard constructor
+ */
+DebugBuffer::DebugBuffer ()
+{
+  DebugBuffer::singletonRef = this;
+
+  this->lineCount = 0;
+  this->bufferArray[0] = '\0';
+
+  this->setMaxBufferSize(100);
+}
+
+DebugBuffer* DebugBuffer::singletonRef = NULL;
+std::list<std::string> DebugBuffer::buffer;
+char DebugBuffer::bufferArray[DEBUG_BUFFER_SIZE] = "";
+
+
+/**
+ * @brief standard deconstructor
+ */
+DebugBuffer::~DebugBuffer ()
+{
+  DebugBuffer::singletonRef = NULL;
+}
+
+/**
+ * @brief deletes all the Buffers
+ */
+void DebugBuffer::flush()
+{
+  this->buffer.clear();
+}
+
+/**
+ * @brief adds a new Line to the List of Buffers
+ * @param line the Line as in the first argument in printf
+ */
+void DebugBuffer::addBufferLineStatic(const char* line, ...)
+{
+  static OrxThread::Mutex DebugBuffer__bufferMutex;
+
+  OrxThread::MutexLock bufferLock(&DebugBuffer__bufferMutex);
+
+  va_list arguments;
+  va_start(arguments, line);
+  vsnprintf(DebugBuffer::bufferArray, DEBUG_BUFFER_SIZE, line, arguments);
+  va_end(arguments);
+
+#if DEBUG_LEVEL < 3
+  if (DebugBuffer::singletonRef == NULL)
+#endif
+    printf(DebugBuffer::bufferArray);
+#if DEBUG_LEVEL < 3
+  else
+#else
+  if (DebugBuffer::singletonRef != NULL)
+#endif
+    DebugBuffer::singletonRef->addBufferLine(DebugBuffer::bufferArray);
+}
+
+/**
+ * @brief add a Line to the List of Buffers
+ * @param line
+ * @param arguments
+ *
+ * This function Adds one line to the buffer.
+ * and displays the line as the First Line of the display-buffer
+ */
+void DebugBuffer::addBufferLine(const char* line)
+{
+  std::string inputBuffer = this->keepBuffer + line;
+
+  unsigned int lineBegin = 0;
+  unsigned int lineEnd = 0;
+  // adding all the new Lines
+  while (lineEnd < inputBuffer.size())
+  {
+    lineBegin = lineEnd;
+    lineEnd = inputBuffer.find('\n', (lineBegin == 0) ? 0: ++lineBegin);
+    if (likely(lineEnd != std::string::npos ))
+    {
+      this->lineCount++;
+      this->buffer.push_front(inputBuffer.substr(lineBegin, lineEnd - lineBegin));
+    }
+    else      // No end of Line reached.
+    {
+      this->keepBuffer = inputBuffer.substr(lineBegin, inputBuffer.size() - lineBegin);
+      break;
+    }
+
+    if (inputBuffer[lineBegin] == '\n')
+      lineBegin++, lineEnd++;
+
+    if (this->buffer.size() > this->maxBufferSize)
+      this->buffer.pop_back();
+  }
+}
+
+/**
+ * @brief displays some nice output from the Debug
+ */
+void DebugBuffer::debug() const
+{
+  PRINT(3)("Debugging output to console (not this debug)\n");
+
+  std::list<std::string>::const_iterator bufferLine;
+  for (bufferLine = --this->buffer.end(); bufferLine != this->buffer.begin(); --bufferLine)
+    printf((*bufferLine).c_str());
+}
Index: trunk/src/lib/util/debug_buffer.h
===================================================================
--- trunk/src/lib/util/debug_buffer.h	(revision 9869)
+++ trunk/src/lib/util/debug_buffer.h	(revision 9869)
@@ -0,0 +1,63 @@
+/*!
+ * @file debug_buffer.h
+ * @brief The Debug buffer Tasks
+ * @see debug.h
+*/
+
+#ifndef _DEBUG_BUFFER_H
+#define _DEBUG_BUFFER_H
+
+#include <string>
+#include <list>
+
+#define      DEBUG_BUFFER_SIZE       16384         //!< The Size of the input-buffers (should be large enough to carry any kind of input)
+
+  //! A class handling output from orxonox via debug.h
+  /**
+   * the DebugBuffer redirects output from PRINTF(x) to the Debug and STDOUT
+   * the DebugBuffer is a front-filling queue of limited length, that has the
+   * youngest added Entry at the beginning, and the oldest at the end.
+   */
+  class DebugBuffer
+  {
+  public:
+    virtual ~DebugBuffer();
+    /** @returns a Pointer to the only object of this Class */
+    inline static DebugBuffer* getInstance() { if (!DebugBuffer::singletonRef) DebugBuffer::singletonRef = new DebugBuffer();  return DebugBuffer::singletonRef; };
+    /** @returns true if this class is instanciated, false otherwise */
+    inline static bool isInstanciated() { return (DebugBuffer::singletonRef == NULL)?false:true; };
+
+    static void addBufferLineStatic(const char* line, ...);
+    void addBufferLine(const char* line);
+
+    /// BUFFER
+    /** @param bufferSize the new Buffer-Size */
+    void setMaxBufferSize(unsigned int maxBufferSize) { this->maxBufferSize = maxBufferSize; };
+    void flush();
+
+    /** @returns the List of stings from the Buffer */
+    const std::list<std::string>& getBuffer() const { return this->buffer; };
+    /** @returns the Count of lines processed by the Debug. */
+    inline unsigned long getLineCount() const { return this->lineCount; };
+    /** @returns the Current Buffer Size. */
+    inline unsigned int getBufferSize() const { return this->buffer.size(); };
+
+    void debug() const;
+
+  private:
+    DebugBuffer();
+
+  private:
+    static DebugBuffer*           singletonRef;                       //!< The singleton-reference to the only memeber of this class.
+    unsigned int                  maxBufferSize;                      //!< The Size of the buffer
+
+    std::string                   keepBuffer;                         //!< a BUFFER to have multi-non-newLine commands be copied into the debug.
+
+    unsigned long                 lineCount;                          //!< how many Lines have been written out so far.
+
+    // The Beginning of buffer (buffer.front()) is the last added line.
+    static char                   bufferArray[DEBUG_BUFFER_SIZE];     //!< a BUFFER for fast writing
+    static std::list<std::string> buffer;                             //!< A list of stored char-arrays(strings) to store the history
+  };
+
+#endif /* _DEBUG_BUFFER_H */
Index: trunk/src/lib/util/executor/executor.cc
===================================================================
--- trunk/src/lib/util/executor/executor.cc	(revision 9675)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/*
-   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: Benjamin Grauer
-   co-programmer: ...
-*/
-
-//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
-
-#include "executor.h"
-
-////////////////////////
-// SHELL COMMAND BASE //
-////////////////////////
-/**
- * @brief constructs and registers a new Command
- * @param commandName the name of the Command
- * @param className the name of the class to apply this command to
- * @param paramCount the count of parameters this command takes
- */
-Executor::Executor(const MultiType& param0,
-                   const MultiType& param1,
-                   const MultiType& param2,
-                   const MultiType& param3,
-                   const MultiType& param4,
-                   const MultiType& param5,
-                   const MultiType& param6)
-{
-  this->setClassID(CL_EXECUTOR, "Executor");
-
-  // What Parameters have we got
-  this->defaultValue[0] = param0;
-  this->defaultValue[1] = param1;
-  this->defaultValue[2] = param2;
-  this->defaultValue[3] = param3;
-  this->defaultValue[4] = param4;
-  this->defaultValue[5] = param5;
-  this->defaultValue[6] = param6;
-
-  this->paramCount = 0;
-  for (unsigned int i = 0; i <= FUNCTOR_MAX_ARGUMENTS; i++)
-  {
-    if (this->defaultValue[i] == MT_NULL || i == FUNCTOR_MAX_ARGUMENTS)
-    {
-      this->paramCount = i;
-      break;
-    }
-  }
-}
-
-/**
- * deconstructs a Executor
- */
-Executor::~Executor()
-{}
-
-/**
- * clones this element into executor.
- */
-void Executor::cloning(Executor* executor) const
-{
-  executor->functorType  = this->functorType;
-  executor->paramCount   = this->paramCount;
-  for (unsigned int i = 0; i < this->paramCount; i++)
-    executor->defaultValue[i] =  this->defaultValue[i];
-}
-
-/**
- * @brief set the default values of the executor
- * @param value0 the first default value
- * @param value1 the second default value
- * @param value2 the third default value
- * @param value3 the fourth default value
- * @param value4 the fifth default value
- * @returns itself
- */
-Executor* Executor::defaultValues(const MultiType& value0,
-                                  const MultiType& value1,
-                                  const MultiType& value2,
-                                  const MultiType& value3,
-                                  const MultiType& value4,
-                                  const MultiType& value5,
-                                  const MultiType& value6)
-{
-  if (this == NULL)
-    return NULL;
-
-  const MultiType* value[5];
-  value[0] = &value0;
-  value[1] = &value1;
-  value[2] = &value2;
-  value[3] = &value3;
-  value[4] = &value4;
-  value[5] = &value5;
-  value[6] = &value6;
-  for (unsigned int i = 0; i < this->paramCount; i++)
-  {
-    if (*value[i] != MT_NULL)
-    {
-      this->defaultValue[i].setValueOf(*value[i]);
-    }
-  }
-  return this;
-}
-
-/**
- * @brief prints out nice information about the Executor
- */
-void Executor::debug()
-{
-
-}
Index: trunk/src/lib/util/executor/executor.h
===================================================================
--- trunk/src/lib/util/executor/executor.h	(revision 9675)
+++ trunk/src/lib/util/executor/executor.h	(revision 9869)
@@ -9,16 +9,25 @@
 #include "base_object.h"
 
-#include "helper_functions.h"
 #include "multi_type.h"
-#include "substring.h"
-#include "functor_list.h" //< MUST BE INCLUDED HERE AT LEAST ONCE.
-
-//! an enumerator for the definition of the Type.
-typedef enum {
-  Executor_Objective         = 1,
-  Executor_Static            = 2,
-
-  Executor_NoLoadString      = 8,
-} Executor_Type;
+
+//! The maximum Count of Arguments of the Executor
+/** This is Hardcoded, for each Executor. */
+#define EXECUTOR_MAX_ARGUMENTS                7
+
+
+/** @returns the Type of an Argument taken by the Executor */
+template<typename type> inline MT_Type ExecutorParamType() { return MT_EXT1; };
+/** @returns the Type of an Argument taken by the Executor in this case MT_BOOL */
+template<> inline MT_Type ExecutorParamType<bool>() { return MT_BOOL; };
+/** @returns the Type of an Argument taken by the Executor in this case MT_INT*/
+template<> inline MT_Type ExecutorParamType<int>() { return MT_INT; };
+/** @returns the Type of an Argument taken by the Executor in this case MT_UINT*/
+template<> inline MT_Type ExecutorParamType<unsigned int>() { return MT_UINT; };
+/** @returns the Type of an Argument taken by the Executor in this case MT_FLOAT*/
+template<> inline MT_Type ExecutorParamType<float>() { return MT_FLOAT; };
+/** @returns the Type of an Argument taken by the Executor in this case MT_CHAR*/
+template<> inline MT_Type ExecutorParamType<char>() { return MT_CHAR; };
+/** @returns the Type of an Argument taken by the Executor in this case MT_STRING*/
+template<> inline MT_Type ExecutorParamType<const std::string&>() { return MT_STRING; };
 
 ////////////////
@@ -36,53 +45,174 @@
  *  Functions with many types (@see functor_list.h)
  */
-class Executor : public BaseObject
+template <typename CallType, class BaseClass = BaseObject> class Executor
 {
-  public:
-    virtual ~Executor();
-
-    virtual Executor* clone () const = 0;
-//    virtual bool operator==(const Executor* executor) const = 0;
-
-    // SETTING up the EXECUTOR
-    Executor* defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
-                            const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
-                            const MultiType& value4 = MT_NULL, const MultiType& param5 = MT_NULL,
-                            const MultiType& param6 = MT_NULL);
-    /** @param i the i'th defaultValue, @returns reference to the MultiType */
-    inline MultiType& getDefaultValue(unsigned int i) { return defaultValue[i]; };
-
-    // EXECUTE
-    /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
-    virtual void operator()(BaseObject* object, int& count, void* values) const = 0;
-    /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */
-    virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const = 0;
-
-    // RETRIEVE INFORMATION
-    /** @returns the Type of this Function (either static or objective) */
-    inline long getType() const { return this->functorType; };
-    /** @returns the Count of Parameters this Executor takes */
-    inline unsigned int getParamCount() const { return this->paramCount; };
-
-    static void debug();
-
-  protected:
-    Executor(const MultiType& param0 = MT_NULL, const MultiType& param1 = MT_NULL,
-             const MultiType& param2 = MT_NULL, const MultiType& param3 = MT_NULL,
-             const MultiType& param4 = MT_NULL, const MultiType& param5 = MT_NULL,
-             const MultiType& param6 = MT_NULL);
-
-    void cloning(Executor* executor) const;
-
-  protected:
-    short                       functorType;      //!< The type of Function we've got (either static or objective).
-    unsigned int                paramCount;       //!< the count of parameters.
-    MultiType                   defaultValue[7];  //!< Default Values.
+public:
+  //! an enumerator for the definition of the Type.
+  typedef enum {
+    FunctionMember,      //!< The function is neither Static nor Constant
+    FunctionStatic,      //!< The Function is Static and pointing to either a Static Member or a C-style function.
+    FunctionConstMember, //!< The Function is Constant and pointing to a Member that does not change the Object.
+  } FunctionType;
+
+public:
+  virtual ~Executor() {};
+
+  // RETRIEVE INFORMATION
+  /** @param i the i'th defaultValue, @returns reference to the MultiType */
+  inline MultiType& getDefaultValue(unsigned int i) { return defaultValue[i]; };
+  /** @returns the default Values as a List */
+  inline const MultiType* const getDefaultValues() { return defaultValue; };
+
+  /** @returns the Type of this Function (either static or objective) */
+  inline FunctionType getType() const { return this->functionType; };
+
+  /** @returns the Count of Parameters this Executor takes */
+  inline unsigned int getParamCount() const { return this->paramCount; };
+  /** @returns true if the Executor has a return Value. */
+  inline bool hasRetVal() const { return bRetVal; };
+
+  /** executes a Command. @param object the Object, @param values The Value of type CallType to pass to the Executor. */
+  virtual void operator()(BaseClass* object, CallType& values) const = 0;
+
+  /**
+   * @brief set the default values of the executor
+   * @param value0 the first default value
+   * @param value1 the second default value
+   * @param value2 the third default value
+   * @param value3 the fourth default value
+   * @param value4 the fifth default value
+   * @param value5 the sixth default value
+   * @param value6 the seventh default value
+   * @returns itself
+   * @note: THIS FUNCTION WILL BE REPLACED BY A CONFIGURATOR (most probably).
+  */
+  Executor* defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
+                          const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
+                          const MultiType& value4 = MT_NULL, const MultiType& value5 = MT_NULL,
+                          const MultiType& value6 = MT_NULL)
+  {
+    const MultiType* value[5];
+    value[0] = &value0;
+    value[1] = &value1;
+    value[2] = &value2;
+    value[3] = &value3;
+    value[4] = &value4;
+    value[5] = &value5;
+    value[6] = &value6;
+    for (unsigned int i = 0; i < this->paramCount; i++)
+    {
+      if (*value[i] != MT_NULL)
+      {
+        this->defaultValue[i].setValueOf(*value[i]);
+        this->defaultValue[i].storeString();
+      }
+    }
+    return this;
+  }
+
+  /** @returns the Clone as a new Copy of the Executor. */
+  virtual Executor<CallType, BaseClass>* clone () const = 0;
+
+
+protected:
+  //! Now follows a List of Executor Constructors, to be fast in creating.
+  //! Creates an Executor with no Argument.
+  Executor(bool hasRetVal, FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(0), functionType(functionType)
+  { };
+
+  //! Creates an Executor with 1 Argument.
+  Executor(bool hasRetVal, const MultiType& param0,
+	   FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(1), functionType(functionType)
+  {
+    this->defaultValue[0] = param0;
+  };
+
+  //! Creates an Executor with 2 Arguments.
+  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
+	   FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(2), functionType(functionType)
+  {
+    this->defaultValue[0] = param0;
+    this->defaultValue[1] = param1;
+  };
+
+  //! Creates an Executor with 3 Arguments.
+  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
+	   const MultiType& param2,
+	   FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(3), functionType(functionType)
+  {
+    this->defaultValue[0] = param0;
+    this->defaultValue[1] = param1;
+    this->defaultValue[2] = param2;
+  };
+
+  //! Creates an Executor with 4 Arguments.
+  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
+	   const MultiType& param2, const MultiType& param3,
+	   FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(4), functionType(functionType)
+  {
+    this->defaultValue[0] = param0;
+    this->defaultValue[1] = param1;
+    this->defaultValue[2] = param2;
+    this->defaultValue[3] = param3;
+  };
+
+  //! Creates an Executor with 5 Arguments.
+  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
+	   const MultiType& param2, const MultiType& param3,
+	   const MultiType& param4,
+	   FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(5), functionType(functionType)
+  {
+    this->defaultValue[0] = param0;
+    this->defaultValue[1] = param1;
+    this->defaultValue[2] = param2;
+    this->defaultValue[3] = param3;
+    this->defaultValue[4] = param4;
+  };
+
+  //! Creates an Executor with 6 Arguments.
+  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
+	   const MultiType& param2, const MultiType& param3,
+	   const MultiType& param4, const MultiType& param5,
+	   FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(6), functionType(functionType)
+  {
+    this->defaultValue[0] = param0;
+    this->defaultValue[1] = param1;
+    this->defaultValue[2] = param2;
+    this->defaultValue[3] = param3;
+    this->defaultValue[4] = param4;
+    this->defaultValue[5] = param5;
+  };
+
+  //! Creates an Executor with 7 Arguments.
+  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
+	   const MultiType& param2, const MultiType& param3,
+	   const MultiType& param4, const MultiType& param5,
+	   const MultiType& param6,
+	   FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(7), functionType(functionType)
+  {
+    this->defaultValue[0] = param0;
+    this->defaultValue[1] = param1;
+    this->defaultValue[2] = param2;
+    this->defaultValue[3] = param3;
+    this->defaultValue[4] = param4;
+    this->defaultValue[5] = param5;
+    this->defaultValue[6] = param6;
+  };
+
+protected:
+  const bool                  bRetVal;          //!< True if the Executor has a return Value.
+  const unsigned int          paramCount;       //!< the count of parameters.
+  MultiType                   defaultValue[7];  //!< Default Values.
+
+  const FunctionType          functionType;     //!< What Type of Function it is.
 };
 
-#include "executor/executor_functional.h"
-#define EXECUTOR_FUNCTIONAL_USE_CONST
-#include "executor/executor_functional.h"
-#define EXECUTOR_FUNCTIONAL_USE_STATIC
-#include "executor/executor_functional.h"
-
 #endif /* _EXECUTOR_H */
Index: trunk/src/lib/util/executor/executor_const_member.h
===================================================================
--- trunk/src/lib/util/executor/executor_const_member.h	(revision 9869)
+++ trunk/src/lib/util/executor/executor_const_member.h	(revision 9869)
@@ -0,0 +1,49 @@
+/*!
+ * @file executor_const_member.h
+ * Definition of an Executor to Member Functions
+ */
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+
+#ifndef __EXECUTOR_CONST_MEMBER_H_
+#define __EXECUTOR_CONST_MEMBER_H_
+
+/// Define all Constructs, that define an Executor.
+//! The Name to be attached to the functional (for normal, static, and const modes)
+#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount, Ext)   Executor##ParamCount##Ext##_const
+
+//! if Functional is constant calling
+#define __EXECUTOR_FUNCTIONAL_CONST              const
+//! The Execution-mode (either static or objective)
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC      dynamic_cast<T*>(object)->*(functionPointer)
+//! The Function-Pointer, and how to save it internally.
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   T::*functionPointer
+//! The Type of Function
+#define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE       Executor<CallType, BaseClass>::FunctionConstMember
+
+
+/// We want to include __EXECUTOR_GENERIC_H again, with current settings.
+
+#include "executor_generic.h"
+
+#undef __EXECUTOR_FUNCTIONAL_NAME
+
+#undef __EXECUTOR_FUNCTIONAL_CONST
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
+#undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE
+
+#endif /* __EXECUTOR_CONST_MEMBER_H_ */
Index: trunk/src/lib/util/executor/executor_functional.cc
===================================================================
--- trunk/src/lib/util/executor/executor_functional.cc	(revision 9675)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
-   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: Benjamin Grauer
-   co-programmer: ...
-*/
-
-#include "executor.h"
-std::string ExecutorFunctional_returningString_from[7];
-
-
-template<> MT_Type ExecutorParamType<bool>() { return MT_BOOL; };
-template<> MT_Type ExecutorParamType<int>() { return MT_INT; };
-template<> MT_Type ExecutorParamType<unsigned int>() { return MT_UINT; };
-template<> MT_Type ExecutorParamType<float>() { return MT_FLOAT; };
-template<> MT_Type ExecutorParamType<char>() { return MT_CHAR; };
-template<> MT_Type ExecutorParamType<const std::string&>() { return MT_STRING; };
-
-template<> bool fromString<bool>(const std::string& input, bool defaultValue) { return isBool(input, defaultValue); };
-template<> int fromString<int>(const std::string& input, int defaultValue) { return isInt(input, defaultValue); };
-template<> unsigned int fromString<unsigned int>(const std::string& input, unsigned int defaultValue) { return isInt(input, defaultValue); };
-template<> float fromString<float>(const std::string& input, float defaultValue) { return isFloat(input, defaultValue); };
-template<> char fromString<char>(const std::string& input, char defaultValue) { return isInt(input, defaultValue); };
-template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue) { return (input.size() > 0) ? input : defaultValue; };
-
-
-template<> bool fromMulti<bool>(const MultiType& multi) { return multi.getBool(); };
-template<> int fromMulti<int>(const MultiType& multi) { return multi.getInt(); }
-template<> unsigned int fromMulti<unsigned int>(const MultiType& multi) { return multi.getInt(); };
-template<> float fromMulti<float>(const MultiType& multi) { return multi.getFloat(); };
-template<> char fromMulti<char>(const MultiType& multi) { return multi.getChar(); };
-template<> const std::string& fromMulti<const std::string&>(const MultiType& multi) { return multi.getConstString(); };
-
-
-template<> bool getDefault<bool>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getBool(); };
-template<> int getDefault<int>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getInt(); };
-template<> unsigned int getDefault<unsigned int>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getInt(); };
-template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getFloat(); };
-template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getChar(); };
-template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i) { return ExecutorFunctional_returningString_from[i] = defaultValues[i].getString(); };
-
-
-
-
-
-
-
-/**
- * A LITTLE TESTING SUITE FOR THE EXECUTOR.
- *
-#include "executor/executor_functional.h"
-
-#define EXECUTOR_FUNCTIONAL_USE_STATIC
-#include "executor/executor_functional.h"
-
-class TestClass : public BaseObject
-{
-  public:
-    TestClass() {};
-
-    void printTest() { printf ("TEST\n"); };
-    void printTestInt(int i) { printf ("%d\n", i); };
-    void printTestBool(bool b) { printf("%d\n", (int)b); };
-    void printTwoVals(int b, int i) { printf ("%d %d\n", b, i); };
-    void printStrings(const std::string& name) { printf("String:: '%s'\n", name.c_str()); };
-    static void printStatic() { printf("STATIC\n");};
-};
-
-void TEST()
-{
-  TestClass test;
-  SubString testStrings("1 SCHEISSE, 2, 3", ",", SubString::WhiteSpaces, false);
-  (*createExecutor<TestClass>(&TestClass::printTest))(&test, testStrings);
-  (*createExecutor<TestClass>(&TestClass::printTestInt))(&test, testStrings);
-  (*createExecutor<TestClass>(&TestClass::printTestBool))(&test, testStrings);
-  (*createExecutor<TestClass>(&TestClass::printTwoVals))(&test, testStrings);
-  (*createExecutor<TestClass>(&TestClass::printStatic))(&test, testStrings);
-  (*createExecutor<TestClass>(&TestClass::printStrings))(&test, testStrings);
-
-}
-*/
Index: trunk/src/lib/util/executor/executor_functional.h
===================================================================
--- trunk/src/lib/util/executor/executor_functional.h	(revision 9675)
+++ 	(revision )
@@ -1,514 +1,0 @@
-/*!
- * @file executor_functional.h
- * Definition of an Executor
- */
-
-/*
-   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: Benjamin Grauer
-   co-programmer: ...
-*/
-
-
-#ifndef __EXECUTOR_FUNCTIONAL_H_
-#define __EXECUTOR_FUNCTIONAL_H_
-
-#include "executor.h"
-
-template<typename type> MT_Type ExecutorParamType() { return MT_EXT1; };
-template<> MT_Type ExecutorParamType<bool>();
-template<> MT_Type ExecutorParamType<int>();
-template<> MT_Type ExecutorParamType<unsigned int>();
-template<> MT_Type ExecutorParamType<float>();
-template<> MT_Type ExecutorParamType<char>();
-template<> MT_Type ExecutorParamType<const std::string&>();
-
-template<typename type> type fromString(const std::string& input, type defaultValue) { return defaultValue; };
-template<> bool fromString<bool>(const std::string& input, bool defaultValue);
-template<> int fromString<int>(const std::string& input, int defaultValue);
-template<> unsigned int fromString<unsigned int>(const std::string& input, unsigned int defaultValue);
-template<> float fromString<float>(const std::string& input, float defaultValue);
-template<> char fromString<char>(const std::string& input, char defaultValue);
-template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue);
-
-template<typename type> type fromMulti(const MultiType& multi) { /* return defaultValue; */ };
-template<> bool fromMulti<bool>(const MultiType& multi);
-template<> int fromMulti<int>(const MultiType& multi);
-template<> unsigned int fromMulti<unsigned int>(const MultiType& multi);
-template<> float fromMulti<float>(const MultiType& multi);
-template<> char fromMulti<char>(const MultiType& multi);
-template<> const std::string& fromMulti<const std::string&>(const MultiType& multi);
-
-
-template<typename type> type getDefault(const MultiType* const defaultValues, unsigned int i) { return (type)0; };
-template<> bool getDefault<bool>(const MultiType* const defaultValues, unsigned int i);
-template<> int getDefault<int>(const MultiType* const defaultValues, unsigned int i);
-template<> unsigned int getDefault<unsigned int>(const MultiType* const defaultValues, unsigned int i);
-template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i);
-template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i);
-template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i);
-
-#endif /* __EXECUTOR_FUNCTIONAL_H_ */
-
-//! if Functional is constant calling
-#define __EXECUTOR_FUNCTIONAL_CONST
-//! The Name to be attached to the functional (for normal, static, and const modes)
-#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount)   Executor##ParamCount##Params
-//! The Execution-mode (either static or objective)
-#define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC      dynamic_cast<T*>(object)->*(functionPointer)
-//! The Function-Pointer, and how to save it internally.
-#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   T::*functionPointer
-
-#ifdef EXECUTOR_FUNCTIONAL_USE_CONST
- #undef __EXECUTOR_FUNCTIONAL_CONST
- #define __EXECUTOR_FUNCTIONAL_CONST const
- #undef __EXECUTOR_FUNCTIONAL_NAME
- #define __EXECUTOR_FUNCTIONAL_NAME(ParamCount) Executor##ParamCount##Params_const
-#endif
-
-#ifdef EXECUTOR_FUNCTIONAL_USE_STATIC
- #ifdef EXECUTOR_FUNCTIONAL_USE_CONST
-  #error you obviously do not know what you are doing !! ask the bensch
- #endif /* EXECUTOR_FUNCTIONAL_USE_CONST */
-
-#undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC
- #define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC       functionPointer
- #undef __EXECUTOR_FUNCTIONAL_NAME
- #define __EXECUTOR_FUNCTIONAL_NAME(ParamCount)    Executor##ParamCount##Params_static
- #undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
- #define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER    *functionPointer
-
-#endif /* EXECUTOR_FUNCTIONAL_USE_STATIC */
-
-///////////
-//// 0 ////
-///////////
-//! @brief ExecutorClass, that can execute Functions without any parameters.
-template<class T> class __EXECUTOR_FUNCTIONAL_NAME(0) : public Executor
-{
-private:
-  /** @brief the FunctioPointer. */
-  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST;
-
-public:
-  /**
-   * @brief constructs the Executor.
-   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
-   */
-  __EXECUTOR_FUNCTIONAL_NAME(0) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST )
-      : Executor()
-  {
-    this->functorType = Executor_Objective;
-    this->functionPointer = functionPointer;
-  };
-
-  /**
-   * @brief executes the Functional
-   * @param object the Object the action should be executed on.
-   * @param sub the SubString to get the Parameters from.
-   */
-  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
-  {
-    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();
-  };
-
-  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
-  virtual void operator()(BaseObject* object, int& count, void* values) const
-  {
-    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();
-  }
-
-  /**
-   * @brief copies the Executor
-   * @returns a new Executor that's a copy of this one.
-   */
-  virtual Executor* clone() const
-  {
-    return new __EXECUTOR_FUNCTIONAL_NAME(0)<T>(this->functionPointer);
-  };
-};
-
-
-
-///////////
-//// 1 ////
-///////////
-//! @brief ExecutorClass, that can execute Functions with one parameter.
-template<class T, typename type0> class __EXECUTOR_FUNCTIONAL_NAME(1) : public Executor
-{
-private:
-  /** @brief the FunctioPointer. */
-  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST;
-
-public:
-  /**
-   * @brief constructs the Executor.
-   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
-   */
-  __EXECUTOR_FUNCTIONAL_NAME(1) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST)
-      : Executor(ExecutorParamType<type0>())
-  {
-    this->functorType = Executor_Objective;
-    this->functionPointer = functionPointer;
-  };
-
-  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
-  virtual void operator()(BaseObject* object, int& count, void* values) const
-  {
-    const MultiType* mt = (const MultiType*)values;
-    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-             fromMulti<type0>((count > 0)? mt[0] : this->defaultValue[0]) );
-  }
-
-
-  /**
-   * @brief executes the Functional
-   * @param object the Object the action should be executed on.
-   * @param sub the SubString to get the Parameters from.
-   */
-  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
-  {
-    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])));
-  };
-
-  /**
-   * @brief copies the Executor
-   * @returns a new Executor that's a copy of this one.
-   */
-  virtual Executor* clone() const
-  {
-    return  new __EXECUTOR_FUNCTIONAL_NAME(1)<T, type0>(this->functionPointer);
-  };
-};
-
-///////////
-//// 2 ////
-///////////
-//! @brief ExecutorClass, that can execute Functions with two parameters.
-template<class T, typename type0, typename type1> class __EXECUTOR_FUNCTIONAL_NAME(2) : public Executor
-{
-private:
-  /** @brief the FunctioPointer. */
-  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST;
-
-public:
-  /**
-   * @brief constructs the Executor.
-   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
-   */
-  __EXECUTOR_FUNCTIONAL_NAME(2) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST)
-      : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>())
-  {
-    this->functorType = Executor_Objective;
-    this->functionPointer = functionPointer;
-  };
-
-  /**
-   * @brief executes the Functional
-   * @param object the Object the action should be executed on.
-   * @param sub the SubString to get the Parameters from.
-   */
-  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
-  {
-    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
-      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])));
-  };
-
-  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
-  virtual void operator()(BaseObject* object, int& count, void* values) const
-  {
-    const MultiType* mt = (const MultiType*)values;
-    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
-             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]) );
-  }
-
-  /**
-   * @brief copies the Executor
-   * @returns a new Executor that's a copy of this one.
-   */
-  virtual Executor* clone() const
-  {
-    return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, type0, type1>(this->functionPointer);
-  };
-};
-
-
-///////////
-//// 3 ////
-///////////
-//! @brief ExecutorClass, that can execute Functions with three parameters.
-template<class T, typename type0, typename type1, typename type2> class __EXECUTOR_FUNCTIONAL_NAME(3) : public Executor
-{
-private:
-  /** @brief the FunctioPointer. */
-  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST;
-
-public:
-  /**
-   * @brief constructs the Executor.
-   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
-   */
-  __EXECUTOR_FUNCTIONAL_NAME(3) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST)
-      : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
-  {
-    this->functorType = Executor_Objective;
-    this->functionPointer = functionPointer;
-  };
-
-  /**
-   * @brief executes the Functional
-   * @param object the Object the action should be executed on.
-   * @param sub the SubString to get the Parameters from.
-   */
-  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
-  {
-    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
-      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
-      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])));
-  };
-
-  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
-  virtual void operator()(BaseObject* object, int& count, void* values) const
-  {
-    const MultiType* mt = (const MultiType*)values;
-    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
-             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
-             fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]) );
-  }
-
-  /**
-   * @brief copies the Executor
-   * @returns a new Executor that's a copy of this one.
-   */
-  virtual Executor* clone() const
-  {
-    return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, type0, type1, type2>(this->functionPointer);
-  };
-};
-
-
-
-///////////
-//// 4 ////
-///////////
-//! @brief ExecutorClass, that can execute Functions with four parameters.
-template<class T, typename type0, typename type1, typename type2, typename type3> class __EXECUTOR_FUNCTIONAL_NAME(4) : public Executor
-{
-private:
-  /** @brief the FunctioPointer. */
-  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST;
-
-public:
-  /**
-   * @brief constructs the Executor.
-   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
-   */
-  __EXECUTOR_FUNCTIONAL_NAME(4) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST)
-      : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
-  {
-    this->functorType = Executor_Objective;
-    this->functionPointer = functionPointer;
-  };
-
-  /**
-  * @brief executes the Functional
-  * @param object the Object the action should be executed on.
-  * @param sub the SubString to get the Parameters from.
-   */
-  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
-  {
-    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
-      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
-      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])),
-      (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3])));
-  };
-
-  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
-  virtual void operator()(BaseObject* object, int& count, void* values) const
-  {
-    const MultiType* mt = (const MultiType*)values;
-    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
-             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
-             fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]),
-             fromMulti<type3>((count > 3) ? mt[3] : this->defaultValue[3]) );
-  }
-
-  /**
-   * @brief copies the Executor
-   * @returns a new Executor that's a copy of this one.
-   */
-  virtual Executor* clone() const
-  {
-    return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, type0, type1, type2, type3>(this->functionPointer);
-  };
-};
-
-
-
-///////////
-//// 5 ////
-///////////
-//! @brief ExecutorClass, that can execute Functions with five parameters.
-template<class T, typename type0, typename type1, typename type2, typename type3, typename type4> class __EXECUTOR_FUNCTIONAL_NAME(5) : public Executor
-{
-private:
-  /** @brief the FunctioPointer. */
-  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST;
-
-public:
-  /**
-   * @brief constructs the Executor.
-   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
-   */
-  __EXECUTOR_FUNCTIONAL_NAME(5) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST)
-      : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>())
-  {
-    this->functorType = Executor_Objective;
-    this->functionPointer = functionPointer;
-  };
-
-  /**
-  * @brief executes the Functional
-  * @param object the Object the action should be executed on.
-  * @param sub the SubString to get the Parameters from.
-   */
-  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
-  {
-    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
-      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
-      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])),
-      (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3])),
-      (sub.size() > 4) ? fromString<type4>(sub[4], getDefault<type4>(this->defaultValue, 4)) : (fromMulti<type4>(this->defaultValue[4])));
-  };
-
-  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
-  virtual void operator()(BaseObject* object, int& count, void* values) const
-  {
-    const MultiType* mt = (const MultiType*)values;
-    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
-             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
-             fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]),
-             fromMulti<type3>((count > 3) ? mt[3] : this->defaultValue[3]),
-             fromMulti<type4>((count > 4) ? mt[4] : this->defaultValue[4]) );
-  }
-
-  /**
-   * @brief copies the Executor
-   * @returns a new Executor that's a copy of this one.
-   */
-  virtual Executor* clone() const
-  {
-    return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, type0, type1, type2, type3, type4>(this->functionPointer);
-  };
-};
-
-
-
-/**
- * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
- */
-#define EXECUTOR_FUNCTIONAL_CREATOR0() \
-template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \
-{ \
-  return new __EXECUTOR_FUNCTIONAL_NAME(0)<T>(functionPointer); \
-}
-
-/**
- * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
- * @param type0 for internal usage: the first Argument
- */
-#define EXECUTOR_FUNCTIONAL_CREATOR1(type0) \
-template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
-{ \
-  return new __EXECUTOR_FUNCTIONAL_NAME(1)<T, type0##_TYPE>(functionPointer); \
-}
-
-/**
- * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
- * @param type0 for internal usage: the first Argument
- * @param type1 for internal usage: the second Argument
- */
-#define EXECUTOR_FUNCTIONAL_CREATOR2(type0, type1) \
-template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
-{ \
-  return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, type0##_TYPE, type1##_TYPE>(functionPointer); \
-}
-
-/**
- * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
- * @param type0 for internal usage: the first Argument
- * @param type1 for internal usage: the second Argument
- * @param type2 for internal usage: the third Argument
- */
-#define EXECUTOR_FUNCTIONAL_CREATOR3(type0, type1, type2) \
-template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
-{ \
-  return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE>(functionPointer); \
-}
-
-/**
- * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
- * @param type0 for internal usage: the first Argument
- * @param type1 for internal usage: the second Argument
- * @param type2 for internal usage: the third Argument
- * @param type3 for internal usage: the fourth Argument
- */
-#define EXECUTOR_FUNCTIONAL_CREATOR4(type0, type1, type2, type3) \
-template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
-{ \
-  return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE>(functionPointer); \
-}
-
-/**
- * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
- * @param type0 for internal usage: the first Argument
- * @param type1 for internal usage: the second Argument
- * @param type2 for internal usage: the third Argument
- * @param type3 for internal usage: the fourth Argument
- * @param type4 for internal usage: the fifth Argument
- */
-#define EXECUTOR_FUNCTIONAL_CREATOR5(type0, type1, type2, type3, type4) \
-template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
-{ \
-    return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE>(functionPointer); \
-}
-
-
-/**
- * Creates the FunctionCallers
- */
-#define FUNCTOR_LIST(x) EXECUTOR_FUNCTIONAL_CREATOR ## x
-#include "functor_list.h"
-#undef FUNCTOR_LIST
-
-
-
-#undef __EXECUTOR_FUNCTIONAL_CONST
-#undef __EXECUTOR_FUNCTIONAL_NAME
-#undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC
-#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
-
-#ifdef EXECUTOR_FUNCTIONAL_USE_CONST
- #undef EXECUTOR_FUNCTIONAL_USE_CONST
-#endif
-#ifdef EXECUTOR_FUNCTIONAL_USE_STATIC
- #undef EXECUTOR_FUNCTIONAL_USE_STATIC
-#endif
Index: trunk/src/lib/util/executor/executor_generic.h
===================================================================
--- trunk/src/lib/util/executor/executor_generic.h	(revision 9869)
+++ trunk/src/lib/util/executor/executor_generic.h	(revision 9869)
@@ -0,0 +1,456 @@
+/*!
+ * @file executor_generic.h
+ * Definition of a Generic Executor
+ */
+
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+
+
+#ifndef __EXECUTOR_GENERIC_H_
+#define __EXECUTOR_GENERIC_H_
+
+
+#include "executor.h"
+/**
+ * @brief this is a Template Class used as an evaluater.
+ *
+ * Trait to determine a default Value for any Type,
+ * and to define the Convertible, and how it is transformed into the
+ * corresponding SubTypes over the operator().
+ *
+ * This Class must be reimplemented for each Convertible and all of its
+ *  conversion-members.
+ *
+ * e.g: Convertible SubSting, that splits up into many Stings
+ *      conversion-members: (int) can be transformed from a String.
+ */
+template<typename FromType> class ExecutorEvaluater
+{
+public:
+  /** @brief Executes the Evaluater
+   * @param CallValue the Value that should be converted
+   * @param defaults the default Values.
+   */
+  template <typename ToType, int index>
+  static ToType getValue(FromType& CallValue, const MultiType* const defaults)
+  {
+    assert(0 && "Might want to extend the ExecutorEvaluater::getValue function in an 'Explicit Specialized Template Class'");
+    return defaultValue;
+  }
+  /** @param @storeTo Stores the returned value here. @param value The Value to Store. @note invers of getValue */
+  static void storeRet(FromType& storeTo, FromType value)
+  {
+    assert (0 && "Might want to extend the ExecutorEvaluater::storeRet function in an 'Explicit Specialized Template Class'");
+  }
+  /** @returns the Default Value of ToType */
+  static FromType& defaultValue() { static FromType defaultValue; return defaultValue; };
+};
+#endif /* __EXECUTOR_GENERIC_H_ */
+
+
+#ifdef __EXECUTOR_FUNCTIONAL_NAME
+///////////
+//// 0 ////
+///////////
+//! @brief ExecutorClass, that can execute Functions without any parameters.
+template<class T, typename CallType, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(0,) :public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(0,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST )
+      : Executor<CallType, BaseClass>(false, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+   * @brief executes the Functional
+   * @param object the Object the action should be executed on.
+   * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();
+  };
+
+  /**
+   * @brief copies the Executor
+   * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return new __EXECUTOR_FUNCTIONAL_NAME(0,)<T, CallType, BaseClass>(this->functionPointer);
+  };
+};
+
+
+
+///////////
+//// 1 ////
+///////////
+//! @brief ExecutorClass, that can execute Functions with one parameter.
+template<class T, typename CallType, typename type0, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(1,) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(1,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+   * @brief executes the Functional
+   * @param object the Object the action should be executed on.
+   * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
+	Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue));
+  };
+
+  /**
+   * @brief copies the Executor
+   * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return  new __EXECUTOR_FUNCTIONAL_NAME(1,)<T, CallType, type0, BaseClass>(this->functionPointer);
+  };
+};
+
+
+
+///////////
+//// 2 ////
+///////////
+//! @brief ExecutorClass, that can execute Functions with two parameters.
+template<class T, typename CallType, typename type0, typename type1, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(2,) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(2,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+   * @brief executes the Functional
+   * @param object the Object the action should be executed on.
+   * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
+      Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue));
+  };
+
+  /**
+   * @brief copies the Executor
+   * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return new __EXECUTOR_FUNCTIONAL_NAME(2,)<T, CallType, type0, type1, BaseClass>(this->functionPointer);
+  };
+};
+
+
+
+///////////
+//// 3 ////
+///////////
+//! @brief ExecutorClass, that can execute Functions with three parameters.
+template<class T, typename CallType, typename type0, typename type1, typename type2, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(3,) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(3,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+   * @brief executes the Functional
+   * @param object the Object the action should be executed on.
+   * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
+      Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type2, 2>(eval, this->defaultValue));
+  };
+
+  /**
+   * @brief copies the Executor
+   * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return new __EXECUTOR_FUNCTIONAL_NAME(3,)<T, CallType, type0, type1, type2, BaseClass>(this->functionPointer);
+  };
+};
+
+
+
+///////////
+//// 4 ////
+///////////
+//! @brief ExecutorClass, that can execute Functions with four parameters.
+template<class T, typename CallType, typename type0, typename type1, typename type2, typename type3, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(4,) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(4,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+  * @brief executes the Functional
+  * @param object the Object the action should be executed on.
+  * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
+      Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type2, 2>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type3, 3>(eval, this->defaultValue));
+  };
+
+  /**
+   * @brief copies the Executor
+   * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return new __EXECUTOR_FUNCTIONAL_NAME(4,)<T, CallType, type0, type1, type2, type3, BaseClass>(this->functionPointer);
+  };
+};
+
+
+
+///////////
+//// 5 ////
+///////////
+//! @brief ExecutorClass, that can execute Functions with five parameters.
+template<class T, typename CallType, typename type0, typename type1, typename type2, typename type3, typename type4, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(5,) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(5,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+  * @brief executes the Functional
+  * @param object the Object the action should be executed on.
+  * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
+      Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type2, 2>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type3, 3>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type4, 4>(eval, this->defaultValue));
+  };
+
+  /**
+   * @brief copies the Executor
+   * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return new __EXECUTOR_FUNCTIONAL_NAME(5,)<T, CallType, type0, type1, type2, type3, type4, BaseClass>(this->functionPointer);
+  };
+};
+
+
+////////////////////
+//// 0 & RETURN ////
+////////////////////
+//! @brief ExecutorClass, that can execute Functions with one parameter.
+template<class T, typename CallType, typename ReturnType, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(0,ret) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(0,ret) (ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(true, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+     * @brief executes the Functional
+     * @param object the Object the action should be executed on.
+     * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    Evaluater<CallType>::template storeRet<ReturnType>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)());
+  };
+
+  /**
+     * @brief copies the Executor
+     * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return  new __EXECUTOR_FUNCTIONAL_NAME(0,ret)<T, CallType, ReturnType, BaseClass>(this->functionPointer);
+  };
+};
+
+////////////////////
+//// 1 & RETURN ////
+////////////////////
+//! @brief ExecutorClass, that can execute Functions with one parameter.
+template<class T, typename CallType, typename ReturnType, typename type0, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(1,ret) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(1,ret) (ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(true, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+     * @brief executes the Functional
+     * @param object the Object the action should be executed on.
+     * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    Evaluater<CallType>::template storeRet<ReturnType>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
+          Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue)));
+  };
+
+  /**
+     * @brief copies the Executor
+     * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return  new __EXECUTOR_FUNCTIONAL_NAME(1,ret)<T, CallType, ReturnType, type0, BaseClass>(this->functionPointer);
+  };
+};
+
+
+////////////////////
+//// 2 & RETURN ////
+////////////////////
+//! @brief ExecutorClass, that can execute Functions with one parameter.
+template<class T, typename CallType, typename ReturnType, typename type0, typename type1, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(2,ret) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(2,ret) (ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(true, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+     * @brief executes the Functional
+     * @param object the Object the action should be executed on.
+     * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    Evaluater<CallType>::template storeRet<ReturnType>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
+          Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue),
+          Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue)));
+  };
+
+  /**
+     * @brief copies the Executor
+     * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return  new __EXECUTOR_FUNCTIONAL_NAME(2,ret)<T, CallType, ReturnType, type0, type1, BaseClass>(this->functionPointer);
+  };
+};
+
+#endif /* __EXECUTOR_FUNCTIONAL_NAME */
Index: trunk/src/lib/util/executor/executor_lua.cc
===================================================================
--- trunk/src/lib/util/executor/executor_lua.cc	(revision 9675)
+++ 	(revision )
@@ -1,39 +1,0 @@
-/*
-   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: ...
-   co-programmer: ...
-*/
-
-//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
-
-#include "executor_lua.h"
-
-#include "lunar.h"
-
-std::string temp[7];
-
-template<typename type> type fromLua(lua_State* state, int index) { type *obj = Lunar<type>::check(state, 1); lua_remove(state, 1); return obj;};
-template<> bool fromLua<bool>(lua_State* state, int index) { return lua_toboolean(state, index); };
-template<> int fromLua<int>(lua_State* state, int index) { return (int)lua_tonumber(state, index); };
-template<> unsigned int fromLua<unsigned int>(lua_State* state, int index) { return (unsigned int)lua_tonumber(state, index); };
-template<> float fromLua<float>(lua_State* state, int index) { return (float)lua_tonumber(state, index); };
-template<> char fromLua<char>(lua_State* state, int index) { return (char)lua_tonumber(state, index); };
-template<> const std::string& fromLua<const std::string&>(lua_State* state, int index) { temp[index] = lua_tostring(state, index); return temp[index]; };
-
-
-template<typename type> void toLua(lua_State* state, type value) { Lunar<type>::push(state, value, false); };
-template<> void toLua<bool>(lua_State* state, bool value) { lua_pushboolean(state, (int) value); };
-template<> void toLua<int>(lua_State* state, int value)  { lua_pushnumber(state, (lua_Number) value); };
-template<> void toLua<unsigned int>(lua_State* state, unsigned int value){ lua_pushnumber(state, (lua_Number) value); };
-template<> void toLua<float>(lua_State* state, float value) { lua_pushnumber(state, (lua_Number) value); };
-template<> void toLua<char>(lua_State* state, char value) { lua_pushnumber(state, (lua_Number) value); };
-template<> void toLua<const std::string&>(lua_State* state, const std::string& value) { lua_pushstring (state, value.c_str()); }
Index: trunk/src/lib/util/executor/executor_lua.h
===================================================================
--- trunk/src/lib/util/executor/executor_lua.h	(revision 9675)
+++ 	(revision )
@@ -1,708 +1,0 @@
-/*!
- * @file executor.h
- * Definition of a on-screen-shell
- */
-
-#ifndef _EXECUTOR_LUA_H
-#define _EXECUTOR_LUA_H
-
-#include "executor.h"
-#include "compiler.h"
-#include "debug.h"
-#include "luaincl.h"
-
-
-
-template<typename type> type fromLua(lua_State* state, int index);
-template<> bool fromLua<bool>(lua_State* state, int index);
-template<> int fromLua<int>(lua_State* state, int index);
-template<> unsigned int fromLua<unsigned int>(lua_State* state, int index);
-template<> float fromLua<float>(lua_State* state, int index);
-template<> char fromLua<char>(lua_State* state, int index);
-template<> const std::string& fromLua<const std::string&>(lua_State* state, int index);
-
-template<typename type> void toLua(lua_State* state, type value);
-template<> void toLua<bool>(lua_State* state, bool value);
-template<> void toLua<int>(lua_State* state, int value);
-template<> void toLua<unsigned int>(lua_State* state, unsigned int value);
-template<> void toLua<float>(lua_State* state, float value);
-template<> void toLua<char>(lua_State* state, char value);
-template<> void toLua<const std::string&>(lua_State* state, const std::string& value);
-
-// FORWARD DECLARATION
-
-///////////////////////
-///// WITHOUT RET /////
-///////////////////////
-
-///////////
-//// 0 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T> class ExecutorLua0 : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua0(void(T::*function)())
-  : Executor()
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      (dynamic_cast<T*>(object)->*(functionPointer))();
-      count = 0;
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua0<T>(ExecutorLua0<T>(this->functionPointer));
-    }
-  private:
-    void          (T::*functionPointer)();
-};
-
-
-
-///////////
-//// 1 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename type0> class ExecutorLua1 : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua1(void(T::*function)(type0))
-  : Executor(ExecutorParamType<type0>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 0;
-
-      (dynamic_cast<T*>(object)->*(functionPointer))(fromLua<type0>(state, 1));
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua1<T, type0>((this->functionPointer));
-    }
-  private:
-    void          (T::*functionPointer)(type0);
-};
-
-
-
-///////////
-//// 2 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename type0, typename type1> class ExecutorLua2 : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua2(void(T::*function)(type0, type1))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 0;
-
-      (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-      fromLua<type1>(state, 2) );
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua2<T, type0, type1>(this->functionPointer);
-    }
-  private:
-    void          (T::*functionPointer)(type0, type1);
-};
-
-
-///////////
-//// 3 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename type0, typename type1, typename type2> class ExecutorLua3 : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua3(void(T::*function)(type0, type1, type2))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 0;
-
-      (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-      fromLua<type1>(state, 2),
-      fromLua<type2>(state, 3) );
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua3<T, type0, type1, type2>(this->functionPointer);
-    }
-  private:
-    void          (T::*functionPointer)(type0, type1, type2);
-};
-
-
-///////////
-//// 4 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename type0, typename type1, typename type2, typename type3> class ExecutorLua4 : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua4(void(T::*function)(type0, type1, type2, type3))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 0;
-
-      (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-      fromLua<type1>(state, 2),
-      fromLua<type2>(state, 3),
-      fromLua<type3>(state, 4) );
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua4<T, type0, type1, type2, type3>(this->functionPointer);
-    }
-  private:
-    void          (T::*functionPointer)(type0, type1, type2, type3);
-};
-
-
-
-
-////////////////////
-///// WITH RET /////
-////////////////////
-
-
-///////////
-//// 0 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret> class ExecutorLua0ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua0ret(ret (T::*function)())
-  : Executor()
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-    
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 1;
-
-      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))());
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua0ret<T, ret>(this->functionPointer);
-    }
-  private:
-    ret           (T::*functionPointer)();
-};
-
-
-
-///////////
-//// 1 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret, typename type0> class ExecutorLua1ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua1ret(ret (T::*function)(type0))
-  : Executor(ExecutorParamType<type0>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 1;
-
-      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1)));
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua1ret<T, ret, type0>(this->functionPointer);
-    }
-  private:
-    ret           (T::*functionPointer)(type0);
-};
-
-///////////
-//// 2 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret, typename type0, typename type1> class ExecutorLua2ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua2ret(ret (T::*function)(type0, type1))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 1;
-
-      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-          fromLua<type1>(state, 2) ));
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua2ret<T, ret, type0, type1>(this->functionPointer);
-    }
-  private:
-    ret           (T::*functionPointer)(type0, type1);
-};
-
-
-///////////
-//// 3 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret, typename type0, typename type1, typename type2> class ExecutorLua3ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua3ret(ret (T::*function)(type0, type1, type2))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 1;
-
-      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-          fromLua<type1>(state, 2),
-          fromLua<type2>(state, 3) ));
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua3ret<T, ret, type0, type1, type2>(this->functionPointer);
-    }
-  private:
-    ret          (T::*functionPointer)(type0, type1, type2);
-};
-
-
-///////////
-//// 4 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret, typename type0, typename type1, typename type2, typename type3> class ExecutorLua4ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua4ret(ret (T::*function)(type0, type1, type2, type3))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 1;
-
-      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-          fromLua<type1>(state, 2),
-          fromLua<type2>(state, 3),
-          fromLua<type3>(state, 4) ));
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua4ret<T, ret, type0, type1, type2, type3>(this->functionPointer);
-    }
-  private:
-    ret          (T::*functionPointer)(type0, type1, type2, type3);
-};
-
-///////////
-//// 5 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4> class ExecutorLua5ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua5ret(ret (T::*function)(type0, type1, type2, type3, type4))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 1;
-
-      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-          fromLua<type1>(state, 2),
-          fromLua<type2>(state, 3),
-          fromLua<type3>(state, 4),
-          fromLua<type4>(state, 5) ));
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua5ret<T, ret, type0, type1, type2, type3, type4>(this->functionPointer);
-    }
-  private:
-    ret          (T::*functionPointer)(type0, type1, type2, type3, type4);
-};
-
-///////////
-//// 6 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4, typename type5> class ExecutorLua6ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua6ret(ret (T::*function)(type0, type1, type2, type3, type4, type5))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(),
-             ExecutorParamType<type2>(), ExecutorParamType<type3>(),
-             ExecutorParamType<type4>(), ExecutorParamType<type5>())
-             {
-               this->functionPointer = function;
-               this->functorType = Executor_Objective | Executor_NoLoadString;
-             }
-
-    /**
-              * @brief executes the Command on BaseObject
-              * @param object the BaseObject to execute this Executor on
-              * @param loadString ignored in this case
-     */
-             virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-             {
-               PRINTF(1)("no usefull executor\n");
-             }
-
-             virtual void operator()(BaseObject* object, int& count, void* values) const
-             {
-               lua_State* state = (lua_State*)values;
-               count = 1;
-
-               toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-                   fromLua<type0>(state, 1),
-                   fromLua<type1>(state, 2),
-                   fromLua<type2>(state, 3),
-                   fromLua<type3>(state, 4),
-                   fromLua<type4>(state, 5),
-                   fromLua<type5>(state, 6) ));
-             }
-
-    /**
-              * @returns a _new_ Copy of this Executor
-     */
-             virtual Executor* clone () const
-             {
-               return new ExecutorLua6ret<T, ret, type0, type1, type2, type3, type4, type5>(this->functionPointer);
-             }
-  private:
-    ret           (T::*functionPointer)(type0, type1, type2, type3, type4, type5);
-};
-
-///////////
-//// 7 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4, typename type5, typename type6> class ExecutorLua7ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua7ret(ret (T::*function)(type0, type1, type2, type3, type4, type5, type6))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(),
-             ExecutorParamType<type2>(), ExecutorParamType<type3>(),
-             ExecutorParamType<type4>(), ExecutorParamType<type5>(),
-             ExecutorParamType<type6>())
-             {
-               this->functionPointer = function;
-               this->functorType = Executor_Objective | Executor_NoLoadString;
-             }
-
-    /**
-              * @brief executes the Command on BaseObject
-              * @param object the BaseObject to execute this Executor on
-              * @param loadString ignored in this case
-     */
-             virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-             {
-               PRINTF(1)("no usefull executor\n");
-             }
-
-             virtual void operator()(BaseObject* object, int& count, void* values) const
-             {
-               lua_State* state = (lua_State*)values;
-               count = 1;
-
-               toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-                   fromLua<type0>(state, 1),
-                   fromLua<type1>(state, 2),
-                   fromLua<type2>(state, 3),
-                   fromLua<type3>(state, 4),
-                   fromLua<type4>(state, 5),
-                   fromLua<type5>(state, 6),
-                   fromLua<type6>(state, 7) ));
-             }
-
-    /**
-              * @returns a _new_ Copy of this Executor
-     */
-             virtual Executor* clone () const
-             {
-               return new ExecutorLua7ret<T, ret, type0, type1, type2, type3, type4, type5, type6>(this->functionPointer);
-             }
-  private:
-    ret           (T::*functionPointer)(type0, type1, type2, type3, type4, type5, type6);
-};
-
-
-#endif /* _EXECUTOR_LUA_H */
Index: trunk/src/lib/util/executor/executor_member.h
===================================================================
--- trunk/src/lib/util/executor/executor_member.h	(revision 9869)
+++ trunk/src/lib/util/executor/executor_member.h	(revision 9869)
@@ -0,0 +1,47 @@
+/*!
+ * @file executor_member.h
+ * Definition of an Executor to Member Functions
+ */
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+
+#ifndef __EXECUTOR_MEMBER_H_
+#define __EXECUTOR_MEMBER_H_
+
+/// Define all Constructs, that define an Executor.
+//! The Name to be attached to the functional (for normal, static, and const modes)
+#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount, Ext)   Executor##ParamCount##Ext
+//! if Functional is constant calling
+#define __EXECUTOR_FUNCTIONAL_CONST
+//! The Execution-mode (either static or objective)
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC      dynamic_cast<T*>(object)->*(functionPointer)
+//! The Function-Pointer, and how to save it internally.
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   T::*functionPointer
+//! The Type of Function
+#define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE       Executor<CallType, BaseClass>::FunctionMember
+
+
+/// We want to include __EXECUTOR_GENERIC_H again, with current settings.
+#include "executor_generic.h"
+
+
+#undef __EXECUTOR_FUNCTIONAL_NAME
+#undef __EXECUTOR_FUNCTIONAL_CONST
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
+#undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE
+
+#endif /* __EXECUTOR_MEMBER_H_ */
Index: trunk/src/lib/util/executor/executor_static.h
===================================================================
--- trunk/src/lib/util/executor/executor_static.h	(revision 9869)
+++ trunk/src/lib/util/executor/executor_static.h	(revision 9869)
@@ -0,0 +1,49 @@
+/*!
+ * @file executor_static.h
+ * Definition of an Executor to Static Functions (either Static-Class or C-Style)
+ */
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+
+#ifndef __EXECUTOR_STATIC_H_
+#define __EXECUTOR_STATIC_H_
+
+/// Define all Constructs, that define an Executor.
+
+//! The Name to be attached to the functional (for normal, static, and const modes)
+#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount, Ext)   Executor##ParamCount##Ext##_static
+
+//! if Functional is constant calling
+#define __EXECUTOR_FUNCTIONAL_CONST
+//! The Execution-mode (either static or objective)
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC      functionPointer
+//! The Function-Pointer, and how to save it internally.
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   *functionPointer
+//! The Type of Function
+#define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE       Executor<CallType, BaseClass>::FunctionStatic
+
+
+/// We want to include __EXECUTOR_GENERIC_H again, with current settings.
+#include "executor_generic.h"
+
+#undef __EXECUTOR_FUNCTIONAL_NAME
+
+#undef __EXECUTOR_FUNCTIONAL_CONST
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
+#undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE
+
+#endif /* __EXECUTOR_STATIC_H_ */
Index: trunk/src/lib/util/executor/executor_substring.cc
===================================================================
--- trunk/src/lib/util/executor/executor_substring.cc	(revision 9869)
+++ trunk/src/lib/util/executor/executor_substring.cc	(revision 9869)
@@ -0,0 +1,142 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#include "executor_substring.h"
+#include "helper_functions.h"
+
+/**
+ * @brief converts an input string into a value, if no value was converted, uses defaultValue.
+ * @param input the input as a String.
+ * @param defaultValue the Default Value set, if the input could not be converted into type.
+ * @returns either the converted value or defaultValue.
+ */
+template<> bool fromString<bool>(const std::string& input, bool defaultValue) { return isBool(input, defaultValue); };
+/**
+ * @brief converts an input string into a value, if no value was converted, uses defaultValue.
+ * @param input the input as a String.
+ * @param defaultValue the Default Value set, if the input could not be converted into type.
+ * @returns either the converted value or defaultValue.
+ */
+template<> int fromString<int>(const std::string& input, int defaultValue) { return isInt(input, defaultValue); };
+/**
+ * @brief converts an input string into a value, if no value was converted, uses defaultValue.
+ * @param input the input as a String.
+ * @param defaultValue the Default Value set, if the input could not be converted into type.
+ * @returns either the converted value or defaultValue.
+ */
+template<> unsigned int fromString<unsigned int>(const std::string& input, unsigned int defaultValue) { return isInt(input, defaultValue); };
+/**
+ * @brief converts an input string into a value, if no value was converted, uses defaultValue.
+ * @param input the input as a String.
+ * @param defaultValue the Default Value set, if the input could not be converted into type.
+ * @returns either the converted value or defaultValue.
+ */
+template<> float fromString<float>(const std::string& input, float defaultValue) { return isFloat(input, defaultValue); };
+/**
+ * @brief converts an input string into a value, if no value was converted, uses defaultValue.
+ * @param input the input as a String.
+ * @param defaultValue the Default Value set, if the input could not be converted into type.
+ * @returns either the converted value or defaultValue.
+ */
+template<> char fromString<char>(const std::string& input, char defaultValue) { return isInt(input, defaultValue); };
+/**
+ * @brief converts an input string into a value, if no value was converted, uses defaultValue.
+ * @param input the input as a String.
+ * @param defaultValue the Default Value set, if the input could not be converted into type.
+ * @returns either the converted value or defaultValue.
+ */
+template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue) { return (input.size() > 0) ? input : defaultValue; };
+
+
+/**
+ * @brief converts to any type from a MultiType
+ * @param multi the MultiType to convert.
+ * @returns the converted Value.
+ */
+template<> bool fromMulti<bool>(const MultiType& multi) { return multi.getBool(); };
+/**
+ * @brief converts to any type from a MultiType
+ * @param multi the MultiType to convert.
+ * @returns the converted Value.
+ */
+template<> int fromMulti<int>(const MultiType& multi) { return multi.getInt(); }
+/**
+ * @brief converts to any type from a MultiType
+ * @param multi the MultiType to convert.
+ * @returns the converted Value.
+ */
+template<> unsigned int fromMulti<unsigned int>(const MultiType& multi) { return multi.getInt(); };
+/**
+ * @brief converts to any type from a MultiType
+ * @param multi the MultiType to convert.
+ * @returns the converted Value.
+ */
+template<> float fromMulti<float>(const MultiType& multi) { return multi.getFloat(); };
+/**
+ * @brief converts to any type from a MultiType
+ * @param multi the MultiType to convert.
+ * @returns the converted Value.
+ */
+template<> char fromMulti<char>(const MultiType& multi) { return multi.getChar(); };
+/**
+ * @brief converts to any type from a MultiType
+ * @param multi the MultiType to convert.
+ * @returns the converted Value.
+ */
+template<> const std::string& fromMulti<const std::string&>(const MultiType& multi) { return multi.getConstString(); };
+
+
+/**
+ * @brief retrieves a default value from an array of default values, at possition i.
+ * @param defaultValues the Array of default values.
+ * @param i the index.
+ * @returns the Default Value at Position i
+ */
+template<> bool getDefault<bool>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getBool(); };
+/**
+ * @brief retrieves a default value from an array of default values, at possition i.
+ * @param defaultValues the Array of default values.
+ * @param i the index.
+ * @returns the Default Value at Position i
+ */
+template<> int getDefault<int>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getInt(); };
+/**
+ * @brief retrieves a default value from an array of default values, at possition i.
+ * @param defaultValues the Array of default values.
+ * @param i the index.
+ * @returns the Default Value at Position i
+ */
+template<> unsigned int getDefault<unsigned int>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getInt(); };
+/**
+ * @brief retrieves a default value from an array of default values, at possition i.
+ * @param defaultValues the Array of default values.
+ * @param i the index.
+ * @returns the Default Value at Position i
+ */
+template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getFloat(); };
+/**
+ * @brief retrieves a default value from an array of default values, at possition i.
+ * @param defaultValues the Array of default values.
+ * @param i the index.
+ * @returns the Default Value at Position i
+ */
+template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getChar(); };
+/**
+ * @brief retrieves a default value from an array of default values, at possition i.
+ * @param defaultValues the Array of default values.
+ * @param i the index.
+ * @returns the Default Value at Position i
+ */
+template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getStoredString(); };
Index: trunk/src/lib/util/executor/executor_substring.h
===================================================================
--- trunk/src/lib/util/executor/executor_substring.h	(revision 9869)
+++ trunk/src/lib/util/executor/executor_substring.h	(revision 9869)
@@ -0,0 +1,100 @@
+/*!
+ * @file executor_substring.h
+ * Definition of a Generic Executor
+ */
+
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+
+
+#ifndef __EXECUTOR_SUBSTRING_H_
+#define __EXECUTOR_SUBSTRING_H_
+
+
+#include "executor_generic.h"
+#include "substring.h"
+#ifdef FUNCTOR_CALL_TYPE
+ #undef FUNCTOR_CALL_TYPE
+#endif
+//! Use SubString as the FUNCTION_CALL_TYPE so that we can easily extend the Engine.
+#define FUNCTOR_CALL_TYPE const SubString
+
+/**
+ * @brief converts an input string into a value, if no value was converted, uses defaultValue.
+ * @param input the input as a String.
+ * @param defaultValue the Default Value set, if the input could not be converted into type.
+ * @returns either the converted value or defaultValue.
+ */
+template<typename type> type fromString(const std::string& input, type defaultValue) { return defaultValue; };
+template<> bool fromString<bool>(const std::string& input, bool defaultValue);
+template<> int fromString<int>(const std::string& input, int defaultValue);
+template<> unsigned int fromString<unsigned int>(const std::string& input, unsigned int defaultValue);
+template<> float fromString<float>(const std::string& input, float defaultValue);
+template<> char fromString<char>(const std::string& input, char defaultValue);
+template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue);
+
+/**
+ * @brief converts to any type from a MultiType
+ * @param multi the MultiType to convert.
+ * @returns the converted Value.
+ */
+template<typename type> type fromMulti(const MultiType& multi) { /* return defaultValue; */ };
+template<> bool fromMulti<bool>(const MultiType& multi);
+template<> int fromMulti<int>(const MultiType& multi);
+template<> unsigned int fromMulti<unsigned int>(const MultiType& multi);
+template<> float fromMulti<float>(const MultiType& multi);
+template<> char fromMulti<char>(const MultiType& multi);
+template<> const std::string& fromMulti<const std::string&>(const MultiType& multi);
+
+/**
+ * @brief retrieves a default value from an array of default values, at possition i.
+ * @param defaultValues the Array of default values.
+ * @param i the index.
+ * @returns the Default Value at Position i
+ */
+template<typename type> type getDefault(const MultiType* const defaultValues, unsigned int i) { return (type)0; };
+template<> bool getDefault<bool>(const MultiType* const defaultValues, unsigned int i);
+template<> int getDefault<int>(const MultiType* const defaultValues, unsigned int i);
+template<> unsigned int getDefault<unsigned int>(const MultiType* const defaultValues, unsigned int i);
+template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i);
+template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i);
+template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i);
+
+
+/**
+ * @brief to remove writing errors, this function is Used.
+ * @param sub The SubString to use
+ * @param default The default Values.
+ */
+template<> class ExecutorEvaluater <const SubString>
+{
+public:
+  /** @brief Executes the Evaluater
+   * @param CallValue the Value that should be converted
+   * @param defaults the default Values.
+   */
+  template <typename ToType, int index>
+  static ToType getValue(const SubString& CallValue, const MultiType* const defaults)
+  {
+    return (CallValue.size() > index) ?
+           fromString<ToType>(CallValue[index], getDefault<ToType>(defaults, index)) :
+           fromMulti<ToType>(defaults[index]);
+  }
+  /** @returns the default Value of a SubString, namely NullSubString or SubString() */
+  static const SubString& defaultValue() { return SubString::NullSubString; };
+};
+
+#endif /* __EXECUTOR_SUBSTRING_H_ */
Index: trunk/src/lib/util/executor/executor_xml.h
===================================================================
--- trunk/src/lib/util/executor/executor_xml.h	(revision 9675)
+++ trunk/src/lib/util/executor/executor_xml.h	(revision 9869)
@@ -19,66 +19,52 @@
  * What must be defined is a XML-root to search the ParameterName under an  a Function to call.
  */
-template<class T> class ExecutorXML : public Executor
+template<class T, class BaseClass = BaseObject> class ExecutorXML : public Executor<const TiXmlElement*>
 {
-  public:
-    /**
+public:
+  /**
    * @brief Constructor of a ExecutorXML
-     * @param function a Function to call
-     * @param root The XML root to search paramName under
-     * @param paramName the ParameterName the search in root, and lookup the TiXmlElement from
-     */
-    ExecutorXML(void(T::*function)(const TiXmlElement*), const TiXmlElement* root, const char* paramName)
-      : Executor(MT_EXT1)
-    {
-      PRINTF(4)("Loading %s from XML-element %p\n", paramName, root);
+   * @param function a Function to call
+   * @param root The XML root to search paramName under
+   * @param paramName the ParameterName the search in root, and lookup the TiXmlElement from
+   */
+  ExecutorXML(void(T::*function)(const TiXmlElement*), const TiXmlElement* root, const std::string& paramName)
+      : Executor<const TiXmlElement*>(false, MT_EXT1)
+  {
+    PRINTF(4)("Loading %s from XML-element %p\n", paramName.c_str(), root);
 
-      if (likely(root != NULL && paramName != NULL))
-        this->element = root->FirstChildElement(paramName);
-      else
-        this->element = NULL;
+    if (likely(root != NULL))
+      this->element = root->FirstChildElement(paramName);
+    else
+      this->element = NULL;
 
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
+    this->paramName = paramName;
+    this->functionPointer = function;
+  }
 
-    /**
-     * @brief clones an ExecutorXML, used to copy this Element.
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      ExecutorXML<T>* executor = new ExecutorXML<T>();
-      this->cloning(executor);
-      executor->functionPointer = this->functionPointer;
-      executor->element = this->element;
-      return executor;
-    }
+  /**
+   * @brief clones an ExecutorXML, used to copy this Element.
+   * @returns a _new_ Copy of this Executor
+   */
+  virtual Executor<const TiXmlElement*>* clone () const
+  {
+    return new ExecutorXML<T>(functionPointer, element, paramName);
+  }
 
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      if (object != NULL && this->element != NULL)
-        (dynamic_cast<T*>(object)->*(functionPointer))(this->element);
-    }
+  /**
+   * @brief executes the Command on BaseObject
+   * @param object the BaseObject to execute this Executor on
+   * @param element ignored in this case
+   */
+  virtual void operator()(BaseObject* object, const TiXmlElement*& element) const
+  {
+    assert (object != NULL);
+    if (this->element != NULL)
+      (dynamic_cast<T*>(object)->*(functionPointer))(this->element);
+  }
 
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      PRINTF(1)("missuse of XML-operator, OR IMPLEMENT.\n");
-    }
-
-  private:
-    /**
-   * @brief used for the copy-(Clone)-constructor
-     */
-    ExecutorXML() : Executor() { };
-
-
-  private:
-    void    (T::*functionPointer)(const TiXmlElement*);  //!< The functionPointer to the function to be called
-    const   TiXmlElement* element;                       //!< The XML-element to call.
+private:
+  void    (T::*functionPointer)(const TiXmlElement*);  //!< The functionPointer to the function to be called.
+  const   TiXmlElement* element;                       //!< The XML-element to call.
+  std::string           paramName;                     //!< The Name of the Parameter this Executor should call.
 };
 
Index: trunk/src/lib/util/executor/functor_const_member.h
===================================================================
--- trunk/src/lib/util/executor/functor_const_member.h	(revision 9869)
+++ trunk/src/lib/util/executor/functor_const_member.h	(revision 9869)
@@ -0,0 +1,47 @@
+/*!
+ * @file functor_const_member.h
+ * Definition of an Functor
+ */
+
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+
+#ifndef __FUNCTOR_CONST_MEMBER_H_
+#define __FUNCTOR_CONST_MEMBER_H_
+
+#include "executor_const_member.h"
+
+/// Define all Constructs, that define an Executor.
+//! The Name to be attached to the functional (for normal, static, and const modes)
+#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount, Ext)   Executor##ParamCount##Ext##_const
+//! if Functional is constant calling
+#define __EXECUTOR_FUNCTIONAL_CONST              const
+//! The Function-Pointer, and how to save it internally.
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   T::*functionPointer
+//! The Type of Function
+#define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE       Executor<CallType, BaseClass>::FunctionMember
+
+/// Now we include The generic Functor, that generate the functions.
+#include "functor_generic.h"
+
+#undef __EXECUTOR_FUNCTIONAL_NAME
+#undef __EXECUTOR_FUNCTIONAL_CONST
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
+#undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE
+
+
+
+#endif /* __FUNCTOR_CONST_MEMBER_H_ */
Index: trunk/src/lib/util/executor/functor_generic.h
===================================================================
--- trunk/src/lib/util/executor/functor_generic.h	(revision 9869)
+++ trunk/src/lib/util/executor/functor_generic.h	(revision 9869)
@@ -0,0 +1,105 @@
+/*!
+ * @file functor_generic.h
+ * Definition of an Executor
+ */
+
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+// // // // // // // // // // // // //
+//// EXTENSION TO HIDE CONSTRUCT /////
+// // // // // // // // // // // // //
+/**
+ * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
+ * @param CallType the Type of Executor to generate
+ */
+#define EXECUTOR_FUNCTIONAL_CREATOR0(CallType) \
+template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \
+{ \
+  return new __EXECUTOR_FUNCTIONAL_NAME(0,)<T, CallType, BaseClass>(functionPointer); \
+}
+
+/**
+ * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
+ * @param CallType the Type of Executor to generate
+ * @param type0 for internal usage: the first Argument
+ */
+#define EXECUTOR_FUNCTIONAL_CREATOR1(CallType, type0) \
+template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST) \
+{ \
+  return new __EXECUTOR_FUNCTIONAL_NAME(1,)<T, CallType, type0, BaseClass>(functionPointer); \
+}
+
+/**
+ * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
+ * @param CallType the Type of Executor to generate
+ * @param type0 for internal usage: the first Argument
+ * @param type1 for internal usage: the second Argument
+ */
+#define EXECUTOR_FUNCTIONAL_CREATOR2(CallType, type0, type1) \
+template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST) \
+{ \
+  return new __EXECUTOR_FUNCTIONAL_NAME(2,)<T, CallType, type0, type1, BaseClass>(functionPointer); \
+}
+
+/**
+ * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
+ * @param CallType the Type of Executor to generate
+ * @param type0 for internal usage: the first Argument
+ * @param type1 for internal usage: the second Argument
+ * @param type2 for internal usage: the third Argument
+ */
+#define EXECUTOR_FUNCTIONAL_CREATOR3(CallType, type0, type1, type2) \
+template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST) \
+{ \
+  return new __EXECUTOR_FUNCTIONAL_NAME(3,)<T, CallType, type0, type1, type2, BaseClass>(functionPointer); \
+}
+
+/**
+ * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
+ * @param CallType the Type of Executor to generate
+ * @param type0 for internal usage: the first Argument
+ * @param type1 for internal usage: the second Argument
+ * @param type2 for internal usage: the third Argument
+ * @param type3 for internal usage: the fourth Argument
+ */
+#define EXECUTOR_FUNCTIONAL_CREATOR4(CallType, type0, type1, type2, type3) \
+template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST) \
+{ \
+  return new __EXECUTOR_FUNCTIONAL_NAME(4,)<T, CallType, type0, type1, type2, type3, BaseClass>(functionPointer); \
+}
+
+/**
+ * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
+ * @param CallType the Type of Executor to generate
+ * @param type0 for internal usage: the first Argument
+ * @param type1 for internal usage: the second Argument
+ * @param type2 for internal usage: the third Argument
+ * @param type3 for internal usage: the fourth Argument
+ * @param type4 for internal usage: the fifth Argument
+ */
+#define EXECUTOR_FUNCTIONAL_CREATOR5(CallType, type0, type1, type2, type3, type4) \
+template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST) \
+{ \
+    return new __EXECUTOR_FUNCTIONAL_NAME(5,)<T, CallType, type0, type1, type2, type3, type4, BaseClass>(functionPointer); \
+}
+
+/**
+ * Creates the FunctionCallers imediately
+ */
+#define FUNCTOR_LIST(x) EXECUTOR_FUNCTIONAL_CREATOR ## x
+#include "functor_list.h"
+#undef FUNCTOR_LIST
+
Index: trunk/src/lib/util/executor/functor_list.h
===================================================================
--- trunk/src/lib/util/executor/functor_list.h	(revision 9675)
+++ trunk/src/lib/util/executor/functor_list.h	(revision 9869)
@@ -1,2 +1,7 @@
+/*!
+ * @file functor_list.h
+ * all the Different types of Functions one can include by using a simple createExecutor call
+ * with a FunctionPointer as Argument
+ */
 /*
    orxonox - the future of 3D-vertical-scrollers
@@ -8,142 +13,65 @@
    the Free Software Foundation; either version 2, or (at your option)
    any later version.
-   */
-
-/*!
- * @file functors_list.h
- * all the Different types of Functions one can include
 */
-
-/**
-   useable FunctionParameters are:
-   l_INT:       int
-   l_LONG:      long
-   l_SHORT:     short
-   l_FLOAT:     float
-   l_STRING:    const std::string&
-   l_XML_ELEM:  TiXmlElement*
- */
-
-#ifndef __FUNCTOR_PARAMETERS__
-#define __FUNCTOR_PARAMETERS__
-
-//! defines the maximum count of arguments function pointers might have
-#define FUNCTOR_MAX_ARGUMENTS                7
-#include "multi_type.h"
-
-
-#define l_BOOL_TYPE        bool                 //!< The type of an BOOL
-#define l_BOOL_FUNC        isBool               //!< The function to call to parse BOOL
-#define l_BOOL_PARAM       MT_BOOL              //!< the type of the parameter BOOL
-#define l_BOOL_DEFAULT     false                //!< a default Value for an BOOL
-#define l_BOOL_DEFGRAB(i)  this->defaultValue[i].getBool()
-
-#define l_INT_TYPE         int                  //!< The type of an INT
-#define l_INT_FUNC         isInt                //!< The function to call to parse INT
-#define l_INT_PARAM        MT_INT               //!< the type of the parameter INT
-#define l_INT_DEFAULT      0                    //!< a default Value for an INT
-#define l_INT_DEFGRAB(i)   this->defaultValue[i].getInt()
-
-#define l_UINT_TYPE        unsigned int         //!< The type of an UINT
-#define l_UINT_FUNC        isInt                //!< The function to call to parse UINT
-#define l_UINT_PARAM       MT_INT        //!< the type of the parameter UINT
-#define l_UINT_DEFAULT     0                    //!< a default Value for an UINT
-#define l_UINT_DEFGRAB(i)  (unsigned int)this->defaultValue[i].getInt()
-
-#define l_LONG_TYPE        long                 //!< The type of a LONG
-#define l_LONG_FUNC        isInt                //!< The function to parse a LONG
-#define l_LONG_PARAM       MT_INT //!< the type of the parameter LONG
-#define l_LONG_DEFAULT     0                    //!< a default Value for a LONG
-#define l_LONG_DEFGRAB(i)  (long)this->defaultValue[i].getInt()
-
-// #define l_SHORT_TYPE       short                //!< The type of a SHORT
-// #define l_SHORT_FUNC       atoi                 //!< The function to parse a SHORT
-// #define l_SHORT_NAME       "short"              //!< The name of a SHORT
-// #define l_SHORT_PARAM      ParameterShort       //!< the type of the parameter SHORT
-// #define l_SHORT_DEFAULT    0                    //!< a default Value for a SHORT
-
-#define l_FLOAT_TYPE       float                //!< The type of a FLOAT
-#define l_FLOAT_FUNC       isFloat              //!< The function to parse a FLOAT
-#define l_FLOAT_PARAM      MT_FLOAT             //!< the type of the parameter FLOAT
-#define l_FLOAT_DEFAULT    0.0                  //!< a default Value for a FLOAT
-#define l_FLOAT_DEFGRAB(i) this->defaultValue[i].getFloat()
-
-//#define l_VECTOR_TYPE      const Vector&        //!< The type of a VECTOR
-//#define l_VECTOR_FUNC      isVector             //!< The function to parse a VECTOR
-//#define l_VECTOR_NAME      "Vector[x/y/z]"      //!< The name of a VECTOR
-//#define l_VECTOR_DEFAULT   Vector(0,0,0)        //!< Default value for a VECTOR
-
-#define l_STRING_TYPE      const std::string&   //!< The type of a STRING
-#define l_STRING_FUNC      isString             //!< The function to parse a STRING
-#define l_STRING_PARAM     MT_STRING            //!< the type of the parameter STRING
-#define l_STRING_DEFAULT   ""                   //!< a default Value for an STRING
-#define l_STRING_DEFGRAB(i) this->defaultValue[i].getString()
-
-#define l_XML_ELEM_TYPE    const TiXmlElement*  //!< The type of an XML_ELEM
-#define l_XML_ELEM_FUNC                         //!< The function to parse an XML_ELEM
-//#define l_XML_ELEM_PARAM   Parameter            //!< the type of the parameter XML_ELEM
-#define l_XML_ELEM_DEFAULT NULL                 //!< The dafault Value for an XML_ELEM
-
-#endif /* __FUNCTOR_PARAMETERS__ */
 
 
 #ifdef FUNCTOR_LIST
-
-  FUNCTOR_LIST(0)();
+  FUNCTOR_LIST(0)(FUNCTOR_CALL_TYPE);
   //! makes functions with one string
-  FUNCTOR_LIST(1)(l_STRING);
+  FUNCTOR_LIST(1)(FUNCTOR_CALL_TYPE, const std::string&);
   //! makes functions with two strings
-  FUNCTOR_LIST(2)(l_STRING, l_STRING);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, const std::string&, const std::string&);
   //! makes functions with three strings
-  FUNCTOR_LIST(3)(l_STRING, l_STRING, l_STRING);
+  FUNCTOR_LIST(3)(FUNCTOR_CALL_TYPE, const std::string&, const std::string&, const std::string&);
   //! makes functions with four strings
-  FUNCTOR_LIST(4)(l_STRING, l_STRING, l_STRING, l_STRING);
+  FUNCTOR_LIST(4)(FUNCTOR_CALL_TYPE, const std::string&, const std::string&, const std::string&, const std::string&);
 
 
   //! makes functions with one bool
-  FUNCTOR_LIST(1)(l_BOOL);
+  FUNCTOR_LIST(1)(FUNCTOR_CALL_TYPE, bool);
 
   //! makes functions with one int
-  FUNCTOR_LIST(1)(l_INT);
+  FUNCTOR_LIST(1)(FUNCTOR_CALL_TYPE, int);
   //! makes functions with two ints
-  FUNCTOR_LIST(2)(l_INT, l_INT);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, int, int);
   //! makes functions with three ints
-  FUNCTOR_LIST(3)(l_INT, l_INT, l_INT);
+  FUNCTOR_LIST(3)(FUNCTOR_CALL_TYPE, int, int, int);
   //! makes functions with four ints
-  FUNCTOR_LIST(4)(l_INT, l_INT, l_INT, l_INT);
+  FUNCTOR_LIST(4)(FUNCTOR_CALL_TYPE, int, int, int, int);
 
 
   //! makes functions with one unsigned int
-  FUNCTOR_LIST(1)(l_UINT);
+  FUNCTOR_LIST(1)(FUNCTOR_CALL_TYPE, unsigned int);
   //! makes functions with two unsigned ints
-  FUNCTOR_LIST(2)(l_UINT, l_UINT);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, unsigned int, unsigned int);
   //! makes functions with three unsigned ints
-  FUNCTOR_LIST(3)(l_UINT, l_UINT, l_UINT);
+  FUNCTOR_LIST(3)(FUNCTOR_CALL_TYPE, unsigned int, unsigned int, unsigned int);
   //! makes functions with four unsigned ints
-  FUNCTOR_LIST(4)(l_UINT, l_UINT, l_UINT, l_UINT);
+  FUNCTOR_LIST(4)(FUNCTOR_CALL_TYPE, unsigned int, unsigned int, unsigned int, unsigned int);
 
   //! makes functions with one float
-  FUNCTOR_LIST(1)(l_FLOAT);
+  FUNCTOR_LIST(1)(FUNCTOR_CALL_TYPE, float);
   //! makes functions with two floats
-  FUNCTOR_LIST(2)(l_FLOAT, l_FLOAT);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, float, float);
   //! makes functions with three floats
-  FUNCTOR_LIST(3)(l_FLOAT, l_FLOAT, l_FLOAT);
+  FUNCTOR_LIST(3)(FUNCTOR_CALL_TYPE, float, float, float);
   //! makes functions with four floats
-  FUNCTOR_LIST(4)(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT);
+  FUNCTOR_LIST(4)(FUNCTOR_CALL_TYPE, float, float, float, float);
   //! makes functions with four floats
-  FUNCTOR_LIST(5)(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT);
+  FUNCTOR_LIST(5)(FUNCTOR_CALL_TYPE, float, float, float, float, float);
 
   //! mixed values:
-  FUNCTOR_LIST(2)(l_STRING, l_INT);
-  FUNCTOR_LIST(2)(l_STRING, l_FLOAT);
-  FUNCTOR_LIST(2)(l_UINT, l_LONG);
-  FUNCTOR_LIST(2)(l_STRING, l_UINT);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, const std::string&, bool);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, const std::string&, int);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, const std::string&, float);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, unsigned int, long);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, const std::string&, unsigned int);
 
-  FUNCTOR_LIST(3)(l_STRING, l_FLOAT, l_UINT);
-  FUNCTOR_LIST(4)(l_STRING, l_FLOAT, l_UINT, l_UINT);
-  FUNCTOR_LIST(3)(l_STRING, l_INT, l_UINT);
-  FUNCTOR_LIST(3)(l_STRING, l_UINT, l_UINT);
+  FUNCTOR_LIST(3)(FUNCTOR_CALL_TYPE, const std::string&, float, unsigned int);
+  FUNCTOR_LIST(4)(FUNCTOR_CALL_TYPE, const std::string&, float, unsigned int, unsigned int);
+  FUNCTOR_LIST(3)(FUNCTOR_CALL_TYPE, const std::string&, int, unsigned int);
+  FUNCTOR_LIST(3)(FUNCTOR_CALL_TYPE, const std::string&, unsigned int, unsigned int);
 
-  FUNCTOR_LIST(5)(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT, l_STRING);
+  FUNCTOR_LIST(5)(FUNCTOR_CALL_TYPE, float, float, float, float, const std::string&);
 
 #endif /* FUNCTOR_LIST */
Index: trunk/src/lib/util/executor/functor_member.h
===================================================================
--- trunk/src/lib/util/executor/functor_member.h	(revision 9869)
+++ trunk/src/lib/util/executor/functor_member.h	(revision 9869)
@@ -0,0 +1,49 @@
+/*!
+ * @file functor_member.h
+ * Definition of an Functor
+ */
+
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+
+#ifndef __FUNCTOR_MEMBER_H_
+#define __FUNCTOR_MEMBER_H_
+
+#include "executor_member.h"
+
+/// Define all Constructs, that define an Executor.
+//! The Name to be attached to the functional (for normal, static, and const modes)
+#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount, Ext)   Executor##ParamCount##Ext
+//! if Functional is constant calling
+#define __EXECUTOR_FUNCTIONAL_CONST
+//! The Function-Pointer, and how to save it internally.
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   T::*functionPointer
+//! The Type of Function
+#define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE       Executor<CallType, BaseClass>::FunctionMember
+
+
+/// Now we include The generic Functor, that generate the functions.
+#include "functor_generic.h"
+
+
+#undef __EXECUTOR_FUNCTIONAL_NAME
+#undef __EXECUTOR_FUNCTIONAL_CONST
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
+#undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE
+
+
+
+#endif /* __FUNCTOR_MEMBER_H_ */
Index: trunk/src/lib/util/executor/functor_static.h
===================================================================
--- trunk/src/lib/util/executor/functor_static.h	(revision 9869)
+++ trunk/src/lib/util/executor/functor_static.h	(revision 9869)
@@ -0,0 +1,48 @@
+/*!
+ * @file functor_static.h
+ * Definition of Functors to Functions of Static Type
+ */
+
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+
+#ifndef __FUNCTOR_STATIC_H_
+#define __FUNCTOR_STATIC_H_
+
+#include "executor_static.h"
+
+/// Define all Constructs, that define an Executor.
+//! The Name to be attached to the functional (for normal, static, and const modes)
+#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount, Ext)   Executor##ParamCount##Ext##_static
+//! if Functional is constant calling
+#define __EXECUTOR_FUNCTIONAL_CONST
+//! The Function-Pointer, and how to save it internally.
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   *functionPointer
+//! The Type of Function
+#define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE       Executor<CallType, BaseClass>::FunctionStatic
+
+/// Now we include The generic Functor, that generate the functions.
+#include "functor_generic.h"
+
+
+#undef __EXECUTOR_FUNCTIONAL_NAME
+#undef __EXECUTOR_FUNCTIONAL_CONST
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
+#undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE
+
+
+
+#endif /* __FUNCTOR_STATIC_H_ */
Index: trunk/src/lib/util/filesys/directory.cc
===================================================================
--- trunk/src/lib/util/filesys/directory.cc	(revision 9675)
+++ trunk/src/lib/util/filesys/directory.cc	(revision 9869)
@@ -41,7 +41,9 @@
 #include <sys/stat.h>
 #include <dirent.h>
+const char Directory::delimiter = '/';
 #else
 #include <windows.h>
 #include <winbase.h>
+const char Direcotry::delimiter = '\\';
 #endif
 
@@ -63,5 +65,5 @@
  */
 Directory::Directory(const Directory& directory)
-  : File(directory)
+    : File(directory)
 {
   this->_opened = directory._opened;
@@ -166,2 +168,51 @@
 #endif
 }
+
+
+Directory Directory::operator+(const Directory& dir) const
+{
+  return Directory(*this) += dir;
+}
+
+/**
+ * @param dir the Directory to append to this one (say this one is "/var", then dir can be "log")
+ * @returns The Directory appended by dir.
+ *
+ * @note the Directoy will again be closed even if it was opened previously!
+ */
+Directory& Directory::operator+=(const Directory& dir)
+{
+  this->setFileName(this->name() + Directory::delimiter + dir.name());
+  return *this;
+}
+
+/**
+ * @brief Traverses the Directory tree one step up. (Parent Directory)
+ * @returns a Reference to the Directory.
+ */
+Directory& Directory::operator--()
+{
+}
+
+
+/**
+ * @brief Traverses the Directory tree one step up. (Parent Directory)
+ * @param int the PostFix iterator
+ * @returns a Reference to the Directory.
+ */
+Directory& Directory::operator--(int)
+{
+}
+
+/**
+ * @returns The Parent Directory.
+ */
+Directory Directory::parentDir() const
+{
+
+}
+
+File operator+(const Directory& dir, const File& file)
+{
+  return File(dir.name() + Directory::delimiter + file.name());
+}
Index: trunk/src/lib/util/filesys/directory.h
===================================================================
--- trunk/src/lib/util/filesys/directory.h	(revision 9675)
+++ trunk/src/lib/util/filesys/directory.h	(revision 9869)
@@ -29,4 +29,12 @@
 #include <vector>
 
+//! A Directory is a Special file, that contains multiple Files.
+/**
+ * @example Correct usage
+ * Directory dir("/var/log");
+ * dir.open();
+ * if (dir.fileNameInDir("emerge.log"))
+ *  { // do stuff; }
+ */
 class Directory : public File
 {
@@ -41,4 +49,11 @@
   bool create();
 
+  Directory operator+(const Directory& dir) const;
+  Directory& operator+=(const Directory& dir);
+  Directory& operator--();
+  Directory& operator--(int);
+  Directory parentDir() const;
+
+
   /** @returns if the Directory was opened */
   bool isOpen() const { return this->_opened; }
@@ -50,7 +65,10 @@
   const std::string& operator[](unsigned int fileNumber) const { return this->_fileNames[fileNumber]; };
   /** @returns a formated string containing the FileName, prepended with the directory-Name */
-  std::string fileNameInDir(unsigned int fileNumber) const { return this->name() + "/" + _fileNames[fileNumber]; };
+  std::string fileNameInDir(unsigned int fileNumber) const { return this->name() + Directory::delimiter + _fileNames[fileNumber]; };
   /** @returns a File pointing to the File @param fileNumber the fileNumber (must not bigger than fileCount()) */
   File getFile(unsigned int fileNumber) const { return File(fileNameInDir(fileNumber)); };
+
+public:
+  static const char           delimiter;        //!< A Delimiter (*nix: '/', windows: '\\')
 
 private:
@@ -58,4 +76,6 @@
   std::vector<std::string>    _fileNames;       //!< The List of Files contained in the directory. (will be filled when open was called.)
 };
+
+File operator+(const Directory& dir, const File& file);
 
 #endif /* __DIRECTORY_H_ */
Index: trunk/src/lib/util/filesys/file.cc
===================================================================
--- trunk/src/lib/util/filesys/file.cc	(revision 9675)
+++ trunk/src/lib/util/filesys/file.cc	(revision 9869)
@@ -326,4 +326,8 @@
 }
 
+/**
+ * @brief converts an Absolute Filename to a Relative one
+ * @param absFileName the FileName to convert. The Relative path will be stored in absFileName.
+ */
 void File::absToRel(std::string& absFileName)
 {
Index: trunk/src/lib/util/loading/dynamic_loader.cc
===================================================================
--- trunk/src/lib/util/loading/dynamic_loader.cc	(revision 9675)
+++ trunk/src/lib/util/loading/dynamic_loader.cc	(revision 9869)
@@ -24,5 +24,5 @@
 
 
-
+ObjectListDefinition(DynamicLoader);
 
 /**
@@ -31,7 +31,7 @@
 */
 DynamicLoader::DynamicLoader (const std::string& libName)
-    : Factory(NULL, CL_NULL)
+    : Factory(libName)
 {
-  this->setClassID(CL_DYNAMIC_LOADER, "DynamicLoader");
+  this->registerObject(this, DynamicLoader::_objectList);
 
   this->handle = NULL;
Index: trunk/src/lib/util/loading/dynamic_loader.h
===================================================================
--- trunk/src/lib/util/loading/dynamic_loader.h	(revision 9675)
+++ trunk/src/lib/util/loading/dynamic_loader.h	(revision 9869)
@@ -19,4 +19,5 @@
 class DynamicLoader : public Factory
 {
+  ObjectListDeclaration(DynamicLoader);
 
 public:
Index: trunk/src/lib/util/loading/factory.cc
===================================================================
--- trunk/src/lib/util/loading/factory.cc	(revision 9675)
+++ trunk/src/lib/util/loading/factory.cc	(revision 9869)
@@ -15,9 +15,9 @@
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOADING
 
-#include "util/loading/factory.h"
+#include "factory.h"
 #include "debug.h"
 //#include "shell_command.h"
 
-
+ObjectListDefinition(Factory);
 
 //SHELL_COMMAND(create, Factory, fabricate);
@@ -28,18 +28,20 @@
  * set everything to zero and define factoryName
  */
-Factory::Factory (const std::string& factoryName, ClassID classID)
-    : classID(classID), className(factoryName)
+Factory::Factory (const ClassID& classID)
+    : _classID(classID)
 {
-  this->setClassID(CL_FACTORY, "Factory");
-  this->setName(factoryName);
+  PRINTF(4)("Factory::create(%s::%d)\n", classID.name().c_str(), classID.id());
+  //this->registerObject(this, Factory::_objectList);
+  this->setName(classID.name());
 
-  if( Factory::factoryList == NULL)
-    Factory::factoryList = new std::list<Factory*>;
-
-  Factory::factoryList->push_back(this);
+  Factory::_factoryIDMap[classID] = this;
+  Factory::_factoryStringMap[classID.name()] = this;
 }
 
-/** @brief a reference to the First Factory */
-std::list<Factory*>* Factory::factoryList = NULL;
+/** @brief A Map of all Factories ordered by ID. */
+Factory::FactoryIDMap Factory::_factoryIDMap;
+
+/** @brief A Map of all Factories ordered by Name. */
+Factory::FactoryStringMap Factory::_factoryStringMap;
 
 /**
@@ -48,24 +50,11 @@
 Factory::~Factory ()
 {
-  //  printf("%s\n", this->factoryName);
-  //  Factory* tmpDel = this->next;
-  //  this->next = NULL;
-}
+  FactoryIDMap::iterator it = Factory::_factoryIDMap.find(this->_classID);
+  if (it != Factory::_factoryIDMap.end() && (*it).second == this)
+    Factory::_factoryIDMap.erase(it);
 
-/**
- * @brief deletes all the Factories. (cleanup)
- */
-void Factory::deleteFactories()
-{
-  if (Factory::factoryList != NULL)
-  {
-    while(!Factory::factoryList->empty())
-    {
-      delete Factory::factoryList->front();
-      Factory::factoryList->pop_front();
-    }
-    delete Factory::factoryList;
-    Factory::factoryList = NULL;
-  }
+  FactoryStringMap::iterator stringIt = Factory::_factoryStringMap.find(this->_classID.name());
+  if (stringIt != Factory::_factoryStringMap.end() && (*stringIt).second == this)
+    Factory::_factoryStringMap.erase(stringIt);
 }
 
@@ -74,18 +63,9 @@
  * @returns true on match, false otherwise
  */
-bool Factory::operator==(ClassID classID) const
+bool Factory::operator==(int classID) const
 {
-  return (this->classID == classID);
+  return (this->_classID == classID);
 }
 
-/**
- * @brief Compares the Factories Name against a given ClassName
- * @param className the Name of the Class to Query
- * @returns true on match, false otherwise.
- */
-bool Factory::operator==(const char* className) const
-{
-  return (className != NULL && this->className == className);
-}
 
 /**
@@ -96,5 +76,5 @@
 bool Factory::operator==(const std::string& className) const
 {
-  return (this->className == className);
+  return (this->_classID.name() == className);
 }
 
@@ -107,16 +87,15 @@
 BaseObject* Factory::fabricate(const TiXmlElement* root)
 {
-  assert (root != NULL && Factory::factoryList != NULL);
-
-  std::list<Factory*>::const_iterator factory;
-  for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
-    if (*(*factory) == root->Value())
-    {
-      PRINTF(2)("Create a new Object of type %s\n", (*factory)->getCName());
-      return (*factory)->fabricateObject(root);
-    }
-
-  PRINTF(2)("Could not Fabricate an Object of Class '%s'\n", root->Value());
-  return NULL;
+  FactoryStringMap::const_iterator it = Factory::_factoryStringMap.find(root->Value());
+  if (it != Factory::_factoryStringMap.end())
+  {
+    PRINTF(2)("Create a new Object of type %s\n", (*it).second->getCName());
+    return (*it).second->fabricateObject(root);
+  }
+  else
+  {
+    PRINTF(2)("Could not Fabricate an Object of Class '%s'\n", root->Value());
+    return NULL;
+  }
 }
 
@@ -129,18 +108,16 @@
 BaseObject* Factory::fabricate(const std::string& className)
 {
-  if (Factory::factoryList == NULL)
+  FactoryStringMap::const_iterator it = Factory::_factoryStringMap.find(className);
+  if (it != Factory::_factoryStringMap.end())
+  {
+    PRINTF(2)("Create a new Object of type %s\n", (*it).second->getCName());
+    return (*it).second->fabricateObject(NULL);
+  }
+  else
+  {
+    PRINTF(2)("Could not Fabricate an Object of Class '%s'\n", className.c_str());
     return NULL;
-
-  std::list<Factory*>::const_iterator factory;
-  for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
-    if (*(*factory) == className)
-    {
-      PRINTF(4)("Create a new Object of type %s\n", (*factory)->getCName());
-      return (*factory)->fabricateObject(NULL);
-    }
-  PRINTF(2)("Could not Fabricate an Object of Class '%s'\n", className.c_str());
-  return NULL;
+  }
 }
-
 
 /**
@@ -149,18 +126,36 @@
  * @returns a new Object of Type classID on match, NULL otherwise
  */
-BaseObject* Factory::fabricate(ClassID classID)
+BaseObject* Factory::fabricate(const ClassID& classID)
 {
-  if (Factory::factoryList == NULL)
+  FactoryIDMap::const_iterator it = Factory::_factoryIDMap.find(classID);
+  if (it != Factory::_factoryIDMap.end())
+  {
+    PRINTF(4)("Create a new Object of type %s\n", (*it).second->getCName());
+    return (*it).second->fabricateObject(NULL);
+  }
+  else
+  {
+    PRINTF(2)("Could not Fabricate an Object of ClassID '%d'\n", classID.id());
     return NULL;
+  }
+}
 
-  std::list<Factory*>::const_iterator factory;
-  for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
-    if (*(*factory) == classID)
-    {
-      PRINTF(4)("Create a new Object of type %s\n", (*factory)->getCName());
-      return (*factory)->fabricateObject(NULL);
 
-    }
-  PRINTF(2)("Could not Fabricate an Object of ClassID '0x%h'\n", classID);
-  return NULL;
+/**
+ * @brief print out some nice litte debug information about the Factory.
+ */
+void Factory::debug() const
+{
+  PRINTF(0)("Factory of class '%s' with ClassID: %d\n", this->_classID.name().c_str(), this->_classID.id());
 }
+
+/**
+ * @brief Prints out some nice Debug information about all factories
+ */
+void Factory::debugAll()
+{
+  PRINTF(0)("Debugging all %d Factories\n", Factory::_factoryStringMap.size());
+  Factory::FactoryStringMap::const_iterator it;
+  for (it = Factory::_factoryStringMap.begin(); it != Factory::_factoryStringMap.end(); ++it)
+    (*it).second->debug();
+}
Index: trunk/src/lib/util/loading/factory.h
===================================================================
--- trunk/src/lib/util/loading/factory.h	(revision 9675)
+++ trunk/src/lib/util/loading/factory.h	(revision 9869)
@@ -20,6 +20,6 @@
 
 
-#ifndef _FACTORY_H
-#define _FACTORY_H
+#ifndef __FACTORY_H
+#define __FACTORY_H
 
 class BaseObject;
@@ -27,6 +27,5 @@
 #include "parser/tinyxml/tinyxml.h"
 #include "base_object.h"
-#include <vector>
-#include <list>
+#include <map>
 
 /**
@@ -34,32 +33,50 @@
  * this should be used at the beginning of all the Classes that should be loadable (in the cc-file)
  */
-#define CREATE_FACTORY(CLASS_NAME, CLASS_ID) \
-    tFactory<CLASS_NAME>* global_##CLASS_NAME##_Factory = new tFactory<CLASS_NAME>(#CLASS_NAME, CLASS_ID)
+#define CREATE_FACTORY(CLASS_NAME) \
+    tFactory<CLASS_NAME> global_##CLASS_NAME##_Factory = tFactory<CLASS_NAME>(CLASS_NAME::staticClassID())
 
 //! The Factory is a loadable object handler
-class Factory : public BaseObject {
-
- public:
+class Factory : public BaseObject
+{
+  //! Declare the ObjectList at the BaseObject List
+  ObjectListDeclaration(Factory);
+public:
   virtual ~Factory ();
 
-  static void deleteFactories();
+  static  BaseObject* fabricate(const std::string& className);
+  static  BaseObject* fabricate(const ClassID& classID);
+  static  BaseObject* fabricate(const TiXmlElement* root);
 
-  static  BaseObject* fabricate(const std::string& className);
-  static  BaseObject* fabricate(ClassID classID);
-  static  BaseObject* fabricate(const TiXmlElement* root = NULL);
+  bool operator==(int classID) const;
+  bool operator==(const std::string& className) const;
+  /** @param classID the ID to compare @returns true if the ID's match */
+  bool operator==(const ClassID& classID) const { return _classID == classID; };
 
 
-  bool operator==(ClassID classID) const;
-  bool operator==(const char* className) const;
-  bool operator==(const std::string& className) const;
+  void debug() const;
+  static void debugAll();
 
-  protected:
-    Factory (const std::string& factoryName, ClassID classID);
-    virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const = 0;
+protected:
+  Factory (const ClassID& id);
+  /**
+   * @brief The core function of the Factory. Creates objects of the Factories Type.
+   * @param root The TiXmlElement of the Factory.
+   * @returns the created Object in BaseType* format.
+   */
+  virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const = 0;
 
-  protected:
-    const ClassID                 classID;              //!< The Class-Identifyer of the Factory.
-    const std::string             className;            //!< The name of the Class.
-    static std::list<Factory*>*   factoryList;          //!< List of Registered Factories
+private:
+  //! Copy Constructor is hidden.
+  Factory (const Factory&) {};
+
+protected:
+  /** The Type of the FactoryMap that is sorted by ID */
+  typedef std::map<const ClassID, Factory*>  FactoryIDMap;
+  /** The Type of the FactoryMap that is sorted by Name */
+  typedef std::map<std::string, Factory*>    FactoryStringMap;
+
+  const ClassID                 _classID;              //!< The Class-Identifyer of the Factory.
+  static FactoryIDMap           _factoryIDMap;         //!< List of Registered Factories
+  static FactoryStringMap       _factoryStringMap;     //!< List of Registered Factories
 };
 
@@ -70,24 +87,27 @@
 template<class T> class tFactory : public Factory
 {
- public:
- /**
-  * @brief creates a new type Factory to enable the loading of T
-  * @param factoryName the Name of the Factory to load.
-  * @param classID the ID of the Class to be created.
-  */
-  tFactory (const char* factoryName, ClassID classID)
-   : Factory(factoryName, classID)
+public:
+  /**
+   * @brief creates a new type Factory to enable the loading of T
+   * @param classID the ID of the Class to be created.
+   */
+  tFactory (const ClassID& classID)
+      : Factory(classID)
   {  }
+  /**
+   * @brief copy constructor
+   * @param factory the Factory to copy
+   */
+  tFactory (const tFactory& factory) : Factory(factory._classID) {};
 
-  private:
-   /**
-    * @brief fabricates an Object of type T, with the constructor T::T(const TiXmlElemnt*)
-    * @param root the TiXmlElement T should load parameters from.
-    * @return the newly fabricated T.
-    */
-    virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const
-    {
-      return new T(root);
-    }
+  /**
+   * @brief fabricates an Object of type T, with the constructor T::T(const TiXmlElemnt*)
+   * @param root the TiXmlElement T should load parameters from.
+   * @return the newly fabricated T.
+   */
+  virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const
+  {
+    return new T(root);
+  }
 };
 
Index: trunk/src/lib/util/loading/fast_factory.cc
===================================================================
--- trunk/src/lib/util/loading/fast_factory.cc	(revision 9869)
+++ trunk/src/lib/util/loading/fast_factory.cc	(revision 9869)
@@ -0,0 +1,281 @@
+/*
+   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: Benjamin Grauer
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOAD
+
+#include "fast_factory.h"
+
+#include "compiler.h"
+#include "debug.h"
+
+
+ObjectListDefinition(FastFactory);
+
+/**
+ * @brief Initializes a FastFactory
+ * @param classID the ClassID this Class belongs to (the top-most)
+ * @param fastFactoryName the Name of the ObjectClass-handled here
+ * @return a new FastFactory
+ */
+FastFactory::FastFactory (const ClassID& classID, const std::string& fastFactoryName)
+{
+  this->registerObject(this, FastFactory::_objectList);
+  this->setName(fastFactoryName);
+
+  this->storedClassID = classID;
+  this->next = NULL;
+
+  this->deadList = NULL;
+  this->unusedContainers = NULL;
+
+  this->storedDeadObjects = 0;
+
+  FastFactory::registerFastFactory(this);
+}
+
+/** a reference to the First FastFactory */
+FastFactory* FastFactory::first = NULL;
+
+/**
+ *  destructor
+ * deletes all the Instances of the FastFactory.
+ */
+FastFactory::~FastFactory ()
+{
+  if (this == first)
+    this->first = NULL;
+  this->flush();
+
+  if (this->next)
+    delete this->next;
+}
+
+/**
+ * deletes all FastFactories
+ */
+void FastFactory::deleteAll()
+{
+  if (FastFactory::first)
+    delete FastFactory::first;
+}
+
+/**
+ * registers a Factory to the List of known factories.
+ * @param fastFactory The factory to add
+ *
+ * needed, to step through all the FastFactories.
+ */
+void FastFactory::registerFastFactory(FastFactory* fastFactory)
+{
+  PRINTF(4)("Registered FastFactory for '%s'\n", fastFactory->getCName());
+
+  if( FastFactory::first == NULL)
+    FastFactory::first = fastFactory;
+  else
+  {
+    FastFactory* tmpFac = FastFactory::first;
+    while( tmpFac->next != NULL)
+      tmpFac = tmpFac->next;
+    tmpFac->setNext(fastFactory);
+  }
+}
+
+/**
+ * searches for a FastFactory
+ * @param classID the ClassID of the FastFactory to search for
+ * @returns true if found, false otherwise.
+ */
+FastFactory* FastFactory::searchFastFactory(const ClassID& classID)
+{
+  if (FastFactory::first == NULL)
+    return NULL;
+  else
+  {
+    FastFactory* tmpFac = FastFactory::first;
+    while (tmpFac != NULL)
+    {
+      if (tmpFac->storedClassID == classID)
+        return tmpFac;
+      tmpFac = tmpFac->next;
+    }
+  }
+  return NULL;
+}
+
+/**
+ * searches for a FastFactory
+ * @param classID the ClassID of the FastFactory to search for
+ * @returns true if found, false otherwise.
+ */
+FastFactory* FastFactory::searchFastFactory(const std::string& fastFactoryName)
+{
+  if (FastFactory::first == NULL)
+    return NULL;
+  else
+  {
+    FastFactory* tmpFac = FastFactory::first;
+    while (tmpFac != NULL)
+    {
+      if (fastFactoryName == tmpFac->getCName())
+        return tmpFac;
+      tmpFac = tmpFac->next;
+    }
+  }
+  return NULL;
+}
+
+/**
+ * Removes all the stored Containers, and sets the Lists back to emptienes.
+ * @param hardFLUSH if true the containing Objects will also be deleted !! THIS IS DANGEROUS !!
+ */
+void FastFactory::flushAll(bool hardFLUSH)
+{
+  FastFactory* tmpFac = FastFactory::first;
+  while (tmpFac != NULL)
+  {
+    PRINTF(4)("DELETEING ALL OF %s\n",tmpFac->getCName());
+    tmpFac->flush(hardFLUSH);
+    tmpFac = tmpFac->next;
+  }
+}
+
+/**
+ * ereases all the remaining containers, without deleting the stored Objects inside of them.
+ * @param hardFLUSH if the the containing Objects will also be deleted !! THIS IS DANGEROUS !!
+ */
+void FastFactory::flush(bool hardFLUSH)
+{
+  FastObjectMember* tmpMember = this->deadList, *delMember = NULL;
+  while (tmpMember != NULL)
+  {
+    delMember = tmpMember;
+    tmpMember = tmpMember->next;
+    if (hardFLUSH)
+      delete delMember->objectPointer;
+    delete delMember;
+  }
+  this->deadList = NULL;
+
+  tmpMember = this->unusedContainers;
+  while (tmpMember != NULL)
+  {
+    delMember = tmpMember;
+    tmpMember = tmpMember->next;
+    delete delMember;
+  }
+  this->unusedContainers = NULL;
+}
+
+/**
+ * generates count new Object of the Corresponding class. (precaching)
+ * @param count How many instances of the class should be generated.
+ */
+void FastFactory::prepare(unsigned int count)
+{
+/*  if (this->storedDeadObjects + this->storedLivingObjects >= count)
+  {
+  PRINTF(3)("not creating new Objects for class %s, because the requested count already exists\n", this->getClassCName());
+}*/
+  for (unsigned int i = this->storedDeadObjects; i < count; i++)
+  {
+    this->fabricate();
+  }
+}
+
+/**
+ * gives back live to one Object.
+ * @return the Object to resurrect.
+ */
+BaseObject* FastFactory::resurrect()
+{
+  PRINTF(4)("Resurecting Object of type %s\n", this->getCName());
+  if (unlikely(this->deadList == NULL))
+  {
+    PRINTF(3)("The deadList of Class %s is empty, this may be either because it has not been filled yet, or the cache is to small.\n" \
+        "  Developer: try increasing the count with FastFactory::prepare(contHigher than actual)\n" \
+        "    Fabricating a new %s\n", this->getCName(), this->getCName());
+    this->fabricate();
+    return this->resurrect();
+  }
+  else
+  {
+    FastObjectMember* tmpC = this->deadList;
+    this->deadList = this->deadList->next;
+
+    tmpC->next = this->unusedContainers;
+    this->unusedContainers = tmpC;
+
+    return tmpC->objectPointer;
+  }
+}
+
+/**
+ * gives back live to one Object.
+ * @param classID the class From which to resurrect an Object.
+ * @return the Object to resurrect, NULL if classID is not found.
+ */
+BaseObject* FastFactory::resurrect(const ClassID& classID)
+{
+  FastFactory* tmpFac = FastFactory::getFirst();
+
+  while (tmpFac != NULL)
+  {
+    if (classID == tmpFac->storedClassID)
+      return tmpFac->resurrect();
+    tmpFac = tmpFac->next;
+  }
+  return NULL;
+}
+
+/**
+ * kills Object object, meaning, that it will be stored in the deadList of the FastFactory, and waiting for resurrection
+ * @param object the Object to kill.
+ *
+ * synony that would be really grate would be abolish, but this is more like exterminate than pause-mode.
+ */
+void FastFactory::kill(BaseObject* object)
+{
+  FastObjectMember* tmpC;
+  if (unlikely(this->unusedContainers == NULL))
+  {
+    tmpC = new FastObjectMember;
+  }
+  else
+  {
+    tmpC = this->unusedContainers;
+    this->unusedContainers = this->unusedContainers->next;
+  }
+
+  tmpC->next = this->deadList;
+  tmpC->objectPointer = object;
+  this->deadList = tmpC;
+}
+
+
+void FastFactory::kill(BaseObject* object, bool searchForFastFactory)
+{
+  if (likely(searchForFastFactory == true))
+  {
+    FastFactory* tmpFac = FastFactory::first;
+    while (tmpFac != NULL)
+    {
+      if (object->isA(tmpFac->storedClassID))
+      {
+        tmpFac->kill(object);
+        return;
+      }
+      tmpFac = tmpFac->next;
+    }
+  }
+}
Index: trunk/src/lib/util/loading/fast_factory.h
===================================================================
--- trunk/src/lib/util/loading/fast_factory.h	(revision 9869)
+++ trunk/src/lib/util/loading/fast_factory.h	(revision 9869)
@@ -0,0 +1,176 @@
+/*!
+ * @file fast_factory.h
+ * The ObjectManager (FastFactory) is designed, to automatically generate and remove
+ * (without to much overhead) many instances of different classes.
+ *
+ * It is especially usefull for objects, that come only for a short time into existence,
+ * and get killed after a small amount of time (like shots).
+ *
+ * The Creation of an Object is usually done in the Weapon Class, where one subscribes
+ * a Projectile with:
+ * this->bulletFactory = tFastFactory<TestBullet>::getFastFactory(CL_TEST_BULLET, "TestBullet");
+ * (this might change over time).
+ * Then you can at loading time initialize an amount of the class with something like:
+ * this->bulletFactory->prepare(100); // creates 100 entities of TestBullet (dead ones)
+ * afterwards one can just retrieve an Object form the Class with
+ * this->bulletFactory->resurrect();  // this returns a BaseObject an Object of the class.
+ *
+ * The big difference to the FastFactory-class is, that this one is used more for the purpose
+ * of fast game-interaction than for loading. althought one can also load FastFactorized classes
+ * it is not the main topic.
+ */
+
+#ifndef _FAST_FACTORY_H
+#define _FAST_FACTORY_H
+
+#include "base_object.h"
+/**
+ * Creates a FastFactory to a Createable FastFactory.
+ */
+#define CREATE_FAST_FACTORY(CLASS_NAME, CLASS_ID) \
+  FastFactory* global_##CLASS_NAME##_FastFactory = tFastFactory<CLASS_NAME>::getFastFactory(CLASS_ID, #CLASS_NAME)
+/**
+ * Creates a FastFactory for a Class' static function named ClassName::fastFactory.
+ * @param CLASS_NAME the name of the Class to create the fast-factory for.
+ * @param CLASS_ID the ID of the class to create the fast-factory for @see "class_id_DEPRECATED.h"
+ *
+ * notice, that the Class to be called, must implement:
+ * static FastFactory*         fastFactory;
+ */
+#define CREATE_FAST_FACTORY_STATIC(CLASS_NAME) \
+  FastFactory* CLASS_NAME::fastFactory = tFastFactory<CLASS_NAME>::getFastFactory(CLASS_NAME::staticClassID(), #CLASS_NAME)
+
+//! A struct, that holds Lists of Objects of a certain type.
+typedef struct FastObjectMember
+{
+  BaseObject*          objectPointer;      //!< Pointer to the Object Stored in this Class (if it is the DeadList, else it is bork)
+
+  FastObjectMember*    next;               //!< the next stored FastObjectMember. (or NULL if this is the last one stored in either the deadList or the unusedContainers)
+};
+
+//! The FastFactory is a fast loadable object creator, and Dynamic List of dead object handler.
+/**
+ * The ObjectManager (FastFactory) is designed, to automatically generate and remove
+ * (without to much overhead) many instances of different classes.
+ *
+ * FastFactory is needed to glue all the tFastFactories together.
+ * It is also the general class that implements the necessary functions
+ * to generate, resurrect kill and stuff...
+ */
+class FastFactory : public BaseObject
+{
+  ObjectListDeclaration(FastFactory);
+
+public:
+  virtual ~FastFactory ();
+  static void deleteAll();
+
+  // functions to push and pop elements of this class
+  BaseObject* resurrect();
+  static BaseObject* resurrect(const ClassID& classID);
+  void kill(BaseObject* object);
+  static void kill(BaseObject* object, bool searchForFastFactory);
+
+  void prepare(unsigned int count);
+
+  static void flushAll(bool hardFLUSH = false);
+  void flush(bool hardFLUSH = false);
+
+  /** @returns the first FastFactory */
+  inline static FastFactory* getFirst() { return FastFactory::first; };
+
+  static FastFactory* searchFastFactory(const ClassID& classID);
+  static FastFactory* searchFastFactory(const std::string& fastFactoryName);
+
+  const ClassID& getStoredID() const { return this->storedClassID; };
+
+protected:
+  FastFactory (const ClassID& classID, const std::string& fastFactoryName = "");
+
+  /** 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; };
+
+  /** generates a new Object of the Class T */
+  virtual void fabricate() = 0;
+
+private:
+  static void registerFastFactory(FastFactory* fastFactory);
+
+protected:
+  ClassID            storedClassID;        //!< The classID of the specified class.
+  unsigned int          storedDeadObjects;    //!< How many dead objects are stored in this class
+
+  FastObjectMember*     deadList;             //!< A List of all stored dead Objects of this class.
+  FastObjectMember*     unusedContainers;     //!< This is a List of unused containers, that will be reused by kill.
+
+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:
+  static tFastFactory<T>* getFastFactory(const ClassID& classID, const std::string& fastFactoryName);
+
+private:
+  tFastFactory(const ClassID& classID, const std::string& fastFactoryName);
+
+  virtual void fabricate();
+};
+
+/**
+ * construnts a FastFactory with
+ * @param fastFactoryName the name of the FastFactory
+ * @param fastFactory the ID of the class
+ * @todo (can this be written in another form??)
+ */
+template<class T>
+tFastFactory<T>::tFastFactory(const ClassID& classID, const std::string& fastFactoryName)
+    : FastFactory(classID, fastFactoryName)
+{}
+
+/**
+ * creates (if not existent) a Factory of Class T, and assigns some values to it
+ * @param classID the ClassID to assign to this class
+ * @param fastFactoryName the name to assign
+ * @returns The FastFactory if existent a new Factory if not.
+ */
+template<class T>
+tFastFactory<T>* tFastFactory<T>::getFastFactory(const ClassID& classID, const std::string& fastFactoryName)
+{
+  tFastFactory<T>* tmpFac = NULL;
+  if (FastFactory::getFirst() != NULL)
+    tmpFac = static_cast<tFastFactory<T>*>(FastFactory::getFirst()->searchFastFactory(classID));
+
+  if (tmpFac != NULL)
+    return tmpFac;
+  else
+    return new tFastFactory<T>(classID, fastFactoryName);
+}
+
+/**
+ * fabricates an Object of Class T, that corresponds to classID.
+ */
+template<class T>
+void tFastFactory<T>::fabricate()
+{
+  FastObjectMember* tmpFirstDead = new FastObjectMember;
+  tmpFirstDead->objectPointer = new T();
+  tmpFirstDead->next = this->deadList;
+  ++this->storedDeadObjects;
+
+  this->deadList = tmpFirstDead;
+}
+
+#endif /* _FAST_FACTORY_H */
Index: trunk/src/lib/util/loading/game_loader.cc
===================================================================
--- trunk/src/lib/util/loading/game_loader.cc	(revision 9675)
+++ trunk/src/lib/util/loading/game_loader.cc	(revision 9869)
@@ -20,18 +20,11 @@
 #include "game_loader.h"
 #include "util/loading/load_param.h"
-
-#include "shell_command.h"
+#include "util/loading/resource_manager.h"
+#include "debug.h"
 #include "campaign.h"
 
-#include "util/loading/resource_manager.h"
-
 #include "key_mapper.h"
 
-
-
-SHELL_COMMAND(quit, GameLoader, stop)
-->describe("quits the game")
-->setAlias("orxoquit");
-
+ObjectListDefinition(GameLoader);
 
 GameLoader* GameLoader::singletonRef = NULL;
@@ -43,5 +36,5 @@
 GameLoader::GameLoader ()
 {
-  this->setClassID(CL_GAME_LOADER, "GameLoader");
+  this->registerObject(this, GameLoader::_objectList);
   this->setName("GameLoader");
   this->bRun = true;
@@ -57,5 +50,5 @@
     delete this->currentCampaign;
   this->currentCampaign = NULL;
-  
+
   GameLoader::singletonRef = NULL;
 }
@@ -90,5 +83,5 @@
 {
   ErrorMessage errorCode;
-  std::string campaignName = ResourceManager::getFullName(fileName);
+  std::string campaignName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
   if (!campaignName.empty())
   {
@@ -110,5 +103,5 @@
 {
   ErrorMessage errorCode;
-  std::string campaignName = ResourceManager::getFullName(fileName);
+  std::string campaignName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
   if (!campaignName.empty())
   {
Index: trunk/src/lib/util/loading/game_loader.h
===================================================================
--- trunk/src/lib/util/loading/game_loader.h	(revision 9675)
+++ trunk/src/lib/util/loading/game_loader.h	(revision 9869)
@@ -38,5 +38,6 @@
 class GameLoader : public EventListener
 {
- public:
+  ObjectListDeclaration(GameLoader);
+  public:
   virtual ~GameLoader ();
   /**  this class is a singleton class @returns an instance of itself  */
Index: trunk/src/lib/util/loading/load_param.cc
===================================================================
--- trunk/src/lib/util/loading/load_param.cc	(revision 9675)
+++ trunk/src/lib/util/loading/load_param.cc	(revision 9869)
@@ -16,21 +16,17 @@
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOADING
 
-#include "util/loading/load_param.h"
-#include "load_param_description.h"
-
-#include <stdarg.h>
-
+#include "load_param.h"
+#include "load_param_class_description.h"
+#include "compiler.h"
+#include "debug.h"
 /**
- * Constructs a new LoadParameter
+ * @brief Constructs a new LoadParameter
  * @param root the XML-element to load this Parameter from
  * @param paramName the Parameter to load
- * @param object the BaseObject, to load this parameter on to (will be cast to executor's Parameter)
- * @param executor the Executor, that executes the loading procedure.
+ * @param inLoadCycle If we are in a LoadCycle (loading differs.).
  */
-CLoadParam::CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor* executor, bool inLoadCycle)
-  :  object(object), paramName(paramName)
+LoadParamBase::LoadParamBase(const TiXmlElement* root, const std::string& paramName, bool inLoadCycle)
+    :  paramName(paramName), inLoadCycle(inLoadCycle)
 {
-  this->inLoadCycle = inLoadCycle;
-
   // determin the LoadString.
   if (likely(!inLoadCycle))
@@ -40,181 +36,29 @@
   else
     this->loadElem = NULL;
+}
 
-  // set the Executor.
-  this->executor = executor;
 
-  //if (this->executor)
-  //  this->executor->setName(paramName);
+/**
+ * @param classID the ID of the class. This is needed to identify into what class this Parameter belongs.
+ * @param descriptionText The text to set as a description for this Parameter
+ * @returns a pointer to itself.
+ */
+void LoadParamBase::describe(const ClassID& classID, const std::string& descriptionText)
+{
+  PRINTF(5)("Describing Class '%s'(id:%d) Parameter '%s': description '%s'\n",
+            classID.name().c_str(), classID.id(), paramName.c_str(), descriptionText.c_str());
+
+  if (LoadParamClassDescription::descriptionsCaptured())
+    LoadParamClassDescription::describeClass(classID, paramName, descriptionText);
 }
 
 /**
- * This is a VERY SPECIAL deconsrtuctor.
- * It is made, so that it loads the Parameters on destruction.
- * meaning, if an Executor a valid Object exist, and all
- * Execution-Conditions are met, they are executed here.
+ * @brief sets the Values of the Description to a usefull text.
  */
-CLoadParam::~CLoadParam()
+void LoadParamBase::setDescriptionValues(const ClassID& classID, unsigned int paramCount, const MultiType* const defaultValues, bool retVal)
 {
-  if (likely(this->executor != NULL))
-  {
-    std::string loadString = "";
-    if (this->loadElem != NULL &&  this->loadElem->ToText())
-      loadString = this->loadElem->Value();
-    if (likely(this->object != NULL) &&
-        ( !loadString.empty() ||
-          ((this->executor->getType() & Executor_NoLoadString) == Executor_NoLoadString)))
-    {
-      PRINTF(4)("Loading value '%s' with Parameters '%s' onto: %s::%s\n", this->paramName.c_str(), loadString.c_str(), this->object->getClassCName(), this->object->getCName());
-      (*this->executor)(this->object, SubString(loadString, ",", SubString::WhiteSpaces, false, '\\'));
-    }
-    delete this->executor;
-  }
+  if(LoadParamClassDescription::descriptionsCaptured())
+    LoadParamClassDescription::setValuesOf(classID, paramName, paramCount, defaultValues, retVal);
 }
-
-/**
- * @brief set the default values of the executor
- * @param value0 the first default value
- * @param value1 the second default value
- * @param value2 the third default value
- * @param value3 the fourth default value
- * @param value4 the fifth default value
- */
-CLoadParam& CLoadParam::defaultValues(const MultiType& value0, const MultiType& value1,
-                                      const MultiType& value2, const MultiType& value3,
-                                      const MultiType& value4)
-{
-  assert(this->executor != NULL);
-  this->executor->defaultValues(value0, value1, value2, value3, value4);
-
-  return *this;
-}
-
-
-
-/**
- * @param descriptionText The text to set as a description for this Parameter
- * @returns a pointer to itself.
-*/
-CLoadParam& CLoadParam::describe(const std::string& descriptionText)
-{
-  if (LoadClassDescription::parametersDescription && this->paramDesc && this->paramDesc->getDescription().empty())
-  {
-    this->paramDesc->setDescription(descriptionText);
-  }
-  return *this;
-}
-
-// const LoadParamDescription* LoadParamDescription::getClass(const char* className)
-// {
-//   tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();
-//   LoadClassDescription* enumClassDesc = iterator->firstElement();
-//   while (enumClassDesc)
-//   {
-//     if (!strcmp(enumClassDesc->className, classNameBegin, className))
-//     {
-//       delete iterator;
-//       return enumClassDesc;
-//     }
-//     enumClassDesc = iterator->nextElement();
-//   }
-//   delete iterator;
-//
-//   return NULL;
-// }
-
-
-
-
-/*
- * @param object The object this Parameter is loaded too.
- * @param root: the XML-element to load this option from.
- * @param paramName: The name of the parameter loaded.
- * @param paramCount: how many parameters this loading-function takes
- * @param multi: if false LoadParam assumes only one occurence of this parameter in root, if true it assumes multiple occurences.
- * @param ...: the parameter information (1. Parameter, 2. Default Value for the Parameter, ...)
-*/
-/*LoadParam::LoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName,
-                             int paramCount, bool multi, const void* pointerToParam, ...)
-{
-  this->setClassID(CL_LOAD_PARAM, "LoadParam");
-  this->executor = NULL;
-
-  this->loadString = NULL;
-  this->pointerToParam = pointerToParam;
-
-  if (paramCount == 0 || this->pointerToParam != NULL)
-    this->loadString = "none";
-  else
-{
-      if (likely(!multi))
-        this->loadString = grabParameter(root, paramName);
-      else
-{
-          if (!strcmp(root->Value(), paramName))
-{
-              const TiXmlNode* val = root->FirstChild();
-              if( val->ToText())
-                this->loadString = val->Value();
-}
-}
-}
-
-  this->paramDesc = NULL;
-  if (LoadClassDescription::parametersDescription)
-{
-    // locating the class
-    this->classDesc = LoadClassDescription::addClass(object->getClassCName());
-
-    if ((this->paramDesc = this->classDesc->addParam(paramName)) != NULL)
-{
-
-      this->paramDesc->paramCount = paramCount;
-      this->paramDesc->types = new int[paramCount];
-      this->paramDesc->defaultValues = new char*[paramCount];
-
-      va_list types;
-      va_start (types, pointerToParam);
-      char defaultVal[512];
-      for(int i = 0; i < paramCount; i++)
-{
-        defaultVal[0] = '\0';
-          // parameters parsed
-        int tmpType = va_arg (types, int);
-        this->paramDesc->types[i] = tmpType;
-        switch (tmpType)
-{
-  case MT_INT:
-            sprintf(defaultVal, "%d", va_arg(types, int));
-            break;
-//          case MT_LONG:
-//            sprintf(defaultVal, "%0.3f", va_arg(types, l_LONG_TYPE));
-//            break;
-  case MT_FLOAT:
-            sprintf(defaultVal, "%0.3f", va_arg(types, double));
-            break;
-  case MT_STRING:
-            sprintf(defaultVal, "%s", va_arg(types, l_STRING_TYPE));
-            break;
-  case MT_EXT1:
-            sprintf(defaultVal, "");
-            break;
-}
-        this->paramDesc->defaultValues[i] = new char[strlen(defaultVal)+1];
-        strcpy(this->paramDesc->defaultValues[i], defaultVal);
-}
-      va_end(types);
-
-      int argCount = 0;
-}
-}
-}*/
-
-
-
-
-
-
-
-
 
 
@@ -227,22 +71,14 @@
  * @returns the Value of the parameter if found, NULL otherwise
 */
-std::string grabParameter(const TiXmlElement* root, const std::string& parameterName)
+std::string LoadParamBase::grabParameter(const TiXmlElement* root, const std::string& parameterName)
 {
-  const TiXmlElement* element;
-  const TiXmlNode* node;
-
-  if (root == NULL)
-    return "";
-
-  element = root->FirstChildElement( parameterName);
-  if( element == NULL) return "";
-
-  node = element->FirstChild();
-  while( node != NULL)
+  const TiXmlElement* const element = grabParameterElement(root, parameterName);
+  if (element != NULL)
+    return element->Value();
+  else
   {
-    if( node->ToText()) return node->Value();
-    node = node->NextSibling();
+    static std::string empty("");
+    return empty;
   }
-  return "";
 }
 
@@ -252,5 +88,5 @@
  * @returns the Element of the parameter if found, NULL otherwise
  */
-const TiXmlElement* grabParameterElement(const TiXmlElement* root, const std::string& parameterName)
+const TiXmlElement* LoadParamBase::grabParameterElement(const TiXmlElement* root, const std::string& parameterName)
 {
   const TiXmlElement* element;
@@ -271,5 +107,2 @@
   return NULL;
 }
-
-
-
Index: trunk/src/lib/util/loading/load_param.h
===================================================================
--- trunk/src/lib/util/loading/load_param.h	(revision 9675)
+++ trunk/src/lib/util/loading/load_param.h	(revision 9869)
@@ -22,18 +22,18 @@
 #define _LOAD_PARAM_H
 
-#include "base_object.h"
+#include "util/executor/executor_substring.h"
+#include "util/executor/executor_member.h"
+#include "util/executor/functor_member.h"
 
-#include "executor/executor.h"
-#include "executor/executor_xml.h"
+#include "parser/tinyxml/tinyxml.h"
 
 // Forward Declaration //
 class LoadClassDescription;
 class LoadParamDescription;
-class MultiType;
-
+class TiXmlElement;
 
 /**
  * Loads a Parameter from ROOT named PARAMETER_NAME
- * onto OBJECT of CLASS, trough the FUNCTION
+ * onto OBJECT of CLASS, trough FUNCTION
  * @param ROOT the TiXmlElement to load the Parameter from
  * @param PARAMETER_NAME the Name of the Parameter to load
@@ -43,15 +43,16 @@
  */
 #define LoadParam(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
-         CLoadParam(ROOT, PARAMETER_NAME, OBJECT, createExecutor<CLASS>(&CLASS::FUNCTION), false)
+         CLoadParam<CLASS>(ROOT, PARAMETER_NAME, OBJECT, createExecutor<CLASS, CLASS>(&CLASS::FUNCTION), false)
 
+/**
+ * @brief Does essentially the same as LoadParam, but within a Cycle in an ordered fashion.
+ *
+ * This Function looks in each Element, if the PARAMETER_NAME matches, and loads onto OBJECT
+ * of CLASS the ROOT through FUNCTION
+ *
+ * @see LoadParam(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION)
+ */
 #define LoadParam_CYCLE(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
-         CLoadParam(ROOT, PARAMETER_NAME, OBJECT, createExecutor<CLASS>(&CLASS::FUNCTION), true)
-
-#define LoadParamXML(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
-         CLoadParam(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), false)
-
-#define LoadParamXML_CYCLE(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
-         CLoadParam(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), true)
-
+         CLoadParam<CLASS>(ROOT, PARAMETER_NAME, OBJECT, createExecutor<CLASS, CLASS>(&CLASS::FUNCTION), true)
 
 /**
@@ -78,39 +79,81 @@
 }
 
+
 /**************************
 **** REAL DECLARATIONS ****
 **************************/
-//! abstract Base class for a Loadable parameter
-class CLoadParam : public BaseObject
+//!< A BaseClass for all LoadParam's.
+class LoadParamBase
 {
-  public:
-    CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor* executor, bool inLoadCycle = false);
-    virtual ~CLoadParam();
+protected:
+  LoadParamBase(const TiXmlElement* root, const std::string& paramName, bool inLoadCycle = false);
 
-    CLoadParam& describe(const std::string& descriptionText);
-    CLoadParam& defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
-                              const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
-                              const MultiType& value4 = MT_NULL);
-    CLoadParam& attribute(const std::string& attributeName, const Executor& executor);
+protected:
+  void describe(const ClassID& classID, const std::string& descriptionText);
+  void setDescriptionValues(const ClassID& classID, unsigned int paramCount, const MultiType* const defaultValues, bool retVal = false);
+
+public:
+  static std::string grabParameter(const TiXmlElement* root, const std::string& parameterName);
+  static const TiXmlElement* grabParameterElement(const TiXmlElement* root, const std::string& parameterName);
+
+protected:
+  const std::string        paramName;            //!< The Name of the Parameter this LoadParams applies to.
+  bool                     inLoadCycle;          //!< If the Parameter is in a LoadCycle.
+
+  const TiXmlElement*      loadElem;             //!< The Element to load.
+};
 
 
-  private:
-    bool                     inLoadCycle;
-    Executor*                executor;
-    BaseObject*              object;
-    const std::string        paramName;
+//! The Loading Class of the LoadParam, that acctually executes the loading process.
+template <class OperateClass> class CLoadParam : public LoadParamBase
+{
+public:
+  /**
+   * @brief generates a LoadParam based on:
+   * @param root the Root Element to load onto the object. @param paramName the Parameter name that is loaded.
+   * @param object the Object to apply the changes on. @param executor the Functional Object, that actually executes the function Call.
+   * @param inLoadCycle If we are inside of a loading cycle. (Loading will be different here)
+   */
+  CLoadParam(const TiXmlElement* root, const std::string& paramName, OperateClass* object, Executor<const SubString, OperateClass>* executor, bool inLoadCycle = false)
+      : LoadParamBase(root, paramName, inLoadCycle)
+  {
+    assert (executor != NULL);
+    this->object = object;
+    this->executor = executor;
+  }
+  virtual ~CLoadParam()
+  {
+    std::string loadString;
+    if (this->loadElem != NULL &&  this->loadElem->ToText())
+    {
+      loadString = this->loadElem->Value();
+      if (!loadString.empty())
+      {
+        /*	PRINTF(4)("Loading value '%s' with Parameters '%s' onto: %s::%s\n",
+        	this->paramName.c_str(), loadString.c_str(), this->object->getClassCName(), this->object->getCName());*/
+        (*this->executor)(this->object, SubString(loadString, ",", SubString::WhiteSpaces, false, '\\'));
+      }
+    }
+    this->setDescriptionValues(OperateClass::staticClassID(), executor->getParamCount(), executor->getDefaultValues(), executor->hasRetVal());
+    delete this->executor;
+  }
+  /**
+   * @brief set the default values of the executor
+   * @param value0 the first default value   @param value1 the second default value
+   * @param value2 the third default value   @param value3 the fourth default value
+   * @param value4 the fifth default value
+   */
+  CLoadParam& defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
+                            const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
+                            const MultiType& value4 = MT_NULL)
+  { this->executor->defaultValues(value0, value1, value2, value3, value4); return *this;  };
+  //! Describes a LoadParam
+  CLoadParam& describe(const std::string& descriptionText) { LoadParamBase::describe(OperateClass::staticClassID(), descriptionText); return *this; };
+  //     CLoadParam& attribute(const std::string& attributeName, const Executor<SubString>& executor);
 
-    LoadClassDescription*    classDesc;            //!< The LoadClassDescription of this CLoadParameter
-    LoadParamDescription*    paramDesc;            //!< The LoadParameterDescription of this LoadParameter
-    const TiXmlElement*      loadElem;             //!< The Element to load.
-    const void*              pointerToParam;       //!< A Pointer to a Parameter.
-
-    MultiType*               defaultValue;
+private:
+  Executor<const SubString, OperateClass>*         executor;            //!< The Executor, that actually executes the Loading process.
+  OperateClass*                                    object;              //!< The Object this LoadParam operates on.
 };
 
-// helper function
-
-std::string grabParameter(const TiXmlElement* root, const std::string& parameterName);
-const TiXmlElement* grabParameterElement(const TiXmlElement* root, const std::string& parameterName);
-
 #endif /* _LOAD_PARAM_H */
Index: trunk/src/lib/util/loading/load_param_class_description.cc
===================================================================
--- trunk/src/lib/util/loading/load_param_class_description.cc	(revision 9869)
+++ trunk/src/lib/util/loading/load_param_class_description.cc	(revision 9869)
@@ -0,0 +1,171 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#include "load_param_class_description.h"
+
+#include "multi_type.h"
+#include "debug.h"
+#include <cassert>
+
+/**
+ * @brief A list, that holds all the classes that are loadable (classes not objects!!)
+ */
+LoadParamClassDescription::ClassDescriptionMap LoadParamClassDescription::_classList;
+
+/**
+ * @brief if the description of Parameters should be executed
+ */
+bool LoadParamClassDescription::_captureDescriptions = false;
+
+/**
+ * @param className the name of the class to be loadable
+ */
+LoadParamClassDescription::LoadParamClassDescription(const std::string& className)
+    : _className(className)
+{ }
+
+
+/**
+ * @brief clears all LoadParamDescriptions.
+ */
+void LoadParamClassDescription::deleteAllDescriptions()
+{
+  LoadParamClassDescription::_classList.clear();
+}
+
+
+/**
+ * @brief describes a LoadParam-parameter.
+ * @param classID the ID of the class.
+ * @param paramName the Name of the Parameter.
+ * @param descriptionText the Test to set.
+ */
+void LoadParamClassDescription::describeClass(const ClassID& classID,
+    const std::string& paramName,
+    const std::string& descriptionText)
+{
+  ParamDescriptionMap::iterator it = LoadParamClassDescription::getParamDescription(classID, paramName);
+
+  (*it).second.setDescription(descriptionText);
+}
+
+/**
+ * @brief sets Values of the specified LoadParam-parameter.
+ * @param classID the ID of the class.
+ * @param paramName the name of the Parameter.
+ * @param paramCount the count of Parameters this LoadParam takes.
+ * @param defaultValues the default Values.
+ * @param retVal if the Parameter takes return Values.
+ */
+void LoadParamClassDescription::setValuesOf(const ClassID& classID,
+    const std::string& paramName,
+    unsigned int paramCount,
+    const MultiType* const defaultValues,
+    bool retVal)
+{
+  ParamDescriptionMap::iterator it = LoadParamClassDescription::getParamDescription(classID, paramName);
+  (*it).second.setValues(paramCount, defaultValues, retVal);
+}
+
+
+/**
+ * @brief finds the Iterator to the ParameterDescription paramName matching classID
+ * @param classID the ClassID to match.
+ * @param paramName the name of the parameter in the Class.
+ * @returns the iterator on match.
+ *
+ * @note this function creates the Element classID.name()::paramName on the go if it does not exist.
+ */
+LoadParamClassDescription::ParamDescriptionMap::iterator
+LoadParamClassDescription::getParamDescription(const ClassID& classID, const std::string& paramName)
+{
+  /// Locate the ClassDescription first
+  ClassDescriptionMap::iterator classIt = LoadParamClassDescription::_classList.find(classID);
+  if (classIt == LoadParamClassDescription::_classList.end())
+  {
+    LoadParamClassDescription::_classList[classID] = LoadParamClassDescription(classID.name());
+    classIt = LoadParamClassDescription::_classList.find(classID);
+  }
+  // At this position the class-iterator should point to a valid usefull position.
+  assert(classIt != LoadParamClassDescription::_classList.end());
+
+  /// Now locate the description with paramName.
+  ParamDescriptionMap::iterator paramIt = (*classIt).second._parameters.find(paramName);
+  if (paramIt == (*classIt).second._parameters.end())
+  {
+    (*classIt).second._parameters[paramName] = LoadParamDescription(paramName);
+    paramIt = (*classIt).second._parameters.find(paramName);
+  }
+  // at this position the param-iterator should
+  assert (paramIt != (*classIt).second._parameters.end());
+
+  return (paramIt);
+}
+
+/**
+ * @brief prints out a nice output about this Classes Loading, and their parameters
+ * @param stream the stream to write to.
+ * @param withComments if Comments should be included.
+ */
+void LoadParamClassDescription::print(FILE* stream, bool withComments) const
+{
+  fprintf(stream, "<%s>\n", this->_className.c_str());
+  for (ParamDescriptionMap::const_iterator param = this->_parameters.begin();
+       param != this->_parameters.end();
+       ++param)
+  {
+    (*param).second.print(stream, withComments);
+  }
+  fprintf(stream, "</%s>\n\n", this->_className.c_str());
+}
+
+
+/**
+ * @brief prints out all loadable Classes, and their parameters
+ * @param fileName prints the output to a File
+ * @param withComments if Comments should be included.
+ */
+void LoadParamClassDescription::printAll(const std::string& fileName, bool withComments)
+{
+  FILE* stream;
+  if( (stream = fopen (fileName.c_str(), "w")) == NULL)
+  {
+    PRINTF(2)("File '%s' could not be opened for writing\n Printing to stdout\n", fileName.c_str());
+    LoadParamClassDescription::printAllTo(stdout, withComments);
+    return;
+  }
+  else
+    LoadParamClassDescription::printAllTo(stream, withComments);
+
+  fclose (stream);
+}
+
+/**
+ * @brief prints out all loadable Classes, and their parameters to a stream
+ * @param stream the stream to print to.
+ * @param withComments if Comments should be included.
+ */
+void LoadParamClassDescription::printAllTo(FILE* stream, bool withComments)
+{
+  fprintf(stream, "===============================================================\n");
+  fprintf(stream, " Listing all the Loadable Options (loaded since Game started).\n\n");
+  for (ClassDescriptionMap::const_iterator classIt = LoadParamClassDescription::_classList.begin();
+       classIt != LoadParamClassDescription::_classList.end();
+       classIt ++)
+  {
+    (*classIt).second.print(stream, withComments);
+  }
+  fprintf(stream, "===============================================================\n");
+}
Index: trunk/src/lib/util/loading/load_param_class_description.h
===================================================================
--- trunk/src/lib/util/loading/load_param_class_description.h	(revision 9869)
+++ trunk/src/lib/util/loading/load_param_class_description.h	(revision 9869)
@@ -0,0 +1,84 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+/*!
+ * @file load_param_class_description.h
+ * A Class and macro-functions, that makes our lives easy to load-in parameters
+ */
+
+#ifndef _LOAD_PARAM_CLASS_DESCRIPTION_H
+#define _LOAD_PARAM_CLASS_DESCRIPTION_H
+
+#include "load_param_description.h"
+#include "class_id.h"
+#include <map>
+// Forward Declaration //
+class MultiType;
+
+//! A class for descriptions of a loadable module
+class LoadParamClassDescription
+{
+public:
+  LoadParamClassDescription(const std::string& className = "");
+
+  //! Compares a LoadParamClassDescription with a String.
+  bool operator==(const std::string& className) const { return this->_className == className; };
+  //! Compares two LoadParamClassDescription with each other
+  bool operator==(const LoadParamClassDescription& classDescr) const { return this->_className == classDescr._className; };
+  //! Compares two LoadParamClassDescription with each other, using the less operator
+  bool operator<(const LoadParamClassDescription& classDescr) const { return this->_className < classDescr._className; }
+
+
+  static void describeClass(const ClassID& classID,
+                            const std::string& paramName,
+                            const std::string& descriptionText);
+  static void setValuesOf(const ClassID& classID,
+                          const std::string& paramName,
+                          unsigned int paramCount,
+                          const MultiType* const defaultValues,
+                          bool retVal = false);
+
+  /** @param createThem: if the Parameters should be created/stored. */
+  static void captureDescriptions(bool createThem) { _captureDescriptions = createThem; };
+  /** @returns if the Parameters are created/stored. */
+  static bool descriptionsCaptured() { return _captureDescriptions; };
+
+  static void deleteAllDescriptions();
+
+  void print(FILE* stream = stdout, bool withComments = true) const;
+  static void printAll(const std::string& fileName = "", bool withComments = true);
+  static void printAllTo(FILE* stream = stdout, bool withComments = true);
+
+private:
+  //! A Type definition for the Map of Class Descriptions
+  typedef std::map<ClassID, LoadParamClassDescription>  ClassDescriptionMap;
+  //! A type definition for the Map of Parameter Descriptions inside of Class-descriptions.
+  typedef std::map<std::string, LoadParamDescription>   ParamDescriptionMap;
+
+private:
+  static ParamDescriptionMap::iterator getParamDescription(const ClassID& classID, const std::string& paramName);
+
+private:
+
+  static bool                                  _captureDescriptions;    //!< if parameter-description should be enabled globally.
+
+  static ClassDescriptionMap                   _classList;              //!< a list, that stores all the loadable classes. (after one instance has been loaded)
+
+private:
+  std::string                                  _className;              //!< name of the class
+  ParamDescriptionMap                          _parameters;             //!< List of parameters this class knows.
+};
+
+#endif /* _LOAD_PARAM_CLASS_DESCRIPTION_H */
Index: trunk/src/lib/util/loading/load_param_description.cc
===================================================================
--- trunk/src/lib/util/loading/load_param_description.cc	(revision 9675)
+++ trunk/src/lib/util/loading/load_param_description.cc	(revision 9869)
@@ -17,33 +17,13 @@
 
 #include "multi_type.h"
-#include <stdarg.h>
 #include "debug.h"
 
 /**
+ * @brief Creates a Description of a LoadParam
  * @param paramName the name of the parameter to load
  */
 LoadParamDescription::LoadParamDescription(const std::string& paramName)
-{
-  this->types = NULL;
-  this->defaultValues = NULL;
-  this->paramName = paramName;
-}
-
-/**
- *  removes all the alocated memory
- */
-LoadParamDescription::~LoadParamDescription()
-{
-  if (this->defaultValues != NULL)
-  {
-    for(int i = 0; i < this->paramCount; i++)
-    {
-      delete[] this->defaultValues[i];
-    }
-  }
-
-  delete[] this->types;
-  delete[] this->defaultValues;
-}
+    : _name(paramName), _parameterCount(0)
+{ }
 
 /**
@@ -52,229 +32,71 @@
 void LoadParamDescription::setDescription(const std::string& descriptionText)
 {
-  this->description = descriptionText;
+  this->_description = descriptionText;
 }
 
 /**
- *  prints out this parameter, its input method and the description (if availiable)
+ * @brief sets the Values of the LoadParam in the Description.
+ * @param paramCount the count of arguments the underlying paramDescription takes.
+ * @param defaultValues the default Values the underlying parameter takes.
+ * @param retVal if the underlying parameter has a return value
  */
-void LoadParamDescription::print() const
+void LoadParamDescription::setValues(unsigned int paramCount,
+                                     const MultiType* const defaultValues,
+                                     bool retVal)
 {
-  PRINT(3)(" <%s>", this->paramName.c_str());
-  for (int i = 0; i < this->paramCount; i++)
+  this->_parameterCount = paramCount;
+  for (unsigned int i = 0; i < paramCount; ++i)
   {
-    if (i > 0)
-      PRINT(3)(",");
-    // FIXME
-    //     switch (this->types[i])
-//     {
-//       default:
-//         PRINTF(3)("none");
-//         break;
-//       case ParameterBool:
-//         PRINT(3)("bool");
-//         break;
-//       case ParameterChar:
-//         PRINT(3)("char");
-//         break;
-//       case ParameterString:
-//         PRINT(3)("string");
-//         break;
-//       case ParameterInt:
-//         PRINT(3)("int");
-//         break;
-//       case ParameterUInt:
-//         PRINT(3)("Uint");
-//         break;
-//       case ParameterFloat:
-//         PRINT(3)("float");
-//         break;
-//       case ParameterLong:
-//         PRINT(3)("long");
-//         break;
-//       case ParameterXML:
-//         PRINT(3)("XML");
-//         break;
-//     }
+    this->_defaultValues.push_back(defaultValues[i].getString());
+    this->_types.push_back(MultiType::MultiTypeToString(defaultValues[i].getType()));
   }
-  PRINT(3)("</%s>", this->paramName.c_str());
-  if (!this->description.empty())
-    PRINT(3)(" -- %s", this->description.c_str());
-  // default values
-  if (this->paramCount > 0)
-  {
-    PRINT(3)(" (Default: ");
-    for (int i = 0; i < this->paramCount; i++)
-    {
-      if (i > 0)
-        PRINT(3)(", ");
-      if (this->types[i] & MT_STRING)
-      { // leave brackets !!
-        PRINT(3)("\"%s\"", this->defaultValues[i]);
-      }
-      else
-      {
-        PRINT(3)("%s", this->defaultValues[i]);
-      }
-    }
-    PRINT(3)(")");
-  }
-  PRINT(3)("\n");
-}
 
-/**
- *  A list, that holds all the classes that are loadable (classes not objects!!)
- */
-std::list<LoadClassDescription*>* LoadClassDescription::classList = NULL;
-
-/**
- *  if the description of Parameters should be executed
- */
-bool LoadClassDescription::parametersDescription = false;
-
-/**
- * @param className the name of the class to be loadable
- */
-LoadClassDescription::LoadClassDescription(const std::string& className)
-{
-  this->className = className;
-
-  if (LoadClassDescription::classList == NULL)
-    LoadClassDescription::classList = new std::list<LoadClassDescription*>;
-
-  LoadClassDescription::classList->push_back(this);
-}
-
-/**
- *  deletes a classDescription (deletes all the parameterDescriptions as well
- */
-LoadClassDescription::~LoadClassDescription()
-{
-  std::list<LoadParamDescription*>::iterator it = this->paramList.begin();
-  while (!this->paramList.empty())
-  {
-    delete this->paramList.front();
-    this->paramList.pop_front();
-  }
-}
-
-void LoadClassDescription::deleteAllDescriptions()
-{
-  if (LoadClassDescription::classList != NULL)
-  {
-    while (!LoadClassDescription::classList->empty())
-    {
-      delete LoadClassDescription::classList->front();
-      LoadClassDescription::classList->pop_front();
-    }
-    delete LoadClassDescription::classList;
-  }
-  LoadClassDescription::classList = NULL;
 }
 
 
 /**
- *  adds a class to the list of loadable classes
- * @param className The name of the class to add
-
-   this function searches for the className string, and if found just returns the appropriate Class.
-   Otherwise it returns a new classDescription
+ * @brief prints out this parameter, its input method and the description (if availiable)
+ * @param stream the stream to print to.
+ * @param withComments if the comments should be appended.
  */
-LoadClassDescription* LoadClassDescription::addClass(const std::string& className)
+void LoadParamDescription::print(FILE* stream, bool withComments) const
 {
-  if (LoadClassDescription::classList != NULL)
+  fprintf(stream, " <%s>", this->_name.c_str());
+  for (unsigned int i = 0; i < this->_parameterCount; i++)
   {
-    std::list<LoadClassDescription*>::iterator it = LoadClassDescription::classList->begin();
-    while (it != LoadClassDescription::classList->end())
+    if (i > 0)
+      fprintf(stream, ",");
+    fprintf(stream, "%s", this->_types[i].c_str());
+  }
+  fprintf(stream, "</%s>", this->_name.c_str());
+  // here the comments are printed out.
+  if (withComments)
+  {
+    if (!this->_description.empty())
+      fprintf(stream, " <!-- %s", this->_description.c_str());
+    // default values
+    if (this->_parameterCount > 0)
     {
-      if ((*it)->className == className)
+      fprintf(stream, " (Default: ");
+      for (unsigned int i = 0; i < this->_parameterCount; i++)
       {
-        return (*it);
+        if (i > 0)
+          fprintf(stream, ", ");
+        if (this->_types[i] == "string")
+        { // leave brackets !!
+          fprintf(stream, "\"%s\"", this->_defaultValues[i].c_str());
+        }
+        else
+        {
+          fprintf(stream, "%s", this->_defaultValues[i].c_str());
+        }
       }
-      it++;
+      fprintf(stream, ")");
     }
+    if (!this->_description.empty() || this->_parameterCount > 0)
+      fprintf(stream, " -->");
   }
-  return new LoadClassDescription(className);
+  fprintf(stream, "\n");
 }
 
-/**
- *  does the same as addClass(const std::string& className), but with params
- * @param paramName the name of the parameter to add.
- */
-LoadParamDescription* LoadClassDescription::addParam(const std::string& paramName)
-{
-  std::list<LoadParamDescription*>::iterator it = this->paramList.begin();
-  while (it != this->paramList.end())
-  {
-    if ((*it)->paramName == paramName)
-    {
-      return NULL;
-    }
-    it++;
-  }
 
-  LoadParamDescription* newParam = new LoadParamDescription(paramName);
-
-  this->paramList.push_back(newParam);
-  return newParam;
-}
-
-/**
- *  prints out all loadable Classes, and their parameters
- * @param fileName prints the output to a File
- * @todo implement it
- */
-void LoadClassDescription::printAll(const std::string& fileName)
-{
-  PRINT(3)("===============================================================\n");
-  PRINT(3)(" Listing all the Loadable Options (loaded since Game started).\n\n");
-  if (LoadClassDescription::classList != NULL)
-  {
-    std::list<LoadClassDescription*>::iterator classDesc = LoadClassDescription::classList->begin();
-    while (classDesc != LoadClassDescription::classList->end())
-    {
-      PRINT(3)("<%s>\n", (*classDesc)->className.c_str());
-      std::list<LoadParamDescription*>::iterator param = (*classDesc)->paramList.begin();
-      while (param != (*classDesc)->paramList.end())
-      {
-        (*param)->print();
-        param++;
-      }
-      PRINT(3)("</%s>\n\n", (*classDesc)->className.c_str());
-      classDesc++;
-    }
-  }
-  else
-    PRINT(3)("no Classes defined so far\n");
-  PRINT(3)("===============================================================\n");
-}
-
-/**
- * searches for classes, which beginn with classNameBegin
- * @param classNameBegin the beginning string of a Class
- * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards,
- * !! The strings MUST NOT be deleted !!
- */
-std::list<std::string> LoadClassDescription::searchClassWithShort(const std::string& classNameBegin)
-{
-  /// FIXME
-  // NOT USED
-/*  unsigned int searchLength = strlen(classNameBegin);
-  std::list<const std::string&> retVal;
-
-  tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();
-  LoadClassDescription* enumClassDesc = iterator->firstElement();
-  while (enumClassDesc)
-  {
-    if (strlen(enumClassDesc->className)>searchLength+1 &&
-        !strncasecmp(enumClassDesc->className, classNameBegin, searchLength))
-    {
-      retVal->add(enumClassDesc->className);
-    }
-    enumClassDesc = iterator->nextElement();
-  }
-  delete iterator;
-
-  return retVal;*/
-  std::list<std::string> a;
-  return a;
-}
Index: trunk/src/lib/util/loading/load_param_description.h
===================================================================
--- trunk/src/lib/util/loading/load_param_description.h	(revision 9675)
+++ trunk/src/lib/util/loading/load_param_description.h	(revision 9869)
@@ -15,5 +15,5 @@
 
 /*!
- * @file load_param.h
+ * @file load_param_description.h
  * A Class and macro-functions, that makes our lives easy to load-in parameters
  */
@@ -22,6 +22,6 @@
 #define _LOAD_PARAM_DESCRIPTION_H
 
-#include "base_object.h"
-#include <list>
+#include <vector>
+#include <string>
 
 // Forward Declaration //
@@ -34,47 +34,31 @@
 class LoadParamDescription
 {
-  friend class LoadParam;
-  friend class LoadClassDescription;
 public:
-  LoadParamDescription(const std::string& paramName);
-  ~LoadParamDescription();
+  LoadParamDescription(const std::string& paramName = "");
+
+  //! Compares a LoadParamDescription with a String.
+  bool operator==(const std::string& paramName) const { return this->_name == paramName; };
+  //! Compares two LoadParamDescription
+  bool operator==(const LoadParamDescription& paramDescr) const { return this->_name == paramDescr._name; };
+  //! Compares two LoadParamDescription with the less operator
+  bool operator<(const LoadParamDescription& paramDescr) const { return this->_name < paramDescr._name; };
 
   void setDescription(const std::string& descriptionText);
+  void setValues(unsigned int paramCount,
+                 const MultiType* const defaultValues,
+                 bool retVal = false);
+
   /** @returns the descriptionString */
-  const std::string& getDescription() { return this->description; };
+  const std::string& description() { return this->_description; };
 
-  void print() const;
+  void print(FILE* stream = stdout, bool withComments = true) const;
 
 private:
-  std::string   paramName;             //!< The name of the parameter.
-  int           paramCount;            //!< The count of parameters.
-  int*          types;                 //!< What kind of parameters does this function take ??
-  std::string   description;           //!< A longer description about this function.
-  char**        defaultValues;         //!< The 'Default Values'. @TODO MAKE THIS A MULTITYPE
-};
+  std::string                _name;                  //!< The Name of the Parameter.
+  unsigned int               _parameterCount;        //!< The Count of parameters.
+  std::string                _description;           //!< A longer description about this function.
 
-//! A class for descriptions of a loadable module
-class LoadClassDescription
-{
-  friend class CLoadParam;
-public:
-  LoadClassDescription(const std::string& className);
-  ~LoadClassDescription();
-
-  static LoadClassDescription* addClass(const std::string& className);
-  LoadParamDescription* addParam(const std::string& paramName);
-
-  static void deleteAllDescriptions();
-
-  static void printAll(const std::string& fileName = "");
-  static std::list<std::string> searchClassWithShort(const std::string& classNameBegin);
-  //  static const LoadParamDescription* getClass(const std::string& className);
-
-private:
-  static bool                              parametersDescription;  //!< if parameter-description should be enabled.
-  static std::list<LoadClassDescription*>* classList;              //!< a list, that stores all the loadable classes. (after one instance has been loaded)
-  std::string                              className;              //!< name of the class
-
-  std::list<LoadParamDescription*>         paramList;              //!< List of parameters this class knows.
+  std::vector<std::string>   _types;                 //!< A Vector of types of this Parameter.
+  std::vector<std::string>   _defaultValues;         //!< A Vector of defaultValues of this Parameter.
 };
 
Index: trunk/src/lib/util/loading/load_param_xml.h
===================================================================
--- trunk/src/lib/util/loading/load_param_xml.h	(revision 9869)
+++ trunk/src/lib/util/loading/load_param_xml.h	(revision 9869)
@@ -0,0 +1,86 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+/*!
+ * @file load_param_xml.h
+ * A Class and macro-functions, that makes our lives easy to load-in parameters from XML
+ */
+
+#ifndef _LOAD_PARAM_XML_H
+#define _LOAD_PARAM_XML_H
+
+#include "load_param.h"
+#include "executor/executor_xml.h"
+
+/**
+ * @brief Loads a Parameter from ROOT named PARAMETER_NAME
+ * onto OBJECT of CLASS, trough FUNCTION
+ * @param ROOT the TiXmlElement to load the Parameter from
+ * @param PARAMETER_NAME the Name of the Parameter to load
+ * @param OBJECT The BaseObject to load the new setting to.
+ * @param CLASS What Class the BaseObejct is of (this is for identifying the Functuon)
+ * @param FUNCTION The function of Class to Load (if you want to call &CLASS::FUNCTION write FUNCTION here).
+ */
+#define LoadParamXML(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
+         XmlLoadParam<CLASS>(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS, CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), false)
+
+
+/**
+ * @brief Does essentially the same as LoadParamXML, but within a Cycle in an ordered fashion.
+ *
+ * This Function looks in each Element, if the PARAMETER_NAME matches, and loads onto OBJECT
+ * of CLASS the ROOT through FUNCTION
+ *
+ * @see LoadParamXML(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION)
+ */
+#define LoadParamXML_CYCLE(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
+         XmlLoadParam<CLASS>(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS, CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), true)
+
+//! A Class that can load XML tags onto an Object.
+template <class OperateClass = BaseObject> class XmlLoadParam : public LoadParamBase
+{
+public:
+  /**
+   * @brief generates a LoadParam based on
+   * @param root the Root Element to load onto the object.
+   * @param paramName the Parameter name that is loaded.
+   * @param object the Object to apply the changes on.
+   * @param executor the Functional Object, that actually executes the function Call.
+   * @param inLoadCycle If we are inside of a loading cycle. (Loading will be different here)
+   */
+  XmlLoadParam(const TiXmlElement* root, const std::string& paramName, OperateClass* object, Executor<const TiXmlElement*>* executor, bool inLoadCycle = false)
+      : LoadParamBase(root, paramName, inLoadCycle), object(object) , executor(executor)
+  {
+    assert(this->object != NULL);
+    assert(this->executor != NULL);
+  }
+
+  /** @brief executes and destroys the executor */
+  virtual ~XmlLoadParam()
+  {
+    this->setDescriptionValues(OperateClass::staticClassID(), executor->getParamCount(), executor->getDefaultValues(), executor->hasRetVal());
+    (*this->executor)(this->object, this->loadElem);
+    delete this->executor;
+  }
+
+  /** @param descriptionText the description @returns self @brief describes the Loading parameter. */
+  XmlLoadParam& describe(const std::string& descriptionText) { LoadParamBase::describe(OperateClass::staticClassID(), descriptionText); return *this; };
+
+private:
+  OperateClass*                        object;         //!< The Object to apply this to.
+  Executor<const TiXmlElement*>*    executor;       //!< The Executor, that does the actual loading process.
+};
+
+#endif /* _LOAD_PARAM_XML_H */
Index: trunk/src/lib/util/loading/resource.cc
===================================================================
--- trunk/src/lib/util/loading/resource.cc	(revision 9675)
+++ trunk/src/lib/util/loading/resource.cc	(revision 9869)
@@ -14,25 +14,279 @@
 */
 
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOADING
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOAD
 
 #include "resource.h"
-
-
-
-
-/**
- * standard constructor
-*/
-Resource::Resource (const std::string& fileName)
+#include "resource_manager.h"
+
+#include "debug.h"
+
+
+namespace Resources
 {
-//   this->setClassID(CL_RESOURCE, "Resource");
-
+  //! Define an ObjectList for the Resources
+  ObjectListDefinition(Resource);
+
+
+  /**
+   * @brief standard constructor
+   * @param type the Type this resource belongs to.
+   */
+  Resource::Resource (Type* type)
+      : _pointer(NULL), _type(type)
+  {
+    this->registerObject(this, Resource::_objectList);
+  }
+
+  /**
+   * @brief standard deconstructor
+   */
+  Resource::~Resource ()
+  {
+    // delete what has to be deleted here
+  }
+
+  /**
+   * @brief Locates a File inside of the Resources Paths and returns the appended path.
+   *
+   * @param fileName the Name of the file to look for.
+   * @returns the Name of the File prepended with the PAth it is in, if found, empty String ("") otherwise.
+   *
+   * This Function searches in (ordered):
+   * 1. mainGlobalPath (from ResourceManger)
+   * 2. all of the global Paths (from ResourceManger)
+   * 3. all of the Resources Paths (from Resources::Type)
+   *
+   * in each of these directory, first "./" is searched, and afterwards all of the subDirs (from Resources::Type) are searched.
+   *
+   * @todo finish it!!
+   */
+  std::string Resource::locateFile(const std::string& fileName) const
+  {
+    if ((ResourceManager::getInstance()->mainGlobalPath() + File(fileName)).exists() )
+      return (ResourceManager::getInstance()->mainGlobalPath() + File(fileName)).name();
+
+    std::string locatedFile;
+    locatedFile = locateFileInSubDir(ResourceManager::getInstance()->mainGlobalPath(), fileName);
+    if (!locatedFile.empty())
+    {
+      return locatedFile;
+    }
+
+    if (File(fileName).exists())
+      return fileName;
+
+    return (ResourceManager::getInstance()->mainGlobalPath() + File(fileName)).name();
+  }
+
+  /**
+   * @brief tests in all the SubDirectories defined in Resource under Directory if the fileName exists.
+   * @param directory the directory to in what to search for all subdirectories for.
+   * @param fileName the Name of the File to query for
+   * @return true on success.
+   */
+  std::string Resource::locateFileInSubDir(const Directory& directory, const std::string& fileName) const
+  {
+    std::vector<Directory>::const_iterator it;
+    for (it = this->_type->resourceSubPaths().begin(); it != this->_type->resourceSubPaths().end(); ++it)
+    {
+      Directory dir = directory + (*it);
+      File file = dir + File(fileName);
+      if ((dir+ File(fileName)).exists())
+        return (dir+File(fileName)).name();
+    }
+    return "";
+  }
+
+
+  /**
+   * @param loadString the Identifier of the Resource.
+   * @returns a Store-Pointer to the Resource if found, NULL otherwise
+   */
+  StorePointer* Resource::acquireResource(const std::string& loadString)
+  {
+    //const Type* const type = _resourceTypes[this->_type->id()];
+
+    for (unsigned int i = 0; i < _type->storedResources().size(); ++i)
+    {
+      if (_type->storedResources()[i]->loadString() == loadString)
+        return _type->storedResources()[i];
+    }
+
+    return NULL;
+  }
+
+  /**
+   * @brief registers a StorePointer to a Resource's Type.
+   * @param pointer the StorePointer to register.
+   */
+  void Resource::addResource(StorePointer* pointer)
+  {
+    assert(pointer != NULL);
+    this->_type->addResource(pointer);
+  }
+
+
+
+
+
+
+  ///////////////////
+  //// KEEPLEVEL ////
+  ///////////////////
+
+  //! Constructs a default KeepLevel as Set in the ResourceManager via setDefaultKeepLevel.
+  KeepLevel::KeepLevel()
+  {
+    this->_keepLevel = ResourceManager::getInstance()->defaultKeepLevel().keepLevel();
+  }
+  /**
+   * @param keepLevel the level to set.
+   */
+  KeepLevel::KeepLevel(unsigned int keepLevel)
+  {
+    _keepLevel = keepLevel;
+  }
+
+  /**
+   * @brief constructor of a KeepLevel.
+   * @param keepLevelName the Name of the KeepLevel. Must be one Name of the defined Names in the ResourceManager.
+   *
+   * @note the Name is transformed into an Integer for fast interpretation.
+   */
+  KeepLevel::KeepLevel(const std::string& keepLevelName)
+  {
+    this->_keepLevel = ResourceManager::getInstance()->getKeepLevelID(keepLevelName);
+  }
+
+  /**
+   * @returns the name of the KeepLevel.
+   */
+  const std::string& KeepLevel::name() const
+  {
+    return ResourceManager::getInstance()->getKeepLevelName(this->_keepLevel);
+  }
+
+
+
+  ///////////////////////
+  //// STORE POINTER ////
+  ///////////////////////
+  /**
+   * @brief allocates a StorePointer.
+   * @param loadString An identifier String that is unique between all resources of this type.
+   * @param keepLevel the KeepLevel at wich to keep this resource.
+   */
+  StorePointer::StorePointer(const std::string& loadString, const KeepLevel& keeplevel)
+      : _loadString(loadString), _keepLevel(keeplevel)
+  {
+    PRINTF(4)("Acquired a Resource with LoadString '%s' and KeepLevel '%s'\n", _loadString.c_str(), _keepLevel.name().c_str());
+  }
+
+  StorePointer::~StorePointer()
+  {
+    PRINTF(4)("Deleting Stored Resource '%s' from KeepLevel '%s'\n", _loadString.c_str(), _keepLevel.name().c_str());
+  };
+
+
+
+  //////////////
+  //// TYPE ////
+  //////////////
+  /**
+   * @brief allocates a Type.
+   * @param typeName the Name of the Type to be stored in this Container.
+   */
+  Type::Type(const std::string& typeName)
+      : _typeName(typeName)
+  {
+    ResourceManager::getInstance()->registerType(this);
+    PRINTF(4)("Created ResourceType '%s'\n", typeName.c_str());
+  }
+
+  //! Destructs a Type.
+  Type::~Type()
+  {
+    ResourceManager::getInstance()->unregisterType(this);
+  }
+
+  /**
+   * @brief adds a Resource to this Resource's type.
+   * @param resource the Resource to add.
+   */
+  void Type::addResource(StorePointer* resource)
+  {
+    this->_storedResources.push_back(resource);
+  }
+
+  /**
+   * @brief adds a Path to the Type's resource-paths.
+   * @param path the path-name to add.
+   */
+  bool Type::addResourcePath(const std::string& path)
+  {
+    std::vector<Directory>::const_iterator it;
+    for (it = this->_resourcePaths.begin(); it != this->_resourcePaths.end(); ++it)
+      if ((*it) == path)
+        return false;
+    this->_resourcePaths.push_back(path);
+    return true;
+
+  }
+
+  /**
+   * @brief Adds a SubPath to the Type's resource-subpaths.
+   * @param subPath the subpath to add.
+   */
+  bool Type::addResourceSubPath(const std::string& subPath)
+  {
+    std::vector<Directory>::const_iterator it;
+    for (it = this->_resourceSubPaths.begin(); it != this->_resourceSubPaths.end(); ++it)
+      if ((*it) == subPath)
+        return false;
+    this->_resourceSubPaths.push_back(subPath);
+    return true;
+  }
+
+  /**
+   * @brief Unloads all Resources below a certain Level.
+   * @param keepLevel the KeepLevel at what to remove the Resources from.
+   */
+  void Type::unloadAllBelowKeepLevel(const Resources::KeepLevel& keepLevel)
+  {
+    std::vector<Resources::StorePointer*>::iterator it, it2;
+    bool finished = false;
+
+    while (!finished)
+    {
+      finished = true;
+      for (it = this->_storedResources.begin(); it != this->_storedResources.end();++it)
+        if((*it)->keepLevel() < keepLevel && (*it)->last())
+        {
+          delete (*it);
+          this->_storedResources.erase(it);
+          finished = false;
+          break;
+        }
+    }
+  }
+
+  /**
+   * @brief print out some nice Debug information in a beatifully designed style
+   */
+  void Type::debug() const
+  {
+    PRINT(0)(" ResourceType '%s' stores %d Resources\n", this->_typeName.c_str(), this->_storedResources.size());
+    PRINT(0)("  Paths:\n");
+    for (unsigned int i = 0; i < this->_resourcePaths.size(); ++i)
+      PRINT(0)("    %s\n", this->_resourcePaths[i].name().c_str());
+    PRINT(0)("  Sub-Paths:");
+    for (unsigned int i = 0; i < this->_resourceSubPaths.size(); ++i)
+      PRINT(0)(" '%s'", this->_resourceSubPaths[i].name().c_str());
+    PRINT(0)("\n");
+
+    PRINT(0)("  Loaded Resources:\n");
+    std::vector<Resources::StorePointer*>::const_iterator it;
+    for (it = this->_storedResources.begin(); it != this->_storedResources.end(); ++it)
+      PRINT(0)("    '%s' : KeepLevel '%s'\n", (*it)->loadString().c_str(), (*it)->keepLevel().name().c_str());
+  }
 }
-
-/**
- * standard deconstructor
- */
-Resource::~Resource ()
-{
-  // delete what has to be deleted here
-}
Index: trunk/src/lib/util/loading/resource.h
===================================================================
--- trunk/src/lib/util/loading/resource.h	(revision 9675)
+++ trunk/src/lib/util/loading/resource.h	(revision 9869)
@@ -8,51 +8,188 @@
 
 #include "base_object.h"
-#include "multi_type.h"
 #include <string>
+#include <vector>
+#include <set>
 
-// FORWARD DECLARATION
+#include "filesys/directory.h"
+
+//! A Namespace Resources and ResourceHandling is defined in.
+namespace Resources
+{
+  //! The KeepLevel handles the unloading of Resources.
+  /**
+   * Allocating a Resource also appends a KeepLevel to the Resource.
+   * When the Resource is not used anymore it is decided on the grounds of the KeepLevel,
+   * if the Resource should be deleted. (e.g. at the end of a Level, Campaign, or something like this).
+   */
+  class KeepLevel
+  {
+  public:
+    KeepLevel();
+    KeepLevel(unsigned int keepLevel);
+    KeepLevel(const std::string& keepLevelName);
+
+    //! Compare equality
+    inline bool operator==(const KeepLevel& keepLevel) const { return this->_keepLevel == keepLevel._keepLevel; };
+    //! Compares inequality
+    inline bool operator!=(const KeepLevel& keepLevel) const { return this->_keepLevel != keepLevel._keepLevel; };
+    //! Compares less/equal than
+    inline bool operator<=(const KeepLevel& keepLevel) const { return this->_keepLevel <= keepLevel._keepLevel; };
+    //! Compares less than
+    inline bool operator<(const KeepLevel& keepLevel) const { return this->_keepLevel < keepLevel._keepLevel; };
+
+    /** @returns the KeepLevel as a number */
+    inline unsigned int keepLevel() const { return _keepLevel; };
+    const std::string& name() const;
+  private:
+    unsigned int                _keepLevel;              //!< The KeepLevel a Resource is in.
+  };
+
+
+  ///////////////////
+  // STORE POINTER //
+  ///////////////////
+  //! Stores a Resource-Pointer, the LoadString and it's keepLevel.
+  class StorePointer
+  {
+  public:
+    //! Virtual Destructor, that removes the Stored information-pointer.
+    virtual ~StorePointer();
+
+    /** @returns the LoadString this resource was loaded with */
+    const std::string& loadString() const { return _loadString; };
+    /** @returns the KeepLevel of this resource */
+    const Resources::KeepLevel& keepLevel() const { return _keepLevel; };
+
+    virtual bool last() const = 0;
+
+    protected:
+      StorePointer(const std::string& loadString, const Resources::KeepLevel& keeplevel);
+
+    private:
+      StorePointer(const StorePointer&) : _keepLevel(0) {};
+
+  private:
+    std::string                 _loadString;             //!< An identifier, to match when loading a File.
+    Resources::KeepLevel        _keepLevel;              //!< The Priority of this resource. (can only be increased, so none else will delete this)
+  };
 
 
 
-//! An enumerator for different (UN)LOAD-types.
-/**
- * RP_NO:        will be unloaded on request
- * RP_LEVEL:     will be unloaded at the end of a Level
- * RP_CAMPAIGN:  will be unloaded at the end of a Campaign
- * RP_GAME:      will be unloaded at the end of the whole Game (when closing orxonox)
- */
-typedef enum ResourcePriority
-{
-  RP_NO        =   0,
-  RP_LEVEL     =   1,
-  RP_CAMPAIGN  =   2,
-  RP_GAME      =   3
-};
+  ///////////////////
+  // RESOURCE TYPE //
+  ///////////////////
+  //! A Type of Resources.
+  /**
+   * The Type is used to store the Pointers to already loaded Resources,
+   * and also to store type-specific properties.
+   * These are the Loading Paths, the subpaths and so on.
+   */
+  class Type
+  {
+  public:
+    virtual ~Type();
+    /** @returns true if the names match @param typeName the Name to compare. @brief compare the Type with a Name */
+    bool operator==(const std::string& typeName) const { return this->_typeName == typeName; };
+
+    ////////////////////
+    //// EXTENSIONS ////
+    void addExtension(const std::string& extension);
+
+    ///////////////
+    //// PATHS ////
+    bool addResourcePath(const std::string& path);
+    bool addResourceSubPath(const std::string& subPath);
+
+    /// Retrieve Functions
+    /** @returns the name of the stored Class this Type loads Resources for */
+    const std::string& storedClassName() const { return _typeName; };
+    /** @returns the ID of the Type != ClassID */
+    /** @returns the type-specific paths this Resource searches in. */
+    const std::vector<Directory>& resourcePaths() const { return _resourcePaths; };
+    /** @returns the Type specific SubPaths this Resource Searches in @see std::vector<std::string>  _resourceSubPaths */
+    const std::vector<Directory>& resourceSubPaths() const { return _resourceSubPaths; };
+    /** @returns the Pointers to the Stored resources. @note do not use this, for more than some lookup */
+    const std::vector<Resources::StorePointer*>& storedResources() const { return _storedResources; };
+
+    ///////////////////////////////
+    //// LOADING AND UNLOADING ////
+    virtual void createFromString(const std::string& loadString, const KeepLevel& keepLevel = KeepLevel()) = 0;
+    void unloadAllBelowKeepLevel(const Resources::KeepLevel& keepLevel);
+
+    ///////////////////
+    //// INTERNALS ////
+    void addResource(Resources::StorePointer* resource);
+
+    ///////////////
+    //// DEBUG ////
+    void debug() const;
+
+  protected:
+    Type(const std::string& typeName);
+
+  private:
+    Type(const Type& type) {};
+  private:
+    const std::string                     _typeName;          //!< Name of the Type. (Name of the Resource this loads.)
+    std::vector<Directory>                _resourcePaths;     //!< The Paths to search for files in this type
+    std::vector<Directory>                _resourceSubPaths;  //!< The subpaths that will be searched under all the _resourcePaths.
+    std::vector<std::string>              _fileExtensions;    //!< File Extensions, this Resource supports.
+
+    std::vector<Resources::StorePointer*> _storedResources;   //!< An array of all the stored Resources.
+  };
+
+  /**
+   * @brief A Type Definition Class for any Object that is resourceable.
+   *
+   * This Class's main reason of Existence is, that resources can be dynamically
+   * created over a loadString. For this the Type of Resource is required, and the Resource must
+   * itself support the 'void createFromString(const std::string&)' function.
+   */
+  template<class T> class tType : public Type
+  {
+  public:
+    /** Create the ResourceType @see Type(const std::string&) */
+    tType(const std::string& typeName) : Type(typeName) {};
+    /** @param loadString the String to load a Resource with @brief tries to create a Resource of Type T with a loadString */
+    virtual void createFromString(const std::string& loadString, const KeepLevel& keepLevel = KeepLevel()) { T::createFromString(loadString, keepLevel); }
+  };
 
 
 
-//! A Resource is an Object, that can be loaded from Disk
-/**
- *
- */
-class Resource : virtual public BaseObject {
+  /////////////////////
+  // RESOURCE ITSELF //
+  /////////////////////
+  //! A Resource is an Object, that can be loaded from Disk
+  /**
+   * The Resource Hanldes the location and stores pointers to data that can be retrieved.
+   */
+  class Resource : virtual public BaseObject
+  {
+    ObjectListDeclaration(Resource);
 
- public:
-   Resource(const std::string& fileName);
-  virtual ~Resource();
+  public:
+    Resource(Resources::Type* type);
+    virtual ~Resource();
 
-  virtual bool load(std::string& fileName, const MultiType& param1, const MultiType& param2);
-  virtual bool reload();
-  virtual bool unload();
+    /** @brief reloads the underlying resource */
+    virtual bool reload() { return false; };
+    /** @brief unloads the underlying Resource */
+    virtual bool unload() { return false; };
 
- private:
-   std::string       fileName;
+    std::string locateFile(const std::string& fileName) const;
 
-   unsigned int      referenceCount;    //!< How many times this Resource has been loaded.
-/// TODO REMOVE THIS:   ResourceType      type;              //!< ResourceType of this Resource.
-   ResourcePriority  prio;              //!< The Priority of this resource. (can only be increased, so noone else will delete this)
+  protected:
+    Resources::StorePointer* acquireResource(const std::string& loadString);
+    void addResource(Resources::StorePointer* pointer);
 
-   MultiType         param[3];          //!< The Parameters given to this Resource.
-};
+  private:
+    std::string locateFileInSubDir(const Directory& directory, const std::string& fileName) const;
+
+  private:
+    Resources::StorePointer*       _pointer;                         //!< Virtual Pointer to the ResourceData.
+    Resources::Type*               _type;                            //!< Type of the Resource.
+  };
+}
 
 #endif /* _RESOURCE_H */
Index: trunk/src/lib/util/loading/resource_manager.cc
===================================================================
--- trunk/src/lib/util/loading/resource_manager.cc	(revision 9675)
+++ trunk/src/lib/util/loading/resource_manager.cc	(revision 9869)
@@ -16,903 +16,241 @@
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOAD
 
-#include "util/loading/resource_manager.h"
-#include "substring.h"
+#include "resource_manager.h"
 #include "debug.h"
 
 #include <algorithm>
-#include <assert.h>
-
-// different resource Types
-#ifndef NO_MODEL
-#include "objModel.h"
-#include "primitive_model.h"
-#include "md2/md2Model.h"
-#include "md3/md3_data.h"
-#include "md3/md3_animation_cfg.h"
-#endif /* NO_MODEL */
-#ifndef NO_TEXTURES
-#include "texture.h"
-#endif /* NO_TEXTURES */
-#ifndef NO_TEXT
-#include "font.h"
-#endif /* NO_TEXT */
-#ifndef NO_AUDIO
-#include "sound_buffer.h"
-#include "ogg_player.h"
-#endif /* NO_AUDIO */
-#ifndef NO_SHADERS
-#include "shader.h"
-#endif /* NO_SHADERS */
-
-// File Handling Includes
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-
-
-/**
- * @brief standard constructor
-*/
-ResourceManager::ResourceManager ()
+#include <cassert>
+
+
+namespace Resources
 {
-  this->setClassID(CL_RESOURCE_MANAGER, "ResourceManager");
-  this->setName("ResourceManager");
-
-  this->dataDir = "./";
-  this->tryDataDir("./data");
+  /// Definition of the ResourceManager's ObjectList.
+  ObjectListDefinition(ResourceManager);
+  //! Singleton Reference to the ResourceManager
+  ResourceManager* ResourceManager::_singletonRef = NULL;
+
+
+  /**
+   * @brief standard constructor
+  */
+  ResourceManager::ResourceManager ()
+  : _defaultKeepLevel(0)
+  {
+    this->registerObject(this, ResourceManager::_objectList);
+    this->setName("ResourceManager");
+    this->_mainGlobalPath = Directory("./");
+  }
+
+
+  /**
+   * @brief standard destructor
+  */
+  ResourceManager::~ResourceManager ()
+  {
+    this->unloadAllBelowKeepLevel(this->_keepLevelNames.size());
+    ResourceManager::_singletonRef = NULL;
+  }
+
+  /**
+   * @brief Registers a new Type to the ResourceManager.
+   * @param type the Type to register.
+   */
+  void ResourceManager::registerType(Resources::Type* type)
+  {
+    this->_resourceTypes.push_back(type);
+    PRINTF(5)("ResourceType '%s' added\n", type->storedClassName().c_str());
+  }
+
+  /**
+   * @brief Unregisters a new Type to the ResourceManager.
+   * @param type the Type to unregister.
+   */
+  void ResourceManager::unregisterType(Resources::Type* type)
+  {
+    std::vector<Resources::Type*>::iterator it = std::find (this->_resourceTypes.begin(), this->_resourceTypes.end(), type);
+    if (it != this->_resourceTypes.end())
+    {
+      this->_resourceTypes.erase(it);
+      PRINTF(5)("ResourceType '%s' removed\n", type->storedClassName().c_str());
+    }
+  }
+
+  /**
+   * @brief Sets the main Global path (the main path Resources are searched for)
+   * @param directory the directory to set.
+   * @see Resource::locateFile
+   */
+  void ResourceManager::setMainGlobalPath(const Directory& directory)
+  {
+    this->_mainGlobalPath = directory;
+    this->_mainGlobalPath.open();
+  }
+
+  /**
+   * @brief add a Global search path. (global paths besided the main path.)
+   * @param directory a directory to add.
+   */
+  void ResourceManager::addGlobalPath(const Directory& directory)
+  {
+    std::vector<Directory>::const_iterator it = std::find(this->_globalPaths.begin(), this->_globalPaths.end(), directory);
+    if (it == this->_globalPaths.end())
+      this->_globalPaths.push_back(directory);
+  }
+
+  /**
+   * @brief add a ResourcePath to a Type's Paths.
+   * @param resourceName the Type's name of Resource to add the path to.
+   * @param pathName pathName the Name of the path to add.
+   * @return true on success. (if a path was added (no duplicate, and resourceName existed).
+   */
+  bool ResourceManager::addResourcePath(const std::string& resourceName, const std::string& pathName)
+  {
+    std::vector<Resources::Type*>::iterator it;
+    for (it = this->_resourceTypes.begin(); it != this->_resourceTypes.end(); ++it)
+      if (*(*it) == resourceName)
+        return (*it)->addResourcePath(pathName);
+    PRINTF(2)("ResourcePath %s could not be added to the ResourceType %s\n", pathName.c_str(), resourceName.c_str());
+    return false;
+  }
+
+  /**
+   * @brief add a ResourcePath to a Type's SubPaths.
+   * @param resourceName the Type's name of Resource to add the subpath to.
+   * @param pathName pathName the Name of the path to add.
+   * @return true on success. (if a path was added (no duplicate, and resourceName existed).
+   */
+  bool ResourceManager::addResourceSubPath(const std::string& resourceName, const std::string& pathName)
+  {
+    std::vector<Resources::Type*>::iterator it;
+    for (it = this->_resourceTypes.begin(); it != this->_resourceTypes.end(); ++it)
+      if (*(*it) == resourceName)
+        return (*it)->addResourceSubPath(pathName);
+    PRINTF(2)("ResourceSubPath %s could not be added to the ResourceType %s\n", pathName.c_str(), resourceName.c_str());
+    return false;
+  }
+
+  /**
+   * @brief checks wether a File is inside of the MainPath.
+   * @param fileInside the file to check
+   * @return true if the file is inside.
+   */
+  bool ResourceManager::checkFileInMainPath(const File& fileInside)
+  {
+    return (this->_mainGlobalPath + fileInside).exists();
+  }
+
+  /**
+   * @brief prepends the fileName by the MainGlobalPath (same as mainGlobalPath + '/' + fileName).
+   * @param fileName The FileName to prepend
+   * @returns the prepended file-name
+   */
+  std::string ResourceManager::prependAbsoluteMainPath(const std::string& fileName)
+  {
+    return (this->_mainGlobalPath + File(fileName)).name();
+  }
+
+  /**
+   * @brief add a KeepLevelName (this function just counts upwards).
+   * @param keepLevelName the Name of the KeepLevel to set.
+   * @returns the Level the Name was set to.
+   */
+  unsigned int ResourceManager::addKeepLevelName(const std::string& keepLevelName)
+  {
+    this->_keepLevelNames.push_back(keepLevelName);
+    return _keepLevelNames.size()-1;
+  }
+
+  /**
+   * @param keepLevelName the Name of the KeepLevel.
+   * @returns the ID of the KeepLevel named keepLevelName
+   */
+  unsigned int ResourceManager::getKeepLevelID(const std::string& keepLevelName) const
+  {
+    for (unsigned int i = 0; i < this->_keepLevelNames.size(); ++i)
+      if (this->_keepLevelNames[i] == keepLevelName)
+        return i;
+
+    PRINTF(2)("KeepLevel '%s' not found. Using 0 instead\n", keepLevelName.c_str());
+    return 0;
+  }
+
+  /**
+   * @param keepLevelID the ID to check.
+   * @return the name of the KeepLevel.
+   */
+  const std::string& ResourceManager::getKeepLevelName(unsigned int keepLevelID) const
+  {
+    assert(keepLevelID < this->_keepLevelNames.size());
+    return this->_keepLevelNames[keepLevelID];
+  }
+
+
+  /**
+   * @brief loads a Resource from a TypeName and a loadString.
+   * @param resourceTypeName The Name of the Type to what to load a Resource from.
+   * @param loadString the loadString to load in the Type.
+   */
+  void ResourceManager::loadFromLoadString(const std::string& resourceTypeName, const std::string& loadString, const KeepLevel& keepLevel)
+  {
+    std::vector<Resources::Type*>::const_iterator it;
+    for (it = this->_resourceTypes.begin(); it != this->_resourceTypes.end(); ++it)
+    {
+      if (*(*it) == resourceTypeName)
+      {
+	(*it)->createFromString(loadString, keepLevel);
+	/// TODO check if the resource was allocated!!
+	return ;
+      }
+    }
+    return ;
+  }
+
+  /**
+   * @brief unloads all Resources below a certain threshhold.
+   * @param keepLevel the KeepLevel below which to erase.
+   *
+   * @not Resources will only be erased, if th keepLevel is below, and the resources are not
+   * referenced anymore.
+   */
+  void ResourceManager::unloadAllBelowKeepLevel(const Resources::KeepLevel& keepLevel)
+  {
+    std::vector<Resources::Type*>::const_iterator it;
+    for (it = this->_resourceTypes.begin(); it != this->_resourceTypes.end(); ++it)
+    {
+      (*it)->unloadAllBelowKeepLevel(keepLevel);
+    }
+  }
+
+
+  /**
+   * @brief outputs debug information about the ResourceManager
+   */
+  void ResourceManager::debug() const
+  {
+    PRINT(0)("/==RM================================\\\n");
+    PRINT(0)("| RESOURCE-MANAGER DEBUG INFORMATION |\n");
+    PRINT(0)("\\====================================/\n");
+    PRINT(0)(" MainGlobal search path is %s\n", this->_mainGlobalPath.name().c_str());
+    if(!this->_globalPaths.empty())
+    {
+      PRINT(0)(" Additional Global search Paths are: ");
+      for (unsigned int i = 0; i < this->_globalPaths.size(); ++i)
+        PRINT(0)("'%s' ", this->_globalPaths[i].name().c_str());
+      PRINT(0)("\n");
+    }
+    PRINT(0)(" Listing %d Types: \n", this->_resourceTypes.size());
+    std::vector<Resources::Type*>::const_iterator it;
+    for (it = this->_resourceTypes.begin(); it != this->_resourceTypes.end(); ++it)
+    {
+      (*it)->debug();
+      if (it != --this->_resourceTypes.end())
+        PRINT(0)(" ------------------------------------\n ");
+    }
+
+    PRINT(0)("KeepLevels are: ");
+    for (unsigned int i = 0; i < this->_keepLevelNames.size(); ++i)
+      PRINT(0)("%d:'%s'  ", i, this->_keepLevelNames[i].c_str());
+    PRINT(0)("\n");
+    PRINT(0)("=================================RM==/\n");
+  }
 }
-
-//! Singleton Reference to the ResourceManager
-ResourceManager* ResourceManager::singletonRef = NULL;
-
-/**
- * @brief standard destructor
-*/
-ResourceManager::~ResourceManager ()
-{
-  // deleting the Resources-List
-  this->unloadAllByPriority(RP_GAME);
-
-  if (!this->resourceList.empty())
-    PRINTF(1)("Not removed all Resources, since there are still %d resources registered\n", this->resourceList.size());
-
-  ResourceManager::singletonRef = NULL;
-}
-
-/**
- * @brief sets the data main directory
- * @param dataDir the DataDirectory.
- */
-bool ResourceManager::setDataDir(const std::string& dataDir)
-{
-  File dataDirectory(dataDir);
-  if (dataDirectory.isDirectory())
-  {
-    this->dataDir = dataDirectory.name();
-
-    if (dataDir[dataDir.size()-1] != '/' && dataDir[dataDir.size()-1] != '\\')
-    {
-      this->dataDir += '/';
-    }
-    return true;
-  }
-  else
-  {
-    PRINTF(1)("%s is not a Directory, and can not be the Data Directory, leaving as %s \n", dataDir.c_str(), this->dataDir.c_str());
-    return false;
-  }
-}
-
-/**
- * @brief sets the data main directory
- * @param dataDir the DataDirectory.
- *
- * this is essentially the same as setDataDir, but it ommits the error-message
- */
-bool ResourceManager::tryDataDir(const std::string& dataDir)
-{
-  File dataDirectory(dataDir);
-  if (dataDirectory.isDirectory())
-  {
-    this->dataDir = dataDirectory.name();
-
-    if (dataDir[dataDir.size()-1] != '/' && dataDir[dataDir.size()-1] != '\\')
-    {
-      this->dataDir += '/';
-    }
-    return true;
-  }
-  return false;
-}
-
-
-/**
- * @brief checks for the DataDirectory, by looking if
- * @param fileInside is iniside of the given directory.
-*/
-bool ResourceManager::verifyDataDir(const std::string& fileInside)
-{
-  File dataDirectory(this->dataDir);
-  if (!dataDirectory.isDirectory())
-  {
-    PRINTF(1)("'%s' is not a directory\n", this->dataDir.c_str());
-    return false;
-  }
-
-  File testFile(this->dataDir + fileInside);
-  return testFile.isFile();
-}
-
-#ifndef NO_TEXTURES
-/**
- * @brief adds a new Path for Images
- * @param imageDir The path to insert
- * @returns true, if the Path was well and injected (or already existent within the list)
-   false otherwise
-*/
-bool ResourceManager::addImageDir(const std::string& imageDir)
-{
-  std::string newDir = imageDir;
-  if (imageDir[imageDir.size()-1] != '/' && imageDir[imageDir.size()-1] != '\\')
-  {
-    newDir += '/';
-  }
-  // check if the param is a Directory
-  if (File(newDir).isDirectory())
-  {
-    // check if the Directory has been added before
-    std::vector<std::string>::const_iterator imageDir;
-    for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++)
-    {
-      if (*imageDir == newDir)
-      {
-        PRINTF(3)("Path %s already loaded\n", newDir.c_str());
-        return true;
-      }
-    }
-    // adding the directory to the List
-    this->imageDirs.push_back(newDir);
-    return true;
-  }
-  else
-  {
-    PRINTF(1)("%s is not a Directory, and can not be added to the Paths of Images\n", newDir.c_str());
-    return false;
-  }
-}
-#endif /* NO_TEXTURES */
-
-/**
- * @brief loads resources
- * @param fileName: The fileName of the resource to load
- * @param prio: The ResourcePriority of this resource (will only be increased)
- * @param param0: an additional option to parse (see the constuctors for more help)
- * @param param1: an additional option to parse (see the constuctors for more help)
- * @param param2: an additional option to parse (see the constuctors for more help)
- * @returns a pointer to a desired Resource.
-*/
-BaseObject* ResourceManager::load(const std::string& fileName, ResourcePriority prio,
-                                  const MultiType& param0, const MultiType& param1, const MultiType& param2)
-{
-  ResourceType tmpType;
-#ifndef NO_MODEL
-#define __IF_OK
-  if (!strncasecmp(fileName.c_str()+(fileName.size()-4), ".obj", 4))
-    tmpType = OBJ;
-  else if (!strncmp(fileName.c_str()+(fileName.size()-4), ".md2", 4))
-    tmpType = MD2;
-  else if (!strncmp(fileName.c_str()+(fileName.size()-4), ".md3", 4))
-    tmpType = MD3;
-  else if (!strncmp(fileName.c_str()+(fileName.size()-4), ".cfg", 4))
-    tmpType = MD3_CONFIG;
-  else if (!strcasecmp(fileName.c_str(), "cube") ||
-            !strcasecmp(fileName.c_str(), "sphere") ||
-            !strcasecmp(fileName.c_str(), "plane") ||
-            !strcasecmp(fileName.c_str(), "cylinder") ||
-            !strcasecmp(fileName.c_str(), "cone"))
-    tmpType = PRIM;
-#endif /* NO_MODEL */
-#ifndef NO_AUDIO
-#ifdef __IF_OK
-  else
-#endif
-#define __IF_OK
-    if (!strncasecmp(fileName.c_str()+(fileName.size()-4), ".wav", 4))
-      tmpType = WAV;
-    else if (!strncasecmp(fileName.c_str()+(fileName.size()-4), ".mp3", 4))
-      tmpType = MP3;
-    else if (!strncasecmp(fileName.c_str()+(fileName.size()-4), ".ogg", 4))
-      tmpType = OGG;
-#endif /* NO_AUDIO */
-#ifndef NO_TEXT
-#ifdef __IF_OK
-    else
-#endif
-#define __IF_OK
-      if (!strncasecmp(fileName.c_str()+(fileName.size()-4), ".ttf", 4))
-        tmpType = TTF;
-#endif /* NO_TEXT */
-#ifndef NO_SHADERS
-#ifdef __IF_OK
-      else
-#endif
-#define __IF_OK
-        if (!strncasecmp(fileName.c_str()+(fileName.size()-5), ".vert", 5))
-          tmpType = SHADER;
-#endif /* NO_SHADERS */
-#ifndef NO_TEXTURES
-#ifdef __IF_OK
-        else
-#else
-  if
-#endif
-          tmpType = IMAGE;
-#endif /* NO_TEXTURES */
-#undef __IF_OK
-  return this->load(fileName, tmpType, prio, param0, param1, param2);
-}
-
-/**
- * @brief caches a Resource
- *
- * @see load;
- *
- * @brief returns true if ok, false otherwise.
- * This function loads a Resource without applying it to an Object.
- * This is for loading purposes, e.g, when the user is loading a Resource
- * during the initialisation instead of at Runtime.
- */
-bool ResourceManager::cache(const std::string& fileName, ResourceType type, ResourcePriority prio,
-                            const MultiType& param0, const MultiType& param1, const MultiType& param2)
-{
-  // searching if the resource was loaded before.
-  Resource* tmpResource;
-  // check if we already loaded this Resource
-  tmpResource = this->locateResourceByInfo(fileName, type, param0, param1, param2);
-  // otherwise load it
-  if (tmpResource == NULL)
-    tmpResource = this->loadResource(fileName, type, prio, param0, param1, param2);
-  // return cached pointer.
-  if (tmpResource != NULL) // if the resource was loaded before.
-  {
-    if(tmpResource->prio < prio)
-      tmpResource->prio = prio;
-    return true;
-  }
-  else
-    return false;
-}
-
-/**
- * tells the ResourceManager to generate a Copy of the Resource.
- * @brief resourcePointer: The Pointer to the resource to copy
- * @returns the Resource pointed to resourcePointer.
- */
-BaseObject* ResourceManager::copy(BaseObject* resourcePointer)
-{
-  Resource* tmp = locateResourceByPointer(resourcePointer);
-  if (tmp!=NULL)
-  {
-    tmp->count++;
-    return tmp->pointer;
-  }
-  else
-    return NULL;
-}
-
-
-/**
- * @brief loads resources
- * @param fileName: The fileName of the resource to load
- * @param type: The Type of Resource to load.
- * @param prio: The ResourcePriority of this resource (will only be increased)
- * @param param0: an additional option to parse (see the constuctors for more help)
- * @param param1: an additional option to parse (see the constuctors for more help)
- * @param param2: an additional option to parse (see the constuctors for more help)
- * @returns a pointer to a desired Resource.
-*/
-BaseObject* ResourceManager::load(const std::string& fileName, ResourceType type, ResourcePriority prio,
-                                  const MultiType& param0, const MultiType& param1, const MultiType& param2)
-{
-
-  // searching if the resource was loaded before.
-  Resource* tmpResource;
-  // check if we already loaded this Resource
-  tmpResource = this->locateResourceByInfo(fileName, type, param0, param1, param2);
-  // otherwise load it
-  if (tmpResource == NULL)
-  {
-    tmpResource = this->loadResource(fileName, type, prio, param0, param1, param2);
-  }
-  // return cached pointer.
-  if (tmpResource != NULL) // if the resource was loaded before.
-  {
-    tmpResource->count++;
-    if(tmpResource->prio < prio)
-      tmpResource->prio = prio;
-
-    return tmpResource->pointer;
-  }
-  else
-    return NULL;
-}
-
-
-/**
- * @brief loads resources for internal purposes
- * @param fileName: The fileName of the resource to load
- * @param type: The Type of Resource to load.
- * @param prio: The ResourcePriority of this resource (will only be increased)
- * @param param0: an additional option to parse (see the constuctors for more help)
- * @param param1: an additional option to parse (see the constuctors for more help)
- * @param param2: an additional option to parse (see the constuctors for more help)
- * @returns a pointer to a desired Resource.
- */
-Resource* ResourceManager::loadResource(const std::string& fileName, ResourceType type, ResourcePriority prio,
-                                        const MultiType& param0, const MultiType& param1, const MultiType& param2)
-{
-  // Setting up the new Resource
-  Resource* tmpResource = new Resource;
-  tmpResource->count = 0;
-  tmpResource->type = type;
-  tmpResource->prio = prio;
-  tmpResource->pointer = NULL;
-  tmpResource->name = fileName;
-
-  // creating the full name. (directoryName + FileName)
-  std::string fullName = ResourceManager::getFullName(fileName);
-  // Checking for the type of resource \see ResourceType
-  switch(type)
-  {
-#ifndef NO_MODEL
-    case OBJ:
-      if (param0.getType() != MT_NULL)
-        tmpResource->param[0] = param0;
-      else
-        tmpResource->param[0] = 1.0f;
-
-      if(File(fullName).isFile())
-        tmpResource->pointer = new OBJModel(fullName, tmpResource->param[0].getFloat());
-      else
-      {
-        PRINTF(2)("File %s in %s does not exist. Loading a cube-Model instead\n", fileName.c_str(), dataDir.c_str());
-        tmpResource->pointer = ResourceManager::load("cube", PRIM, prio, tmpResource->param[0].getFloat());
-      }
-      break;
-    case PRIM:
-      if (param0 != MT_NULL)
-        tmpResource->param[0] = param0;
-      else
-        tmpResource->param[0] = 1.0f;
-
-      if (tmpResource->name == "cube")
-        tmpResource->pointer = new PrimitiveModel(PRIM_CUBE, tmpResource->param[0].getFloat());
-      else if (tmpResource->name == "sphere")
-        tmpResource->pointer = new PrimitiveModel(PRIM_SPHERE, tmpResource->param[0].getFloat());
-      else if (tmpResource->name == "plane")
-        tmpResource->pointer = new PrimitiveModel(PRIM_PLANE, tmpResource->param[0].getFloat());
-      else if (tmpResource->name == "cylinder")
-        tmpResource->pointer = new PrimitiveModel(PRIM_CYLINDER, tmpResource->param[0].getFloat());
-      else if (tmpResource->name == "cone")
-        tmpResource->pointer = new PrimitiveModel(PRIM_CONE, tmpResource->param[0].getFloat());
-      break;
-    case MD2:
-      if(File(fullName).isFile())
-      {
-        tmpResource->param[0] = param0;
-        tmpResource->param[1] = param1;
-        tmpResource->pointer = new MD2Data(fullName, tmpResource->param[0].getCString(), tmpResource->param[1].getFloat());
-      }
-      break;
-    case MD3:
-      if(File(fullName).isFile())
-      {
-        tmpResource->param[0] = param0;
-        tmpResource->param[1] = param1;
-        tmpResource->pointer = new md3::MD3Data(fullName, tmpResource->param[0].getCString(), tmpResource->param[1].getFloat());
-      }
-      break;
-    case MD3_CONFIG:
-      if(File(fullName).isFile())
-      {
-        tmpResource->param[0] = param0;
-        tmpResource->param[1] = param1;
-        tmpResource->pointer = new md3::MD3AnimationCfg(fullName);
-      }
-      break;
-#endif /* NO_MODEL */
-#ifndef NO_TEXT
-    case TTF:
-      if (param0 != MT_NULL)
-      {
-        assert(param0.getInt() >= 0);
-        tmpResource->param[0] = param0;
-      }
-      else
-        tmpResource->param[0] = FONT_DEFAULT_RENDER_SIZE;
-
-      if(File(fullName).isFile())
-        tmpResource->pointer = new Font(fullName, (unsigned int) tmpResource->param[0].getInt());
-      else
-        PRINTF(2)("%s does not exist in %s. Not loading Font\n", fileName.c_str(), this->dataDir.c_str());
-      break;
-#endif /* NO_TEXT */
-#ifndef NO_AUDIO
-    case WAV:
-      if(File(fullName).isFile())
-        tmpResource->pointer = new OrxSound::SoundBuffer(fullName);
-      break;
-    case OGG:
-      if (File(fullName).isFile())
-        tmpResource->pointer = new OrxSound::OggPlayer(fullName);
-      break;
-#endif /* NO_AUDIO */
-#ifndef NO_TEXTURES
-    case IMAGE:
-      if (param0 != MT_NULL)
-        tmpResource->param[0] = param0;
-      else
-        tmpResource->param[0] = GL_TEXTURE_2D;
-      if(File(fullName).isFile())
-      {
-        PRINTF(4)("Image %s resides to %s\n", fileName.c_str(), fullName.c_str());
-        tmpResource->pointer = new Texture(fullName, tmpResource->param[0].getInt());
-      }
-      else
-      {
-        std::vector<std::string>::iterator imageDir;
-        for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++)
-        {
-          std::string imgName = *imageDir + fileName;
-          if(File(imgName).isFile())
-          {
-            PRINTF(4)("Image %s resides to %s\n", fileName.c_str(), imgName.c_str());
-            tmpResource->pointer = new Texture(imgName, tmpResource->param[0].getInt());
-            break;
-          }
-        }
-      }
-      if(!tmpResource)
-        PRINTF(2)("!!Image %s not Found!!\n", fileName.c_str());
-      break;
-#endif /* NO_TEXTURES */
-#ifndef NO_SHADERS
-    case SHADER:
-      if(File(fullName).isFile())
-      {
-        if (param0 != MT_NULL)
-        {
-          MultiType param = param0; /// HACK
-          std::string secFullName = ResourceManager::getFullName(param.getCString());
-          if (File(secFullName).isFile())
-          {
-            tmpResource->param[0] = secFullName;
-            tmpResource->pointer = new Shader(fullName, secFullName);
-          }
-        }
-        else
-        {
-          tmpResource->param[0] = param0;
-          tmpResource->pointer = new Shader(fullName, "");
-        }
-      }
-      break;
-#endif /* NO_SHADERS */
-    default:
-      tmpResource->pointer = NULL;
-      PRINTF(1)("No type found for %s.\n   !!This should not happen unless the Type is not supported yet. JUST DO IT!!\n", tmpResource->name.c_str());
-      break;
-  }
-  if (tmpResource->pointer != NULL)
-    this->resourceList.push_back(tmpResource);
-
-  if (tmpResource->pointer != NULL)
-    return tmpResource;
-  else
-  {
-    PRINTF(2)("Resource %s could not be loaded\n", fileName.c_str());
-    delete tmpResource;
-    return NULL;
-  }
-}
-
-/**
- * @brief unloads a Resource
- * @param pointer: The pointer to free
- * @param prio: the PriorityLevel to unload this resource
- * @returns true if successful (pointer found, and deleted), false otherwise
-*/
-bool ResourceManager::unload(BaseObject* pointer, ResourcePriority prio)
-{
-  if (pointer == NULL)
-    return false;
-  // if pointer is existent. and only one resource of this type exists.
-  Resource* tmpResource = this->locateResourceByPointer(pointer);
-  if (tmpResource != NULL)
-    return unload(tmpResource, prio);
-  else
-  {
-    PRINTF(2)("Resource not Found %p\n", pointer);
-    return false;
-  }
-}
-
-/**
- * @brief unloads a Resource
- * @param resource: The resource to unloade
- * @param prio the PriorityLevel to unload this resource
- * @returns true on success, false otherwise.
-*/
-bool ResourceManager::unload(Resource* resource, ResourcePriority prio)
-{
-  if (resource == NULL)
-    return false;
-  if (resource->count > 0)
-    resource->count--;
-
-  if (resource->prio <= prio)
-  {
-    if (resource->count == 0)
-    {
-      delete resource->pointer;
-      // deleting the List Entry:
-      PRINTF(4)("Resource %s safely removed.\n", resource->name.c_str());
-      std::vector<Resource*>::iterator resourceIT = std::find(this->resourceList.begin(), this->resourceList.end(), resource);
-      this->resourceList.erase(resourceIT);
-      delete resource;
-    }
-    else
-      PRINTF(4)("Resource %s not removed, because there are still %d References to it.\n", resource->name.c_str(), resource->count);
-  }
-  else
-    PRINTF(4)("not deleting resource %s because DeleteLevel to high\n", resource->name.c_str());
-  return true;
-}
-
-
-/**
- * @brief unloads all alocated Memory of Resources with a pririty lower than prio
- * @param prio The priority to delete
-*/
-bool ResourceManager::unloadAllByPriority(ResourcePriority prio)
-{
-  bool removedAll = true;
-  unsigned int removeCount;
-  for (unsigned int round = 0; round < 3; round++)
-  {
-    int index = this->resourceList.size() - 1;
-    removeCount = 0;
-    while (index >= 0)
-    {
-      if (this->resourceList[index]->prio <= prio)
-      {
-        if (this->resourceList[index]->count == 0)
-          unload(this->resourceList[index], prio);
-        else
-        {
-          if (round == 3)
-          {
-            PRINTF(2)("unable to unload %s because there are still %d references to it\n",
-                      this->resourceList[index]->name.c_str(), this->resourceList[index]->count);
-            removedAll = false;
-          }
-          removeCount++;
-        }
-      }
-      index--;
-    }
-    if (removeCount == 0) break;
-  }
-  return removedAll;
-}
-
-
-/**
- * @brief Searches for a Resource by some information
- * @param fileName: The name to look for
- * @param type the Type of resource to locate.
- * @param param0: an additional option to parse (see the constuctors for more help)
- * @param param1: an additional option to parse (see the constuctors for more help)
- * @param param2: an additional option to parse (see the constuctors for more help)
- * @returns a Pointer to the Resource if found, NULL otherwise.
-*/
-Resource* ResourceManager::locateResourceByInfo(const std::string& fileName, ResourceType type,
-    const MultiType& param0, const MultiType& param1, const MultiType& param2) const
-{
-  std::vector<Resource*>::const_iterator resource;
-  for (resource = this->resourceList.begin(); resource != this->resourceList.end(); resource++)
-  {
-    if ((*resource)->type == type && fileName == (*resource)->name)
-    {
-      bool match = false;
-      switch (type)
-      {
-#ifndef NO_MODEL
-        case PRIM:
-        case OBJ:
-          if (param0 == MT_NULL)
-          {
-            if ((*resource)->param[0] == 1.0f)
-              match = true;
-          }
-          else if ((*resource)->param[0] == param0.getFloat())
-            match = true;
-          break;
-        case MD2:
-          if (param0 == MT_NULL && ((*resource)->param[0] == "") && param1 == MT_NULL && ((*resource)->param[0] == 1.0f))
-              match = true;
-          else if ((*resource)->param[0] == ((MultiType)param0).getString() && (*resource)->param[1] == ((MultiType)param1).getFloat())
-            match = true;
-          break;
-        case MD3:
-          if (param0 == MT_NULL && ((*resource)->param[0] == "") && param1 == MT_NULL && ((*resource)->param[0] == 1.0f))
-            match = true;
-          else if ((*resource)->param[0] == ((MultiType)param0).getString() && (*resource)->param[1] == ((MultiType)param1).getFloat())
-            match = true;
-          break;
-        case MD3_CONFIG:
-          if (param0 == MT_NULL && ((*resource)->param[0] == ""))
-            match = true;
-          else if ((*resource)->param[0] == ((MultiType)param0).getString())
-            match = true;
-          break;
-
-#endif /* NO_MODEL */
-#ifndef NO_TEXT
-        case TTF:
-          if (param0 == MT_NULL)
-          {
-            if ((*resource)->param[0] == FONT_DEFAULT_RENDER_SIZE)
-              match = true;
-          }
-          else if ((*resource)->param[0] == param0.getInt())
-            match = true;
-          break;
-#endif /* NO_TEXT */
-#ifndef NO_SHADERS
-        case SHADER:
-          if (param0 == MT_NULL)
-          {
-            if ((*resource)->param[0] == "")
-              match = true;
-          }
-          else if ((*resource)->param[0] == ((MultiType)param0).getString())
-            match = true;
-          break;
-#endif /* NO_SHADERS */
-#ifndef NO_TEXTURES
-        case IMAGE:
-          if (param0 == MT_NULL)
-          {
-            if ((*resource)->param[0] == GL_TEXTURE_2D)
-              match = true;
-          }
-          else if ((*resource)->param[0] ==  param0.getInt())
-            match = true;
-          break;
-#endif /* NO_TEXTURES */
-        default:
-          match = true;
-          break;
-      }
-      if (match)
-      {
-        return (*resource);
-      }
-    }
-  }
-  return NULL;
-}
-
-/**
- * @brief Searches for a Resource by Pointer
- * @param pointer the Pointer to search for
- * @returns a Pointer to the Resource if found, NULL otherwise.
- */
-Resource* ResourceManager::locateResourceByPointer(const void* pointer) const
-{
-  //  Resource* enumRes = resourceList->enumerate();
-  std::vector<Resource*>::const_iterator resource;
-  for (resource = this->resourceList.begin(); resource != this->resourceList.end(); resource++)
-    if (pointer == (*resource)->pointer)
-      return (*resource);
-  return NULL;
-}
-
-std::string ResourceManager::toResourcableString(unsigned int i)
-{
-/*  int len = strlen(ResourceManager::ResourceTypeToChar(this->resourceList[i]->type));
-  len += this->resourceList[i]->name.size();
-  if (this->resourceList[i]->param[0].getCString()) len += strlen(this->resourceList[i]->param[0].getCString()) +1;
-  if (this->resourceList[i]->param[1].getCString()) len += strlen(this->resourceList[i]->param[1].getCString()) +1;
-  if (this->resourceList[i]->param[2].getCString()) len += strlen(this->resourceList[i]->param[2].getCString()) +1;
-  len += 10;
-  std::string tmp = new char[len];
-  tmp[0] = '\0';
-  strcat(tmp, ResourceManager::ResourceTypeToChar(this->resourceList[i]->type));
-  strcat(tmp,",");
-  strcat (tmp, this->resourceList[i]->name);
-  if (this->resourceList[i]->param[0].getCString() && this->resourceList[i]->param[0].getCString() != '\0')
-  {
-    strcat(tmp,",");
-    strcat( tmp, this->resourceList[i]->param[0].getCString());
-  }
-  if (this->resourceList[i]->param[1].getCString() && this->resourceList[i]->param[1].getCString() != '\0')
-  {
-    strcat(tmp,",");
-    strcat( tmp, this->resourceList[i]->param[1].getCString());
-  }
-  if (this->resourceList[i]->param[2].getCString() && this->resourceList[i]->param[2].getCString() != '\0')
-  {
-    strcat(tmp,",");
-    strcat( tmp, this->resourceList[i]->param[2].getCString());
-  }
-  return tmp;*/
-  return "";
-}
-
-/**
- * @brief caches a Resource from a ResourceableString created with the toResourcableString-function
- * @param resourceableString the String to cache the resource from.
- */
-bool ResourceManager::fromResourceableString(const std::string& resourceableString)
-{
-/*  SubString splits(resourceableString, ',');
-  splits.debug();
-  if (splits.getCount() == 2)
-    this->cache(splits[1], ResourceManager::stringToResourceType(splits[0]),
-                RP_LEVEL);
-  else if (splits.getCount() == 3)
-    return this->cache(splits[1], ResourceManager::stringToResourceType(splits[0]),
-                RP_LEVEL, splits[2]);
-  else if (splits.getCount() == 4)
-    return this->cache(splits[1], ResourceManager::stringToResourceType(splits[0]),
-                RP_LEVEL, splits[2], splits[3]);
-  else if (splits.getCount() == 5)
-    return this->cache(splits[1], ResourceManager::stringToResourceType(splits[0]),
-                RP_LEVEL, splits[2], splits[3], splits[4]);*/
-  return false;
-}
-
-
-/**
- * @param fileName the Name of the File to check
- * @returns The full name of the file, including the DataDir, and NULL if the file does not exist
- * !!IMPORTANT: this has to be deleted from the outside!!
-*/
-std::string ResourceManager::getFullName(const std::string& fileName)
-{
-  if (fileName.empty() || ResourceManager::getInstance()->getDataDir().empty())
-    return "";
-
-  std::string retName = ResourceManager::getInstance()->getDataDir() +fileName;
-  if (File(retName).isFile() || File(retName).isDirectory())
-    return retName;
-  else
-    return "";
-}
-
-
-/**
- * @brief checks wether a file is in the DataDir.
- * @param fileName the File to check if it is in the Data-Dir structure.
- * @returns true if the file exists, false otherwise
- */
-bool ResourceManager::isInDataDir(const std::string& fileName)
-{
-  if (fileName.empty() || ResourceManager::getInstance()->getDataDir().empty())
-    return false;
-
-  bool retVal = false;
-  std::string checkFile = ResourceManager::getInstance()->getDataDir() + fileName;
-
-  if (File(checkFile).exists())
-    retVal = true;
-  else
-    retVal = false;
-  return retVal;
-}
-
-
-/**
- * @brief outputs debug information about the ResourceManager
- */
-void ResourceManager::debug() const
-{
-  PRINT(0)("=RM===================================\n");
-  PRINT(0)("= RESOURCE-MANAGER DEBUG INFORMATION =\n");
-  PRINT(0)("======================================\n");
-  // if it is not initialized
-  PRINT(0)(" Reference is: %p\n", ResourceManager::singletonRef);
-  PRINT(0)(" Data-Directory is: %s\n", this->dataDir.c_str());
-  PRINT(0)(" List of Image-Directories: ");
-  std::vector<std::string>::const_iterator imageDir;
-  for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++)
-    PRINT(0)("%s ", (*imageDir).c_str());
-  PRINT(0)("\n");
-
-  PRINT(0)("List of all stored Resources:\n");
-  std::vector<Resource*>::const_iterator resource;
-  for (resource = this->resourceList.begin(); resource != this->resourceList.end(); resource++)
-
-  {
-    PRINT(0)("-----------------------------------------\n");
-    PRINT(0)("Name: %s; References: %d; Type: %s ", (*resource)->name.c_str(), (*resource)->count, ResourceManager::ResourceTypeToChar((*resource)->type));
-
-    PRINT(0)("gets deleted at ");
-    switch((*resource)->prio)
-    {
-      default:
-      case RP_NO:
-        PRINT(0)("first posibility (0)\n");
-        break;
-      case RP_LEVEL:
-        PRINT(0)("the end of the Level (1)\n");
-        break;
-      case RP_CAMPAIGN:
-        PRINT(0)("the end of the campaign (2)\n");
-        break;
-      case RP_GAME:
-        PRINT(0)("when leaving the game (3)\n");
-        break;
-    }
-  }
-
-
-
-  PRINT(0)("==================================RM==\n");
-}
-
-
-/**
- * @brief converts a ResourceType into the corresponding String
- * @param type the ResourceType to translate
- * @returns the converted String.
- */
-const char* ResourceManager::ResourceTypeToChar(ResourceType type)
-{
-  return ResourceManager::resourceNames[type];
-}
-
-/**
- * @brief converts a String into a ResourceType (good for loading)
- * @param resourceType the name of the Type
- * @returns the Number of the Type, or 0 (defautl) if not found.
- */
-ResourceType ResourceManager::stringToResourceType(const std::string& resourceType)
-{
-  for (unsigned int i = 0; i < RESOURCE_TYPE_SIZE; i++)
-    if (resourceType == ResourceManager::resourceNames[i])
-      return (ResourceType)i;
-  return (ResourceType)0;
-}
-
-/**
- * The Names of the ResourceTypes
- */
-const char* ResourceManager::resourceNames[] =
-  {
-#ifndef NO_MODEL
-    "ObjectModel",
-    "PrimitiveModel",
-    "MD2-Data",
-    "MD3-Data",
-    "MD3-Config"
-#endif
-#ifndef NO_TEXT
-    "Font",
-#endif
-#ifndef NO_AUDIO
-    "Wav",
-    "mp3",
-    "ogg",
-#endif
-#ifndef NO_TEXTURES
-    "Texture",
-#endif
-#ifndef NO_SHADERS
-    "Shader",
-#endif
-
-  };
Index: trunk/src/lib/util/loading/resource_manager.h
===================================================================
--- trunk/src/lib/util/loading/resource_manager.h	(revision 9675)
+++ trunk/src/lib/util/loading/resource_manager.h	(revision 9869)
@@ -1,157 +1,87 @@
 /*!
  * @file resource_manager.h
-  *  The Resource Manager checks if a file/resource is loaded.
-
-    If a file/resource was already loaded the resourceManager will
-    return a void pointer to the desired resource.
-    Otherwise it will instruct the coresponding resource-loader to load,
-    and receive a pointer to it.
-
-    it is possible to compile the resource Manager without some modules by
-    just adding the compile flag -D....
-    (NO_MODEL)
-    (NO_AUDIO)
-    (NO_TEXT)
-    (NO_TEXTURES)
-    (NO_SHADERS)
-*/
+ */
 
 #ifndef _RESOURCE_MANAGER_H
 #define _RESOURCE_MANAGER_H
 
-#include "base_object.h"
+#include "resource.h"
 #include "filesys/file.h"
+#include "filesys/directory.h"
 
-#include "multi_type.h"
-#include <vector>
+namespace Resources
+{
 
-//! An eumerator for different fileTypes the resourceManager supports
-typedef enum ResourceType
-{
-#ifndef NO_MODEL
-  OBJ,                  //!< loading .obj file
-  PRIM,                 //!< loading primitive model
-  MD2,                  //!< loading md2-file
-  MD3,                  //!< loading md3-file
-  MD3_CONFIG,           //!< the md3 config file
-#endif /* NO_MODEL */
-#ifndef NO_TEXT
-  TTF,                  //!< loading a TrueTypeFont
-#endif /* NO_TEXT */
-#ifndef NO_AUDIO
-  WAV,                  //!< loading wav
-  MP3,                  //!< loading mp3
-  OGG,                  //!< loading ogg
-#endif /* NO_AUDIO */
-#ifndef NO_TEXTURES
-  IMAGE,                //!< loading an image
-#endif /* NO_TEXTURES */
-#ifndef NO_SHADERS
-  SHADER,               //!< openGL-shader program
-#endif /* NO_SHADERS */
-  RESOURCE_TYPE_SIZE
-};
+  class ResourceManager : public BaseObject
+  {
+    ObjectListDeclaration(ResourceManager);
+  public:
+    ///////////////////////
+    //// INSTANZIATION ////
+    /** @returns a Pointer to the only object of this Class */
+    inline static ResourceManager* getInstance() { if (!_singletonRef) _singletonRef = new ResourceManager();  return _singletonRef; };
+    /** @brief deletes the Instance if it exists. */
+    inline static void deleteInstance() { if (_singletonRef) delete _singletonRef; };
 
-//! An enumerator for different UNLOAD-types.
-/**
-   RP_NO:        will be unloaded on request
-   RP_LEVEL:     will be unloaded at the end of a Level
-   RP_CAMPAIGN:  will be unloaded at the end of a Campaign
-   RP_GAME:      will be unloaded at the end of the whole Game (when closing orxonox)
-*/
-typedef enum ResourcePriority
-{
-  RP_NO        =   0,
-  RP_LEVEL     =   1,
-  RP_CAMPAIGN  =   2,
-  RP_GAME      =   4
-};
+    ////////////////////////
+    //// RESOURCE PATHS ////
+    void setMainGlobalPath(const Directory& directory);
+    void addGlobalPath(const Directory& directory);
 
-//! A Struct that keeps track about a resource its name its Type, and so on
-struct Resource
-{
-  BaseObject*       pointer;           //!< Pointer to the Resource.
-  unsigned int      count;             //!< How many times this Resource has been loaded.
+    bool addResourcePath(const std::string& resourceName, const std::string& pathName);
+    bool addResourceSubPath(const std::string& resourceName, const std::string& pathName);
+    void registerType(Resources::Type* type);
+    void unregisterType(Resources::Type* type);
 
-  std::string       name;              //!< Name of the Resource.
-  ResourceType      type;              //!< ResourceType of this Resource.
-  ResourcePriority  prio;              //!< The Priority of this resource. (This will only be increased)
+    /** @returns the main global search Path */
+    const Directory& mainGlobalPath() const { return _mainGlobalPath; };
+    /** @returns all global paths without mainGlobalPath */
+    const std::vector<Directory>& globalPaths() const { return _globalPaths; };
 
-  MultiType         param[3];          //!< The Parameters given to this Resource.
-};
+    ////////////////////
+    //// KEEPLEVELS ////
+    unsigned int addKeepLevelName(const std::string& keepLevelName);
+    unsigned int getKeepLevelID(const std::string& keepLevelName) const;
+    const std::string& getKeepLevelName(unsigned int keepLevelID) const;
+    void setDefaultKeepLevel(const KeepLevel& keepLevel) { this->_defaultKeepLevel = keepLevel; };
+    const KeepLevel& defaultKeepLevel() const { return this->_defaultKeepLevel; };
 
+    //////////////////////////
+    //// GENERAL QUERIES ////
+    /** @returns the Types of Resources */
+    const std::vector<Resources::Type*> resourceTypes() const { return _resourceTypes; };
 
-//! The ResourceManager is a class, that decides if a file/resource should be loaded
-/**
- * If a file/resource was already loaded the resourceManager will
- * return a pointer to the desired resource.
- * Otherwise it will instruct the corresponding resource-loader to load,
- * and receive the pointer to it.
- *
- * It does it by looking, if a desired file has already been loaded.
- * There is also the possibility to check for some variables
- */
-class ResourceManager : public BaseObject
-{
- public:
-  virtual ~ResourceManager();
-  /** @returns a Pointer to the only object of this Class */
-  inline static ResourceManager* getInstance() { if (!singletonRef) singletonRef = new ResourceManager();  return singletonRef; };
+    bool checkFileInMainPath(const File& fileInside);
+    std::string prependAbsoluteMainPath(const std::string& fileName);
 
-  bool setDataDir(const std::string& dataDir);
-  /** @returns the Name of the data directory */
-  inline const std::string& getDataDir() const { return this->dataDir; };
+    ////////////////////////////////////////
+    //// RESOURCE LOADING AND UNLOADING ////
+    void loadFromLoadString(const std::string& resourceTypeName, const std::string& loadString, const KeepLevel& keepLevel = KeepLevel());
+    void loadFromLoadStringHACK(const std::string& resourceTypeName, const std::string& loadString) { this->loadFromLoadString(resourceTypeName, loadString); };
 
+    void unloadAllBelowKeepLevel(const Resources::KeepLevel& keepLevel);
+    void unloadAllBelowKeepLevelINT(unsigned int level) { unloadAllBelowKeepLevel(level); };
 
-  bool tryDataDir(const std::string& dataDir);
-  bool verifyDataDir(const std::string& fileInside);
-  bool addImageDir(const std::string& imageDir);
+    ///////////////
+    //// DEBUG ////
+    void debug() const;
 
-  bool cache(const std::string& fileName, ResourceType type, ResourcePriority prio = RP_NO,
-             const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType());
-  BaseObject* copy(BaseObject* resourcePointer);
+  private:
+    ResourceManager();
+    virtual ~ResourceManager();
 
-  BaseObject* load(const std::string& fileName, ResourcePriority prio = RP_NO,
-                   const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType());
-  BaseObject* load(const std::string& fileName, ResourceType type, ResourcePriority prio = RP_NO,
-                   const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType());
-  bool unload(BaseObject* pointer, ResourcePriority prio = RP_NO);
-  bool unload(Resource* resource, ResourcePriority = RP_NO);
-  bool unloadAllByPriority(ResourcePriority prio);
+  private:
+    static ResourceManager*            _singletonRef;       //!< singleton Reference
 
-  Resource* locateResourceByInfo(const std::string& fileName, ResourceType type,
-                                 const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType()) const;
-  Resource* locateResourceByPointer(const void* pointer) const;
+    Directory                          _mainGlobalPath;     //!< The main include directory (default at "./")
+    std::vector<Directory>             _globalPaths;        //!< Additional Global include directories.
 
-  std::string toResourcableString(unsigned int i);
-  bool fromResourceableString(const std::string& resourceableString);
-  /** @returns the Count of Resources the ResourceManager handles */
-  unsigned int resourceCount() const { return this->resourceList.size(); }
+    std::vector<Resources::Type*>      _resourceTypes;      //!< A Vector of all the stored ResourceTypes @see Resources::Type
 
-  void debug() const;
+    std::vector<std::string>           _keepLevelNames;     //!< Names of KeepLevels @see Resources::KeepLevel
+    KeepLevel                          _defaultKeepLevel;   //!< The default KeepLevel.
+  };
 
-
-  // utility functions for handling files in and around the data-directory
-  static std::string getFullName(const std::string& fileName);
-  static bool isInDataDir(const std::string& fileName);
-
-  static const char* ResourceTypeToChar(ResourceType type);
-  static ResourceType stringToResourceType(const std::string& resourceType);
-
- private:
-  ResourceManager();
-  Resource* loadResource(const std::string& fileName, ResourceType type, ResourcePriority prio,
-                         const MultiType& param0, const MultiType& param1, const MultiType& param2);
-
- private:
-  static ResourceManager*    singletonRef;       //!< singleton Reference
-
-  std::string                dataDir;            //!< The Data Directory, where all relevant Data is stored.
-  std::vector<std::string>   imageDirs;          //!< A list of directories in which images are stored.
-
-  std::vector<Resource*>     resourceList;       //!< The List of Resources, that has already been loaded.
-
-  static const char*         resourceNames[RESOURCE_TYPE_SIZE];
-};
+}
 
 #endif /* _RESOURCE_MANAGER_H */
Index: trunk/src/lib/util/multi_type.cc
===================================================================
--- trunk/src/lib/util/multi_type.cc	(revision 9675)
+++ trunk/src/lib/util/multi_type.cc	(revision 9869)
@@ -33,21 +33,21 @@
   {
     default:
-      this->value.Float = 0.0f;
-      break;
+    this->value.Float = 0.0f;
+    break;
     case MT_BOOL:
-      this->value.Bool = false;
-      break;
+    this->value.Bool = false;
+    break;
     case MT_INT:
-      this->value.Int = 0;
-      break;
+    this->value.Int = 0;
+    break;
     case MT_FLOAT:
-      this->value.Float = 0.0f;
-      break;
+    this->value.Float = 0.0f;
+    break;
     case MT_CHAR:
-      this->value.Char = '\0';
-      break;
+    this->value.Char = '\0';
+    break;
     case MT_STRING:
-      this->storedString = "";
-      break;
+    this->storedString = "";
+    break;
   }
 }
@@ -142,17 +142,17 @@
   {
     case MT_NULL:
-      return true;
+    return true;
     case MT_BOOL:
-      return (this->value.Bool == mt.value.Bool);
+    return (this->value.Bool == mt.value.Bool);
     case MT_INT:
-      return (this->value.Int == mt.value.Int);
+    return (this->value.Int == mt.value.Int);
     case MT_CHAR:
-      return (this->value.Char == mt.value.Char);
+    return (this->value.Char == mt.value.Char);
     case MT_FLOAT:
-      return (this->value.Float == mt.value.Float);
+    return (this->value.Float == mt.value.Float);
     case MT_STRING:
-      return (this->storedString == mt.storedString);
+    return (this->storedString == mt.storedString);
     default:
-      return false;
+    return false;
   }
 }
@@ -171,20 +171,20 @@
   {
     case MT_BOOL:
-      this->setBool(this->getBool());
-      break;
+    this->setBool(this->getBool());
+    break;
     case MT_INT:
-      this->setInt(this->getInt());
-      break;
+    this->setInt(this->getInt());
+    break;
     case MT_FLOAT:
-      this->setFloat(this->getFloat());
-      break;
+    this->setFloat(this->getFloat());
+    break;
     case MT_CHAR:
-      this->setChar(this->getChar());
-      break;
+    this->setChar(this->getChar());
+    break;
     case MT_STRING:
-      this->setString(this->getString());
-      break;
+    this->setString(this->getString());
+    break;
     default:
-      this->type = type;
+    this->type = type;
   }
 }
@@ -195,6 +195,4 @@
  *
  * This is a pure Value copy. The current type will be preserved.
- *
- * @TODO speedup
  */
 void MultiType::setValueOf(const MultiType& mt)
@@ -257,4 +255,13 @@
 }
 
+/**
+ * @brief stores any value to the string.
+ * @note this Value can be grabbed by using the getStoredString function.
+ */
+void MultiType::storeString()
+{
+  if (!(this->type & MT_STRING))
+    this->storedString = this->getString();
+}
 
 /**************************
@@ -275,5 +282,5 @@
   else if (this->type & MT_STRING) return (this->storedString == "true" ||
                                             this->storedString == "TRUE" ||
-                                            this->storedString != "0"); //! @TODO make this better...
+                                            this->storedString != "0"); // TODO make this better...
 
   return false;
@@ -381,13 +388,30 @@
  * @brief returns a Constant string (actually this is slower than getString()
  * @returns a constant string of the stored version's one.
- * @note this  could lead to a inconsistency of data
+ * @note this  could lead to a inconsistency of data AND IS HIGHLY NON_THREAD_SAFE!
+ * PLEASE THINK ABOUT USING THE getStoredString function in conjunction with storeString().
  */
 const std::string& MultiType::getConstString() const
 {
-
   MultiType::constString = this->getString();
   return MultiType::constString;
 }
 
+/**
+ * @brief returns the currently stored string.
+ * @returns the Stored string.
+ * @note Storing a string works as follows: \\
+ * MultiType a(3);  // Creates a MultiType of Type int with value 3 \\
+ * a.storeString(); // Stores the String in the internal structure. \\
+ * std::string name = a.getStoredString();
+ *
+ * This would be the same as
+ * name = a.getString();
+ * but with much more const'ness.
+ */
+const std::string& MultiType::getStoredString() const
+{
+  MultiType::constString = this->getString();
+  return MultiType::constString;
+}
 
 /**
@@ -433,23 +457,23 @@
   {
     case MT_BOOL:
-      this->setBool(false);
-      break;
+    this->setBool(false);
+    break;
     case MT_INT:
-      this->setInt(0);
-      break;
+    this->setInt(0);
+    break;
     case MT_FLOAT:
-      this->setFloat(0.0f);
-      break;
+    this->setFloat(0.0f);
+    break;
     case MT_CHAR:
-      this->setChar('\0');
-      break;
+    this->setChar('\0');
+    break;
     case MT_STRING:
-      this->setString("");
-      break;
+    this->setString("");
+    break;
     default:
 #ifdef DEBUG
-      PRINTF(2)("Unknown Type not reseting\n");
+    PRINTF(2)("Unknown Type not reseting\n");
 #endif
-      break;
+    break;
   }
 }
@@ -465,15 +489,15 @@
   {
     case MT_BOOL:
-      return MultiType::typeNames[1];
+    return MultiType::typeNames[1];
     case MT_INT:
-      return MultiType::typeNames[2];
+    return MultiType::typeNames[2];
     case MT_FLOAT:
-      return MultiType::typeNames[3];
+    return MultiType::typeNames[3];
     case MT_CHAR:
-      return MultiType::typeNames[4];
+    return MultiType::typeNames[4];
     case MT_STRING:
-      return MultiType::typeNames[5];
+    return MultiType::typeNames[5];
     default:
-      return MultiType::typeNames[0];
+    return MultiType::typeNames[0];
   }
 }
Index: trunk/src/lib/util/multi_type.h
===================================================================
--- trunk/src/lib/util/multi_type.h	(revision 9675)
+++ trunk/src/lib/util/multi_type.h	(revision 9869)
@@ -17,6 +17,6 @@
   MT_BOOL            = 1,                  //!< A bool Value.
   MT_INT             = 2,                  //!< An int Value.
-  MT_UINT            = 2,
-  MT_LONG            = 2,
+  MT_UINT            = 2,                  //!< A insigned int Value.
+  MT_LONG            = 2,                  //!< A long Value
   MT_FLOAT           = 4,                  //!< A float Value.
   MT_CHAR            = 8,                  //!< A single char.
@@ -44,17 +44,29 @@
 
     MultiType& operator=(const MultiType& mt);
+    /** @param value the value to set (here a bool) @returns the MultiType where this the bool is stored */
     MultiType& operator=(bool value) { this->setBool(value); return *this; };
+    /** @param value the value to set (here an int) @returns the MultiType where this the int is stored */
     MultiType& operator=(int value) { this->setInt(value); return *this; };
+    /** @param value the value to set (here an int) @returns the MultiType where this the float is stored */
     MultiType& operator=(float value) { this->setFloat(value); return *this; };
+    /** @param value the value to set (here a char) @returns the MultiType where this the char is stored */
     MultiType& operator=(char value) { this->setChar(value); return *this; };
+    /** @param value the value to set (here a string) @returns the MultiType where this the string is stored */
     MultiType& operator=(const std::string& value) { this->setString(value); return *this; };
 
     bool operator==(const MultiType& mt) const;
+    /** @param value the value to compare this MultiType against @returns true if comparison was io */
     bool operator==(bool value) const { return (this->getBool() == value); };
+    /** @param value the value to compare this MultiType against @returns true if comparison was io */
     bool operator==(int value) const { return (this->getInt() == value); };
+    /** @param value the value to compare this MultiType against @returns true if comparison was io */
     bool operator==(float value) const { return (this->getFloat() ==  value); };
+    /** @param value the value to compare this MultiType against @returns true if comparison was io */
     bool operator==(char value) const { return (this->getChar() == value); };
+    /** @param value the value to compare this MultiType against @returns true if comparison was io */
     bool operator==(const std::string& value) const { return (this->getString() == value); };
+    /** @param type the Type to compare this MultiType against @returns true if the types matched */
     bool operator==(MT_Type type) const { return (this->type == type); }
+    /** @param type the type to compare this MultiType against @returns true if the types do not match */
     bool operator!=(MT_Type type) const { return (this->type != type); }
 
@@ -68,9 +80,15 @@
 
     // for your convenience.
+    /** @param value the value to set. Here a bool */
     inline void setValue(bool value) { this->setBool(value); };
+    /** @param value the value to set. Here an int */
     inline void setValue(int value) { this->setInt(value); };
+    /** @param value the value to set. Here a float */
     inline void setValue(float value) { this->setFloat(value); };
+    /** @param value the value to set. Here a char */
     inline void setValue(char value) { this->setChar(value); };
+    /** @param value the value to set. Here a char array (string) */
     inline void setValue(const char* value) { this->setString(value); };
+    /** @param value the value to set. Here a string */
     inline void setValue(const std::string& value) { this->setString(value); };
     void setValueOf(const MultiType& mt);
@@ -79,4 +97,5 @@
     inline MT_Type getType() const { return this->type; };
 
+    void storeString();
 
     /* RETRIEVING FUNCTIONS */
@@ -88,4 +107,5 @@
     std::string getString() const;
     const std::string& getConstString() const;
+    const std::string& getStoredString() const;
 
     void reset();
Index: trunk/src/lib/util/preferences.cc
===================================================================
--- trunk/src/lib/util/preferences.cc	(revision 9675)
+++ 	(revision )
@@ -1,334 +1,0 @@
-/*
-   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: Christoph Renner
-   co-programmer: ...
-*/
-
-//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
-
-#include "preferences.h"
-#include "lib/parser/ini_parser/ini_parser.h"
-#include "debug.h"
-
-
-/**
- * standard constructor
- */
-Preferences::Preferences ()
-{
-   this->setClassID(CL_PREFERENCES, "Preferences");
-   this->setName("Preferences");
-   this->fileName = "";
-}
-
-/**
- *  the singleton reference to this class
- */
-Preferences* Preferences::singletonRef = NULL;
-
-/**
-   @brief standard deconstructor
- */
-Preferences::~Preferences ()
-{
-  Preferences::singletonRef = NULL;
-}
-
-/**
- * Check if this item exists
- * @param section name of the section
- * @param name name of the item to check
- * @return true if the item exists
- */
-bool Preferences::exists( const std::string& section, const std::string& name)
-{
-  std::list<prefSection>::const_iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      std::list<prefItem>::const_iterator it2 = it->items.begin();
-
-      for ( ; it2!=it->items.end(); it2++)
-      {
-        if ( it2->name == name )
-          return true;
-      }
-
-      break;
-    }
-  }
-
-  return false;
-}
-
-/**
- * Check if this section exists
- * @param section name of the section
- * @param name name of the item to check
- * @return true if the item exists
- */
-bool Preferences::sectionExists( const std::string& section )
-{
-  std::list<prefSection>::const_iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      return true;
-    }
-  }
-
-  return false;
-}
-
-/**
- * Sets the value of an item. Creates it if doesn't exits.
- * @param section name of the section
- * @param name name of the item
- * @param value value
- */
-void Preferences::setString(const std::string& section, const std::string& name, const std::string& value, bool dontSetModified)
-{
-  MultiType t(value);
-  setMultiType(section, name, t, dontSetModified);
-}
-
-/**
- * Sets the value of an item. Creates it if doesn't exits.
- * @param section name of the section
- * @param name name of the item
- * @param value value
- */
-void Preferences::setInt(const std::string& section, const std::string& name, int value, bool dontSetModified)
-{
-  MultiType t(value);
-  setMultiType(section, name, t, dontSetModified);
-}
-
-/**
- * Sets the value of an item. Creates it if doesn't exits.
- * @param section name of the section
- * @param name name of the item
- * @param value value
- */
-void Preferences::setFloat(const std::string& section, const std::string& name, float value, bool dontSetModified)
-{
-  MultiType t(value);
-  setMultiType(section, name, t, dontSetModified);
-}
-
-/**
- * Get the value of an item
- * @param section name of the section
- * @param name name of the item to check
- * @param defaultValue value to return if item doesn't exist
- * @return value of the item if found. defaultValue else
- */
-std::string Preferences::getString(const std::string& section, const std::string& name, const std::string& defaultValue)
-{
-  return getMultiType(section, name, MultiType(defaultValue)).getString();
-}
-
-/**
- * Get the value of an item
- * @param section name of the section
- * @param name name of the item to check
- * @param defaultValue value to return if item doesn't exist
- * @return value of the item if found. defaultValue else
- */
-int Preferences::getInt(const std::string& section, const std::string& name, int defaultValue)
-{
-  return getMultiType(section, name, MultiType(defaultValue)).getInt();
-}
-
-/**
- * Get the value of an item
- * @param section name of the section
- * @param name name of the item to check
- * @param defaultValue value to return if item doesn't exist
- * @return value of the item if found. defaultValue else
- */
-float Preferences::getFloat(const std::string& section, const std::string& name, float defaultValue)
-{
-  return getMultiType(section, name, MultiType(defaultValue)).getFloat();
-}
-
-/**
- * Sets the value of an item. Creates it if doesn't exits.
- * @param section name of the section
- * @param name name of the item
- * @param value value
- */
-void Preferences::setMultiType(const std::string& section, const std::string& name, const MultiType& value, bool dontSetModified)
-{
-  std::list<prefSection>::iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      std::list<prefItem>::iterator it2 = it->items.begin();
-
-      for ( ; it2!=it->items.end(); it2++)
-      {
-        if ( it2->name == name )
-        {
-          if (!dontSetModified)
-            it2->modified = value.getString() != it2->value.getString();
-
-          it2->value = value;
-
-          return;
-        }
-      }
-      prefItem item;
-      item.value = value;
-      item.modified = !dontSetModified;
-      item.name = name;
-      it->items.push_back(item);
-      return;
-    }
-  }
-
-  prefItem item;
-  item.value = value;
-  item.modified = !dontSetModified;
-  item.name = name;
-
-  prefSection sec;
-  sec.items.push_back(item);
-  sec.sectionName = section;
-  data.push_back( sec );
-}
-
-/**
- * Get the value of an item
- * @param section name of the section
- * @param name name of the item to check
- * @param defaultValue value to return if item doesn't exist
- * @return value of the item if found. defaultValue else
- */
-MultiType Preferences::getMultiType(const std::string& section, const std::string& name,const MultiType& defaultValue)
-{
-  std::list<prefSection>::const_iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      std::list<prefItem>::const_iterator it2 = it->items.begin();
-
-      for ( ; it2!=it->items.end(); it2++)
-      {
-        if ( it2->name == name )
-        {
-          return it2->value;
-        }
-      }
-
-      break;
-    }
-  }
-
-  return defaultValue;
-}
-
-void Preferences::setUserIni(const std::string& fileName)
-{
-  this->fileName = fileName;
-}
-
-bool Preferences::save()
-{
-  if ( this->fileName == "" )
-  {
-    PRINTF(1)("You must call setUserIni before you can call save()\n");
-    return false;
-  }
-  IniParser iniParser(this->fileName);
-
-  std::list<prefSection>::iterator it = data.begin();
-  bool didChanges = false;
-  for ( ; it!=data.end(); it++)
-  {
-    std::list<prefItem>::iterator it2 = it->items.begin();
-
-    for ( ; it2!=it->items.end(); it2++)
-    {
-      if ( it2->modified )
-      {
-        iniParser.editVar(it2->name, it2->value.getString(), it->sectionName);
-        didChanges = true;
-      }
-    }
-  }
-  /// HACK DO WE HAVE TO CHECK THIS??
-  //if ( didChanges )
-  {
-    iniParser.writeFile( this->fileName );
-  }
-
-  return true;
-}
-
-/**
- * prints out all section with its items and values
- */
-void Preferences::debug()
-{
-  std::list<prefSection>::iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    PRINTF(0)("%s\n", it->sectionName.c_str());
-    std::list<prefItem>::iterator it2 = it->items.begin();
-
-    for ( ; it2!=it->items.end(); it2++)
-    {
-      PRINTF(0)("--> %s = '%s'%s\n", it2->name.c_str(), it2->value.getString().c_str(), ((!it2->modified)?"":" <modified>"));
-    }
-  }
-}
-
-/**
- * list all keys in section
- * @param section section
- * @return list of keys
- */
-std::list< std::string > Preferences::listKeys( const std::string section )
-{
-  std::list<std::string> lst;
-
-  std::list<prefSection>::const_iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      std::list<prefItem>::const_iterator it2 = it->items.begin();
-
-      for ( ; it2!=it->items.end(); it2++)
-      {
-        lst.push_back( it2->name );
-      }
-
-      break;
-    }
-  }
-
-  return lst;
-}
-
-
Index: trunk/src/lib/util/preferences.h
===================================================================
--- trunk/src/lib/util/preferences.h	(revision 9675)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*!
- * @file proto_singleton.h
- * @brief Definition of the ... singleton Class
-*/
-
-#ifndef _PREFERENCES_H
-#define _PREFERENCES_H
-
-#include "base_object.h"
-#include "multi_type.h"
-#include <list>
-
-// FORWARD DECLARATION
-
-class IniFilePrefsReader;
-
-typedef struct {
-  std::string name;
-  MultiType value;
-  bool modified;
-} prefItem;
-
-typedef struct {
-  std::string sectionName;
-  std::list<prefItem> items;
-} prefSection ;
-
-
-//! A default singleton class.
-class Preferences : public BaseObject {
-
- public:
-   virtual ~Preferences(void);
-  /** @returns a Pointer to the only object of this Class */
-   inline static Preferences* getInstance(void) { if (!singletonRef) singletonRef = new Preferences();  return singletonRef; };
-
-   //check if this entry exists
-   bool sectionExists(const std::string& section );
-   bool exists(const std::string& section, const std::string& name);
-
-   void setString(const std::string& section, const std::string& name, const std::string& value, bool dontSetModified = false);
-   void setInt(const std::string& section, const std::string& name, int value, bool dontSetModified = false);
-   void setFloat(const std::string& section, const std::string& name, float value, bool dontSetModified = false);
-   void setMultiType(const std::string& section, const std::string& name, const MultiType& value, bool dontSetModified = false);
-
-   std::string getString(const std::string& section, const std::string& name, const std::string& defaultValue);
-   int getInt(const std::string& section, const std::string& name, int defaultValue);
-   float getFloat(const std::string& section, const std::string& name, float defaultValue);
-   MultiType getMultiType(const std::string& section, const std::string& name, const MultiType& defaultValue);
-
-   void setUserIni(const std::string& fileName);
-
-   bool save();
-
-   void debug();
-
-   std::list<std::string> listKeys( const std::string section );
-
-
- private:
-   Preferences(void);
-   static Preferences* singletonRef;
-
-   std::list<prefSection> data;
-
-   std::list<IniFilePrefsReader*> iniFilePrefsReaders;
-
-   std::string fileName;
-
-};
-
-#endif /* _PREFERENCES_H */
Index: trunk/src/lib/util/sigslot/signal.h
===================================================================
--- trunk/src/lib/util/sigslot/signal.h	(revision 9675)
+++ trunk/src/lib/util/sigslot/signal.h	(revision 9869)
@@ -96,4 +96,5 @@
   {
   public:
+    virtual ~_connection_base0() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit() = 0;
@@ -106,4 +107,5 @@
   {
   public:
+    virtual ~_connection_base1() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type) = 0;
@@ -116,4 +118,5 @@
   {
   public:
+    virtual ~_connection_base2() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type, arg2_type) = 0;
@@ -126,4 +129,5 @@
   {
   public:
+    virtual ~_connection_base3() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type, arg2_type, arg3_type) = 0;
@@ -136,4 +140,5 @@
   {
   public:
+    virtual ~_connection_base4() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type) = 0;
@@ -147,4 +152,5 @@
   {
   public:
+    virtual ~_connection_base5() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type,
@@ -161,4 +167,5 @@
   {
   public:
+    virtual ~_connection_base6() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
@@ -175,4 +182,5 @@
   {
   public:
+    virtual ~_connection_base7() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
@@ -189,4 +197,5 @@
   {
   public:
+    virtual ~_connection_base8() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
Index: trunk/src/lib/util/substring.cc
===================================================================
--- trunk/src/lib/util/substring.cc	(revision 9675)
+++ trunk/src/lib/util/substring.cc	(revision 9869)
@@ -51,4 +51,5 @@
  * @param delimiters multiple set of characters at what to split. (delimiters)
  * @param delimiterNeighbours neighbours of the delimiters, that will be erased only when near a delimiter.
+ * @param emptyEntries If empty entries should be allewed or removed.
  * @param escapeChar The Escape Character that overrides splitters commends and so on...
  * @param safemode_char within these characters splitting won't happen
@@ -109,4 +110,6 @@
 /** @brief Helper that gets you a String consisting of all WhiteSpaces and the Comma */
 const std::string SubString::WhiteSpacesWithComma = " \n\t,";
+/** An Empty SubString */
+const SubString SubString::NullSubString = SubString();
 
 /**
@@ -145,4 +148,5 @@
  * @brief comparator.
  * @param subString the SubString to compare against this one.
+ * @param length how many entries to compare. (from 0 to length)
  * @returns true if the Stored Strings match
  */
@@ -273,9 +277,8 @@
  * @brief splits line into tokens and stores them in ret.
  * @param ret the Array, where the Splitted strings will be stored in
- * @param offsets an Array of Offsets, here the distance from the inputstring
  * to the beginning of the current token is stored
  * @param line the inputLine to split
  * @param delimiters a String of Delimiters (here the input will be splitted)
- * @param delimiterNeighbour Naighbours to the Delimitter, that will be removed if they are to the left or the right of a Delimiter.
+ * @param delimiterNeighbours Naighbours to the Delimitter, that will be removed if they are to the left or the right of a Delimiter.
  * @param emptyEntries: if empty Strings are added to the List of Strings.
  * @param escape_char: Escape carater (escapes splitters)
Index: trunk/src/lib/util/substring.h
===================================================================
--- trunk/src/lib/util/substring.h	(revision 9675)
+++ trunk/src/lib/util/substring.h	(revision 9869)
@@ -33,10 +33,11 @@
 {
 public:
+  //! An enumerator for the State the Parser is in
   typedef enum {
-    SL_NORMAL,
-    SL_ESCAPE,
-    SL_SAFEMODE,
-    SL_SAFEESCAPE,
-    SL_COMMENT,
+    SL_NORMAL,            //!< Normal state
+    SL_ESCAPE,            //!< After an escape character
+    SL_SAFEMODE,          //!< In safe mode (between "" mostly).
+    SL_SAFEESCAPE,        //!< In safe mode with the internal escape character, that escapes even the savemode character.
+    SL_COMMENT,           //!< In Comment mode.
   } SPLIT_LINE_STATE;
 
@@ -48,6 +49,6 @@
             const std::string& delimiters, const std::string& delimiterNeighbours = "", bool emptyEntries=false,
             char escapeChar ='\\', char safemode_char = '"', char comment_char = '\0');
+  SubString(unsigned int argc, const char** argv);
   /** @brief create a Substring as a copy of another one. @param subString the SubString to copy. */
-  SubString(unsigned int argc, const char** argv);
   SubString(const SubString& subString) { *this = subString; };
   SubString(const SubString& subString, unsigned int subSetBegin);
@@ -110,4 +111,5 @@
   static const std::string WhiteSpaces;
   static const std::string WhiteSpacesWithComma;
+  static const SubString   NullSubString;
 
 private:
