Index: trunk/src/lib/util/executor/executor.h
===================================================================
--- trunk/src/lib/util/executor/executor.h	(revision 8894)
+++ 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 */
