Index: code/branches/FICN/src/misc/Convert.h
===================================================================
--- code/branches/FICN/src/misc/Convert.h	(revision 725)
+++ code/branches/FICN/src/misc/Convert.h	(revision 726)
@@ -20,8 +20,7 @@
  *
  *   Author:
+ *      Benjamin Grauer
+ *   Co-authors:
  *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
  */
 
@@ -37,97 +36,68 @@
 #include <sstream>
 
-//! The Convert class has some static member functions to convert strings to values and values to strings.
-class Convert
+
+// DEFAULT CLASS
+template <typename FromType, typename ToType>
+class Converter
 {
-  public:
-    /**
-        @brief Converts a value of any type to a string.
-        @param output The string to write the result in
-        @param input The variable to convert
-        @return True if the conversion succeded
-
-        @example
-        float f = 3.14;
-        std::string output;
-        bool success = Convert::ToString(output, f);
-    */
-    template <typename T>
-    static bool ToString(std::string* output, T input)
-    {
-        std::ostringstream oss;
-        if (oss << input)
-        {
-            (*output) = oss.str();
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-        @brief Converts a value of any type to a string and assigns a defaultvalue if the conversion fails.
-        @param output The string to write the result in
-        @param input The variable to convert
-        @param fallbackString The assigned string if the conversion fails.
-        @return True if the conversion succeeded
-
-        @example
-        float f = 3.14;
-        std::string output;
-        bool success = Convert::ToString(output, f, "0.000000");
-    */
-    template <typename T>
-    static bool ToString(std::string* output, T input, const std::string& fallbackString)
-    {
-        if (Convert::ToString(output, input))
-            return true;
-
-        (*output) = fallbackString;
-        return false;
-    }
-
-    /**
-        @brief Converts a string to a value of any type.
-        @param output The variable to assign the result to
-        @param input The string to convert
-        @return True if the conversion succeeded
-
-        @example
-        std::string input = "3.14";
-        float f;
-        bool success = string2Number(f, input);
-    */
-    template <typename T>
-    static bool FromString(T* output, const std::string& input)
-    {
-        std::istringstream iss(input);
-        if (iss >> (*output))
-            return true;
-
-        return false;
-    }
-
-    /**
-        @brief Converts a string to a value of any type.
-        @param output The variable to assign the result to
-        @param input The string to convert
-        @param fallbackValue The assigned value if the conversion fails
-        @return True if the conversion succeeded
-
-        @example
-        std::string input = "3.14";
-        float f;
-        bool success = string2Number(f, input, 0.000000);
-    */
-    template <typename T>
-    static bool FromString(T* output, const std::string& input, T fallbackValue)
-    {
-        if (Convert::FromString(output, input))
-            return true;
-
-        (*output) = fallbackValue;
-        return false;
-    }
+ public:
+  bool operator()(ToType* output, const FromType& input) const
+  {
+    return false;
+  }
 };
 
+// PARTIAL SPECIALIZATION TO CONVERT TO STRINGS
+template<typename FromType>
+class Converter<FromType, std::string>
+{
+ public:
+  bool operator()(std::string* output, const FromType& input) const
+  {
+    std::ostringstream oss;
+    if (oss << input)
+    {
+      (*output) = oss.str();
+      return true;
+    }
+    else
+      return false;
+  }
+};
+
+// PARTIAL SPECIALIZATION TO CONVERT FROM STRING
+template<typename ToType>
+class Converter<std::string, ToType>
+{
+ public:
+  bool operator()(ToType* output, const std::string& input) const
+  {
+    std::istringstream iss(input);
+    if (iss >> (*output))
+      return true;
+    else
+      return false;
+  }
+};
+
+// FUNCTION SO WE DO NOT HAVE TO TELL THE COMPILER ABOUT THE TYPE
+template<typename FromType, typename ToType>
+static bool ConvertValue(ToType* output, const FromType& input)
+{
+  Converter<FromType, ToType> converter;
+  return converter(output, input);
+}
+
+// THE SAME, BUT WITH DEFAULT VALUE
+template<typename FromType, typename ToType>
+static bool ConvertValue(ToType* output, const FromType& input, const ToType& fallback)
+{
+  Converter<FromType, ToType> converter;
+  if (converter(output, input))
+    return true;
+
+  (*output) = fallback;
+  return false;
+}
+
 #endif /* _Convert_H__ */
Index: code/branches/FICN/src/orxonox/core/ConfigValueContainer.cc
===================================================================
--- code/branches/FICN/src/orxonox/core/ConfigValueContainer.cc	(revision 725)
+++ code/branches/FICN/src/orxonox/core/ConfigValueContainer.cc	(revision 726)
@@ -50,5 +50,5 @@
         this->type_ = VT_Int;
 
-        Convert::ToString(&this->defvalueString_, defvalue, "0");                   // Try to convert the default-value to a string
+        ConvertValue(&this->defvalueString_, defvalue, std::string("0"));           // Try to convert the default-value to a string
         this->searchConfigFileLine();                                               // Search the entry in the config-file
 
@@ -72,5 +72,5 @@
         this->type_ = VT_uInt;
 
-        Convert::ToString(&this->defvalueString_, defvalue, "0");                   // Try to convert the default-value to a string
+        ConvertValue(&this->defvalueString_, defvalue, std::string("0"));           // Try to convert the default-value to a string
         this->searchConfigFileLine();                                               // Search the entry in the config-file
 
@@ -94,5 +94,5 @@
         this->type_ = VT_Char;
 
-        Convert::ToString(&this->defvalueString_, (int)defvalue, "0");              // Try to convert the default-value to a string
+        ConvertValue(&this->defvalueString_, (int)defvalue, std::string("0"));      // Try to convert the default-value to a string
         this->searchConfigFileLine();                                               // Search the entry in the config-file
 
@@ -116,5 +116,5 @@
         this->type_ = VT_uChar;
 
-        Convert::ToString(&this->defvalueString_, (unsigned int)defvalue, "0");     // Try to convert the default-value to a string
+        ConvertValue(&this->defvalueString_, (unsigned int)defvalue, std::string("0"));     // Try to convert the default-value to a string
         this->searchConfigFileLine();                                               // Search the entry in the config-file
 
@@ -138,5 +138,5 @@
         this->type_ = VT_Float;
 
-        Convert::ToString(&this->defvalueString_, defvalue, "0.000000");            // Try to convert the default-value to a string
+        ConvertValue(&this->defvalueString_, defvalue, std::string("0.000000"));    // Try to convert the default-value to a string
         this->searchConfigFileLine();                                               // Search the entry in the config-file
 
@@ -160,5 +160,5 @@
         this->type_ = VT_Double;
 
-        Convert::ToString(&this->defvalueString_, defvalue, "0.000000");            // Try to convert the default-value to a string
+        ConvertValue(&this->defvalueString_, defvalue, std::string("0.000000"));    // Try to convert the default-value to a string
         this->searchConfigFileLine();                                               // Search the entry in the config-file
 
@@ -182,5 +182,5 @@
         this->type_ = VT_LongDouble;
 
-        Convert::ToString(&this->defvalueString_, defvalue, "0.000000");            // Try to convert the default-value to a string
+        ConvertValue(&this->defvalueString_, defvalue, std::string("0.000000"));    // Try to convert the default-value to a string
         this->searchConfigFileLine();                                               // Search the entry in the config-file
 
@@ -384,5 +384,5 @@
     bool ConfigValueContainer::parseSting(const std::string& input, int defvalue)
     {
-        return Convert::FromString(&this->value_.value_int_, input, defvalue);
+        return ConvertValue(&this->value_.value_int_, input, defvalue);
     }
 
@@ -395,5 +395,5 @@
     bool ConfigValueContainer::parseSting(const std::string& input, unsigned int defvalue)
     {
-        return Convert::FromString(&this->value_.value_uint_, input, defvalue);
+        return ConvertValue(&this->value_.value_uint_, input, defvalue);
     }
 
@@ -407,5 +407,5 @@
     {
         // I used value_int_ instead of value_char_ to avoid number <-> char confusion in the config-file
-        return Convert::FromString(&this->value_.value_int_, input, (int)defvalue);
+        return ConvertValue(&this->value_.value_int_, input, (int)defvalue);
     }
 
@@ -419,5 +419,5 @@
     {
         // I used value_uint_ instead of value_uchar_ to avoid number <-> char confusion in the config-file
-        return Convert::FromString(&this->value_.value_uint_, input, (unsigned int)defvalue);
+        return ConvertValue(&this->value_.value_uint_, input, (unsigned int)defvalue);
     }
 
@@ -430,5 +430,5 @@
     bool ConfigValueContainer::parseSting(const std::string& input, float defvalue)
     {
-        return Convert::FromString(&this->value_.value_float_, input, defvalue);
+        return ConvertValue(&this->value_.value_float_, input, defvalue);
     }
 
@@ -441,5 +441,5 @@
     bool ConfigValueContainer::parseSting(const std::string& input, double defvalue)
     {
-        return Convert::FromString(&this->value_.value_double_, input, defvalue);
+        return ConvertValue(&this->value_.value_double_, input, defvalue);
     }
 
@@ -452,5 +452,5 @@
     bool ConfigValueContainer::parseSting(const std::string& input, long double defvalue)
     {
-        return Convert::FromString(&this->value_.value_long_double_, input, defvalue);
+        return ConvertValue(&this->value_.value_long_double_, input, defvalue);
     }
 
@@ -477,5 +477,5 @@
         {
             // Its not a known word - is it a number?
-            return Convert::FromString(&this->value_.value_bool_, input, defvalue);
+            return ConvertValue(&this->value_.value_bool_, input, defvalue);
         }
 
@@ -549,10 +549,10 @@
         {
             std::vector<std::string> tokens = tokenize(input.substr(pos1, pos2 - pos1), ",");
-            if (!Convert::FromString(&this->value_vector2_.x, tokens[0], defvalue.x))
+            if (!ConvertValue(&this->value_vector2_.x, tokens[0]))
             {
                 this->value_vector2_ = defvalue;
                 return false;
             }
-            if (!Convert::FromString(&this->value_vector2_.y, tokens[1], defvalue.y))
+            if (!ConvertValue(&this->value_vector2_.y, tokens[1]))
             {
                 this->value_vector2_ = defvalue;
@@ -583,15 +583,15 @@
         {
             std::vector<std::string> tokens = tokenize(input.substr(pos1, pos2 - pos1), ",");
-            if (!Convert::FromString(&this->value_vector3_.x, tokens[0], defvalue.x))
+            if (!ConvertValue(&this->value_vector3_.x, tokens[0]))
             {
                 this->value_vector3_ = defvalue;
                 return false;
             }
-            if (!Convert::FromString(&this->value_vector3_.y, tokens[1], defvalue.y))
+            if (!ConvertValue(&this->value_vector3_.y, tokens[1]))
             {
                 this->value_vector3_ = defvalue;
                 return false;
             }
-            if (!Convert::FromString(&this->value_vector3_.z, tokens[2], defvalue.z))
+            if (!ConvertValue(&this->value_vector3_.z, tokens[2]))
             {
                 this->value_vector3_ = defvalue;
@@ -622,20 +622,20 @@
         {
             std::vector<std::string> tokens = tokenize(input.substr(pos1, pos2 - pos1), ",");
-            if (!Convert::FromString(&this->value_colourvalue_.r, tokens[0], defvalue.r))
+            if (!ConvertValue(&this->value_colourvalue_.r, tokens[0]))
             {
                 this->value_colourvalue_ = defvalue;
                 return false;
             }
-            if (!Convert::FromString(&this->value_colourvalue_.g, tokens[1], defvalue.g))
+            if (!ConvertValue(&this->value_colourvalue_.g, tokens[1]))
             {
                 this->value_colourvalue_ = defvalue;
                 return false;
             }
-            if (!Convert::FromString(&this->value_colourvalue_.b, tokens[2], defvalue.b))
+            if (!ConvertValue(&this->value_colourvalue_.b, tokens[2]))
             {
                 this->value_colourvalue_ = defvalue;
                 return false;
             }
-            if (!Convert::FromString(&this->value_colourvalue_.a, tokens[3], defvalue.a))
+            if (!ConvertValue(&this->value_colourvalue_.a, tokens[3]))
             {
                 this->value_colourvalue_ = defvalue;
Index: code/branches/FICN/src/orxonox/core/ConfigValueContainer.h
===================================================================
--- code/branches/FICN/src/orxonox/core/ConfigValueContainer.h	(revision 725)
+++ code/branches/FICN/src/orxonox/core/ConfigValueContainer.h	(revision 726)
@@ -124,9 +124,9 @@
             inline ConfigValueContainer& getValue(const char* value)                    { value = this->value_string_.c_str(); return *this; }
             /** @returns the value. @param value This is only needed to determine the right type. */
-            inline ConfigValueContainer& getValue(Vector2& value)                 { value = this->value_vector2_; return *this; }
+            inline ConfigValueContainer& getValue(Vector2& value)                       { value = this->value_vector2_; return *this; }
             /** @returns the value. @param value This is only needed to determine the right type. */
-            inline ConfigValueContainer& getValue(Vector3& value)                 { value = this->value_vector3_; return *this; }
+            inline ConfigValueContainer& getValue(Vector3& value)                       { value = this->value_vector3_; return *this; }
             /** @returns the value. @param value This is only needed to determine the right type. */
-            inline ConfigValueContainer& getValue(ColourValue& value)             { value = this->value_colourvalue_; return *this; }
+            inline ConfigValueContainer& getValue(ColourValue& value)                   { value = this->value_colourvalue_; return *this; }
 
             void description(const std::string& description);
