[Orxonox-commit 4551] r9222 - in code/branches/testing/src/libraries: core core/command tools util

landauf at orxonox.net landauf at orxonox.net
Sat May 19 11:27:08 CEST 2012


Author: landauf
Date: 2012-05-19 11:27:07 +0200 (Sat, 19 May 2012)
New Revision: 9222

Modified:
   code/branches/testing/src/libraries/core/CommandLineParser.cc
   code/branches/testing/src/libraries/core/CommandLineParser.h
   code/branches/testing/src/libraries/core/ConfigValueContainer.cc
   code/branches/testing/src/libraries/core/command/CommandEvaluation.cc
   code/branches/testing/src/libraries/core/command/CommandExecutor.cc
   code/branches/testing/src/libraries/core/command/Executor.cc
   code/branches/testing/src/libraries/core/command/Executor.h
   code/branches/testing/src/libraries/core/command/Functor.h
   code/branches/testing/src/libraries/tools/Shader.cc
   code/branches/testing/src/libraries/tools/Shader.h
   code/branches/testing/src/libraries/util/MultiType.cc
   code/branches/testing/src/libraries/util/MultiType.h
   code/branches/testing/src/libraries/util/MultiTypeValue.h
Log:
renamed MT_Value as MultiType::Type and removed it from the public interface of MultiType
added MultiType::Null

Modified: code/branches/testing/src/libraries/core/CommandLineParser.cc
===================================================================
--- code/branches/testing/src/libraries/core/CommandLineParser.cc	2012-05-18 21:17:31 UTC (rev 9221)
+++ code/branches/testing/src/libraries/core/CommandLineParser.cc	2012-05-19 09:27:07 UTC (rev 9222)
@@ -49,7 +49,7 @@
     */
     void CommandLineArgument::parse(const std::string& value)
     {
-        if (value_.getType() == MT_Type::Bool)
+        if (value_.isType<bool>())
         {
             // simulate command line switch
             bool temp;
@@ -297,10 +297,10 @@
             else
                 infoStr << "      ";
             infoStr << "--" << it->second->getName() << ' ';
-            if (it->second->getValue().getType() != MT_Type::Bool)
+            if (it->second->getValue().isType<bool>())
+                infoStr << "    ";
+            else
                 infoStr << "ARG ";
-            else
-                infoStr << "    ";
             // fill with the necessary amount of blanks
             infoStr << std::string(maxNameSize - it->second->getName().size(), ' ');
             infoStr << ": " << it->second->getInformation();

Modified: code/branches/testing/src/libraries/core/CommandLineParser.h
===================================================================
--- code/branches/testing/src/libraries/core/CommandLineParser.h	2012-05-18 21:17:31 UTC (rev 9221)
+++ code/branches/testing/src/libraries/core/CommandLineParser.h	2012-05-19 09:27:07 UTC (rev 9222)
@@ -216,7 +216,7 @@
     {
         OrxAssert(!_getInstance().existsArgument(name),
             "Cannot add a command line argument with name '" + name + "' twice.");
-        OrxAssert(MultiType(defaultValue).getType() != MT_Type::Bool || MultiType(defaultValue).getBool() != true,
+        OrxAssert(!MultiType(defaultValue).isType<bool>() || MultiType(defaultValue).getBool() != true,
                "Boolean command line arguments with positive default values are not supported." << endl
             << "Please use SetCommandLineSwitch and adjust your argument: " << name);
 

Modified: code/branches/testing/src/libraries/core/ConfigValueContainer.cc
===================================================================
--- code/branches/testing/src/libraries/core/ConfigValueContainer.cc	2012-05-18 21:17:31 UTC (rev 9221)
+++ code/branches/testing/src/libraries/core/ConfigValueContainer.cc	2012-05-19 09:27:07 UTC (rev 9222)
@@ -82,7 +82,7 @@
 
         for (unsigned int i = 0; i < this->valueVector_.size(); i++)
         {
-            ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_Type::String));
+            ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType<std::string>());
             this->defvalueStringVector_.push_back(this->valueVector_[i]);
         }
 
@@ -117,7 +117,7 @@
         {
             if (this->tset(input))
             {
-                ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, input, this->value_.isType(MT_Type::String));
+                ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, input, this->value_.isType<std::string>());
                 return true;
             }
         }
@@ -136,7 +136,7 @@
         {
             if (this->tset(index, input))
             {
-                ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, index, input, this->value_.isType(MT_Type::String));
+                ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, index, input, this->value_.isType<std::string>());
                 return true;
             }
         }
@@ -235,7 +235,7 @@
                 // Erase the entry from the vector, change (shift) all entries beginning with index in the config file, remove the last entry from the file
                 this->valueVector_.erase(this->valueVector_.begin() + index);
                 for (unsigned int i = index; i < this->valueVector_.size(); i++)
-                    ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_Type::String));
+                    ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType<std::string>());
                 ConfigFileManager::getInstance().getConfigFile(this->type_)->deleteVectorEntries(this->sectionname_, this->varname_, this->valueVector_.size());
 
                 return true;
@@ -271,7 +271,7 @@
     void ConfigValueContainer::update()
     {
         if (!this->bIsVector_)
-            this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, this->defvalueString_, this->value_.isType(MT_Type::String));
+            this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, this->defvalueString_, this->value_.isType<std::string>());
         else
         {
             this->valueVector_.clear();
@@ -280,11 +280,11 @@
             {
                 if (i < this->defvalueStringVector_.size())
                 {
-                    this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isType(MT_Type::String));
+                    this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isType<std::string>());
                 }
                 else
                 {
-                    this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, MultiType(), this->value_.isType(MT_Type::String));
+                    this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, MultiType(), this->value_.isType<std::string>());
                 }
 
                 this->valueVector_.push_back(this->value_);

Modified: code/branches/testing/src/libraries/core/command/CommandEvaluation.cc
===================================================================
--- code/branches/testing/src/libraries/core/command/CommandEvaluation.cc	2012-05-18 21:17:31 UTC (rev 9221)
+++ code/branches/testing/src/libraries/core/command/CommandEvaluation.cc	2012-05-19 09:27:07 UTC (rev 9222)
@@ -118,7 +118,7 @@
     /**
         @brief Executes the command which was evaluated by this object and returns its return-value.
         @param error A pointer to an integer (or NULL) which will be used to write error codes to (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
-        @return Returns the result of the command (or MT_Type::Null if there is no return value)
+        @return Returns the result of the command (or MultiType::Null if there is no return value)
     */
     MultiType CommandEvaluation::query(int* error)
     {
@@ -137,7 +137,7 @@
                 *error = CommandExecutor::Denied;
 
             if (*error != CommandExecutor::Success)
-                return MT_Type::Null;
+                return MultiType::Null;
         }
 
         // check if it's possible to execute the command
@@ -169,7 +169,7 @@
         }
 
         // return a null value in case of an error
-        return MT_Type::Null;
+        return MultiType::Null;
     }
 
     /**
@@ -224,7 +224,7 @@
         if (index < MAX_FUNCTOR_ARGUMENTS)
             return this->arguments_[index];
 
-        return MT_Type::Null;
+        return MultiType::Null;
     }
 
     /**

Modified: code/branches/testing/src/libraries/core/command/CommandExecutor.cc
===================================================================
--- code/branches/testing/src/libraries/core/command/CommandExecutor.cc	2012-05-18 21:17:31 UTC (rev 9221)
+++ code/branches/testing/src/libraries/core/command/CommandExecutor.cc	2012-05-19 09:27:07 UTC (rev 9222)
@@ -82,7 +82,7 @@
         @param command A string containing the command
         @param error A pointer to a value (or NULL) where the error-code should be written to (see @ref CommandExecutorErrorCodes "error codes")
         @param useTcl If true, the command is passed to tcl (see TclBind)
-        @return Returns the return-value of the command (if any - MT_Type::Null otherwise)
+        @return Returns the return-value of the command (if any - MultiType::Null otherwise)
     */
     /* static */ MultiType CommandExecutor::queryMT(const std::string& command, int* error, bool useTcl)
     {

Modified: code/branches/testing/src/libraries/core/command/Executor.cc
===================================================================
--- code/branches/testing/src/libraries/core/command/Executor.cc	2012-05-18 21:17:31 UTC (rev 9221)
+++ code/branches/testing/src/libraries/core/command/Executor.cc	2012-05-19 09:27:07 UTC (rev 9222)
@@ -78,7 +78,7 @@
         @param error A pointer to a variable (or NULL) that is used to store the error code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
         @param delimiter The delimiter that is used to separate the arguments in the string @a arguments
         @param bPrintError If true, errors are printed to the console if the function couldn't be executed with the given arguments
-        @return Returns the return value of the function (or MT_Type::Null if there is no return value)
+        @return Returns the return value of the function (or MultiType::Null if there is no return value)
     */
     MultiType Executor::parse(const std::string& arguments, int* error, const std::string& delimiter, bool bPrintError) const
     {
@@ -91,7 +91,7 @@
         @param error A pointer to a variable (or NULL) that is used to store the error code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
         @param delimiter The delimiter that was used to separate the arguments in the SubString @a arguments (used to join the surplus arguments)
         @param bPrintError If true, errors are printed to the console if the function couldn't be executed with the given arguments
-        @return Returns the return value of the function (or MT_Type::Null if there is no return value)
+        @return Returns the return value of the function (or MultiType::Null if there is no return value)
     */
     MultiType Executor::parse(const SubString& arguments, int* error, const std::string& delimiter, bool bPrintError) const
     {
@@ -104,7 +104,7 @@
         {
             if (bPrintError)
                 orxout(internal_warning) << "Can't call executor " << this->name_ << " through parser: Not enough arguments or default values given (input: " << arguments.join() << ")." << endl;
-            return MT_Type::Null;
+            return MultiType::Null;
         }
 
         orxout(verbose, context::misc::executor) << "Executor::parse: \"" << arguments.join(delimiter) << "\" -> " << argCount << " arguments: " << arg[0] << " / " << arg[1] << " / " << arg[2] << " / " << arg[3] << " / " << arg[4] << endl;

Modified: code/branches/testing/src/libraries/core/command/Executor.h
===================================================================
--- code/branches/testing/src/libraries/core/command/Executor.h	2012-05-18 21:17:31 UTC (rev 9221)
+++ code/branches/testing/src/libraries/core/command/Executor.h	2012-05-19 09:27:07 UTC (rev 9222)
@@ -168,7 +168,7 @@
                 if (index < MAX_FUNCTOR_ARGUMENTS)
                     return this->defaultValue_[index];
 
-                return MT_Type::Null;
+                return MultiType::Null;
             }
 
             bool allDefaultValuesSet() const;

Modified: code/branches/testing/src/libraries/core/command/Functor.h
===================================================================
--- code/branches/testing/src/libraries/core/command/Functor.h	2012-05-18 21:17:31 UTC (rev 9221)
+++ code/branches/testing/src/libraries/core/command/Functor.h	2012-05-19 09:27:07 UTC (rev 9222)
@@ -188,8 +188,8 @@
         public:
             virtual ~Functor() {}
 
-            /// Calls the function-pointer with up to five arguments. In case of a member-function, the assigned object-pointer is used to call the function. @return Returns the return-value of the function (if any; MT_Type::Null otherwise)
-            virtual MultiType operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
+            /// Calls the function-pointer with up to five arguments. In case of a member-function, the assigned object-pointer is used to call the function. @return Returns the return-value of the function (if any; MultiType::Null otherwise)
+            virtual MultiType operator()(const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null) = 0;
 
             /// Creates a new instance of Functor with the same values like this (used instead of a copy-constructor)
             virtual FunctorPtr clone() = 0;
@@ -244,11 +244,11 @@
             FunctorMember(O* object = 0) : object_(object), bSafeMode_(false) {}
             virtual ~FunctorMember() { if (this->bSafeMode_) { this->unregisterObject(this->object_); } }
 
-            /// Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be NULL. @return Returns the return-value of the function (if any; MT_Type::Null otherwise)
-            virtual MultiType operator()(O* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
+            /// Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be NULL. @return Returns the return-value of the function (if any; MultiType::Null otherwise)
+            virtual MultiType operator()(O* object, const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null) = 0;
 
             // see Functor::operator()()
-            MultiType operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null)
+            MultiType operator()(const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null)
             {
                 // call the function if an object was assigned
                 if (this->object_)
@@ -256,7 +256,7 @@
                 else
                 {
                     orxout(internal_error) << "Can't execute FunctorMember, no object set." << endl;
-                    return MT_Type::Null;
+                    return MultiType::Null;
                 }
             }
 
@@ -323,11 +323,11 @@
             /// Constructor: Stores the object-pointer.
             FunctorMember(void* object = 0) {}
 
-            /// Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be NULL. @return Returns the return-value of the function (if any; MT_Type::Null otherwise)
-            virtual MultiType operator()(void* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
+            /// Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be NULL. @return Returns the return-value of the function (if any; MultiType::Null otherwise)
+            virtual MultiType operator()(void* object, const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null) = 0;
 
             // see Functor::operator()()
-            MultiType operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null)
+            MultiType operator()(const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null)
             {
                 return (*this)((void*)0, param1, param2, param3, param4, param5);
             }
@@ -415,24 +415,24 @@
         template <class R, class O, bool isconst, class P1, class P2>                               struct FunctorCaller<R, O, isconst, P1, P2, void, void, void>     { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType&, const MultiType&, const MultiType&) { return (object->*functionPointer)(param1, param2); } };
         template <class R, class O, bool isconst, class P1>                                         struct FunctorCaller<R, O, isconst, P1, void, void, void, void>   { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { return (object->*functionPointer)(param1); } };
         template <class R, class O, bool isconst>                                                   struct FunctorCaller<R, O, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, void, void, void, void, void>::Type functionPointer, O* object, const MultiType&, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { return (object->*functionPointer)(); } };
-        template <class O, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller<void, O, isconst, P1, P2, P3, P4, P5>           { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, P4, P5>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(param1, param2, param3, param4, param5); return MT_Type::Null; } };
-        template <class O, bool isconst, class P1, class P2, class P3, class P4>           struct FunctorCaller<void, O, isconst, P1, P2, P3, P4, void>         { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, P4, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType&) { (object->*functionPointer)(param1, param2, param3, param4); return MT_Type::Null; } };
-        template <class O, bool isconst, class P1, class P2, class P3>                     struct FunctorCaller<void, O, isconst, P1, P2, P3, void, void>       { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType&, const MultiType&) { (object->*functionPointer)(param1, param2, param3); return MT_Type::Null; } };
-        template <class O, bool isconst, class P1, class P2>                               struct FunctorCaller<void, O, isconst, P1, P2, void, void, void>     { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType&, const MultiType&, const MultiType&) { (object->*functionPointer)(param1, param2); return MT_Type::Null; } };
-        template <class O, bool isconst, class P1>                                         struct FunctorCaller<void, O, isconst, P1, void, void, void, void>   { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (object->*functionPointer)(param1); return MT_Type::Null; } };
-        template <class O, bool isconst>                                                   struct FunctorCaller<void, O, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, void, void, void, void, void>::Type functionPointer, O* object, const MultiType&, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (object->*functionPointer)(); return MT_Type::Null; } };
+        template <class O, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller<void, O, isconst, P1, P2, P3, P4, P5>           { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, P4, P5>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(param1, param2, param3, param4, param5); return MultiType::Null; } };
+        template <class O, bool isconst, class P1, class P2, class P3, class P4>           struct FunctorCaller<void, O, isconst, P1, P2, P3, P4, void>         { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, P4, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType&) { (object->*functionPointer)(param1, param2, param3, param4); return MultiType::Null; } };
+        template <class O, bool isconst, class P1, class P2, class P3>                     struct FunctorCaller<void, O, isconst, P1, P2, P3, void, void>       { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType&, const MultiType&) { (object->*functionPointer)(param1, param2, param3); return MultiType::Null; } };
+        template <class O, bool isconst, class P1, class P2>                               struct FunctorCaller<void, O, isconst, P1, P2, void, void, void>     { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType&, const MultiType&, const MultiType&) { (object->*functionPointer)(param1, param2); return MultiType::Null; } };
+        template <class O, bool isconst, class P1>                                         struct FunctorCaller<void, O, isconst, P1, void, void, void, void>   { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (object->*functionPointer)(param1); return MultiType::Null; } };
+        template <class O, bool isconst>                                                   struct FunctorCaller<void, O, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, void, void, void, void, void>::Type functionPointer, O* object, const MultiType&, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (object->*functionPointer)(); return MultiType::Null; } };
         template <class R, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller<R, void, isconst, P1, P2, P3, P4, P5>           { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, P3, P4, P5>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (*functionPointer)(param1, param2, param3, param4, param5); } };
         template <class R, bool isconst, class P1, class P2, class P3, class P4>           struct FunctorCaller<R, void, isconst, P1, P2, P3, P4, void>         { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, P3, P4, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType&) { return (*functionPointer)(param1, param2, param3, param4); } };
         template <class R, bool isconst, class P1, class P2, class P3>                     struct FunctorCaller<R, void, isconst, P1, P2, P3, void, void>       { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, P3, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType&, const MultiType&) { return (*functionPointer)(param1, param2, param3); } };
         template <class R, bool isconst, class P1, class P2>                               struct FunctorCaller<R, void, isconst, P1, P2, void, void, void>     { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType&, const MultiType&, const MultiType&) { return (*functionPointer)(param1, param2); } };
         template <class R, bool isconst, class P1>                                         struct FunctorCaller<R, void, isconst, P1, void, void, void, void>   { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { return (*functionPointer)(param1); } };
         template <class R, bool isconst>                                                   struct FunctorCaller<R, void, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, void, void, void, void, void>::Type functionPointer, void*, const MultiType&, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { return (*functionPointer)(); } };
-        template <bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller<void, void, isconst, P1, P2, P3, P4, P5>           { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, P4, P5>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(param1, param2, param3, param4, param5); return MT_Type::Null; } };
-        template <bool isconst, class P1, class P2, class P3, class P4>           struct FunctorCaller<void, void, isconst, P1, P2, P3, P4, void>         { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, P4, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType&) { (*functionPointer)(param1, param2, param3, param4); return MT_Type::Null; } };
-        template <bool isconst, class P1, class P2, class P3>                     struct FunctorCaller<void, void, isconst, P1, P2, P3, void, void>       { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType&, const MultiType&) { (*functionPointer)(param1, param2, param3); return MT_Type::Null; } };
-        template <bool isconst, class P1, class P2>                               struct FunctorCaller<void, void, isconst, P1, P2, void, void, void>     { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType&, const MultiType&, const MultiType&) { (*functionPointer)(param1, param2); return MT_Type::Null; } };
-        template <bool isconst, class P1>                                         struct FunctorCaller<void, void, isconst, P1, void, void, void, void>   { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (*functionPointer)(param1); return MT_Type::Null; } };
-        template <bool isconst>                                                   struct FunctorCaller<void, void, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, void, void, void, void, void>::Type functionPointer, void*, const MultiType&, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (*functionPointer)(); return MT_Type::Null; } };
+        template <bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller<void, void, isconst, P1, P2, P3, P4, P5>           { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, P4, P5>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(param1, param2, param3, param4, param5); return MultiType::Null; } };
+        template <bool isconst, class P1, class P2, class P3, class P4>           struct FunctorCaller<void, void, isconst, P1, P2, P3, P4, void>         { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, P4, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType&) { (*functionPointer)(param1, param2, param3, param4); return MultiType::Null; } };
+        template <bool isconst, class P1, class P2, class P3>                     struct FunctorCaller<void, void, isconst, P1, P2, P3, void, void>       { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType&, const MultiType&) { (*functionPointer)(param1, param2, param3); return MultiType::Null; } };
+        template <bool isconst, class P1, class P2>                               struct FunctorCaller<void, void, isconst, P1, P2, void, void, void>     { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType&, const MultiType&, const MultiType&) { (*functionPointer)(param1, param2); return MultiType::Null; } };
+        template <bool isconst, class P1>                                         struct FunctorCaller<void, void, isconst, P1, void, void, void, void>   { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (*functionPointer)(param1); return MultiType::Null; } };
+        template <bool isconst>                                                   struct FunctorCaller<void, void, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, void, void, void, void, void>::Type functionPointer, void*, const MultiType&, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (*functionPointer)(); return MultiType::Null; } };
 
         // Helper class, used to identify the header of a function-pointer (independent of its class)
         template <class R, class P1, class P2, class P3, class P4, class P5>
@@ -496,7 +496,7 @@
             FunctorTemplate(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type functionPointer, O* object = 0) : FunctorPointer<typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type, O>(functionPointer, object) {}
 
             // see FunctorMember::operator()()
-            MultiType operator()(O* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null)
+            MultiType operator()(O* object, const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null)
             {
                 return detail::FunctorCaller<R, O, isconst, P1, P2, P3, P4, P5>::call(this->functionPointer_, object, param1, param2, param3, param4, param5);
             }

Modified: code/branches/testing/src/libraries/tools/Shader.cc
===================================================================
--- code/branches/testing/src/libraries/tools/Shader.cc	2012-05-18 21:17:31 UTC (rev 9221)
+++ code/branches/testing/src/libraries/tools/Shader.cc	2012-05-19 09:27:07 UTC (rev 9222)
@@ -160,7 +160,7 @@
     */
     void Shader::setParameter(size_t technique, size_t pass, const std::string& parameter, int value)
     {
-        ParameterContainer container = {technique, pass, parameter, value, 0.0f, MT_Type::Int};
+        ParameterContainer container = {technique, pass, parameter, value};
         this->parameters_.push_back(container);
         this->addAsListener();
     }
@@ -170,7 +170,7 @@
     */
     void Shader::setParameter(size_t technique, size_t pass, const std::string& parameter, float value)
     {
-        ParameterContainer container = {technique, pass, parameter, 0, value, MT_Type::Float};
+        ParameterContainer container = {technique, pass, parameter, value};
         this->parameters_.push_back(container);
         this->addAsListener();
     }
@@ -203,17 +203,10 @@
                 if (passPtr)
                 {
                     // change the value of the parameter depending on its type
-                    switch (it->valueType_)
-                    {
-                        case MT_Type::Int:
-                            passPtr->getFragmentProgramParameters()->setNamedConstant(it->parameter_, it->valueInt_);
-                            break;
-                        case MT_Type::Float:
-                            passPtr->getFragmentProgramParameters()->setNamedConstant(it->parameter_, it->valueFloat_);
-                            break;
-                        default:
-                            break;
-                    }
+                    if (it->value_.isType<int>())
+                        passPtr->getFragmentProgramParameters()->setNamedConstant(it->parameter_, it->value_.getInt());
+                    else if (it->value_.isType<float>())
+                        passPtr->getFragmentProgramParameters()->setNamedConstant(it->parameter_, it->value_.getFloat());
                 }
                 else
                     orxout(internal_warning) << "No pass " << it->pass_ << " in technique " << it->technique_ << " in compositor \"" << this->compositorName_ << "\" or pass has no shader." << endl;

Modified: code/branches/testing/src/libraries/tools/Shader.h
===================================================================
--- code/branches/testing/src/libraries/tools/Shader.h	2012-05-18 21:17:31 UTC (rev 9221)
+++ code/branches/testing/src/libraries/tools/Shader.h	2012-05-19 09:27:07 UTC (rev 9222)
@@ -113,10 +113,7 @@
                 size_t pass_;               ///< The ID of the pass
                 std::string parameter_;     ///< The name of the parameter
 
-                int valueInt_;              ///< The desired int value of the parameter
-                float valueFloat_;          ///< The desired float value of the parameter
-
-                MT_Type::Value valueType_;  ///< The type of the parameter (currently only int or float)
+                MultiType value_;           ///< The desired value of the parameter
             };
 
             std::list<ParameterContainer> parameters_;  ///< The list of parameters that should be set on the next update

Modified: code/branches/testing/src/libraries/util/MultiType.cc
===================================================================
--- code/branches/testing/src/libraries/util/MultiType.cc	2012-05-18 21:17:31 UTC (rev 9221)
+++ code/branches/testing/src/libraries/util/MultiType.cc	2012-05-19 09:27:07 UTC (rev 9222)
@@ -36,61 +36,63 @@
 
 namespace orxonox
 {
+    const MultiType MultiType::Null;
+
     /**
         @brief Converts the current value of the MultiType to a new type.
         @param type The type
     */
-    bool MultiType::convert(MT_Type::Value type)
+    bool MultiType::convert(Type::Enum type)
     {
         switch (type)
         {
-            case MT_Type::Null:
+            case Type::Null:
                 this->reset(); return true;
-            case MT_Type::Char:
+            case Type::Char:
                 return this->convert<char>(); break;
-            case MT_Type::UnsignedChar:
+            case Type::UnsignedChar:
                 return this->convert<unsigned char>(); break;
-            case MT_Type::Short:
+            case Type::Short:
                 return this->convert<short>(); break;
-            case MT_Type::UnsignedShort:
+            case Type::UnsignedShort:
                 return this->convert<unsigned short>(); break;
-            case MT_Type::Int:
+            case Type::Int:
                 return this->convert<int>(); break;
-            case MT_Type::UnsignedInt:
+            case Type::UnsignedInt:
                 return this->convert<unsigned int>(); break;
-            case MT_Type::Long:
+            case Type::Long:
                 return this->convert<long>(); break;
-            case MT_Type::UnsignedLong:
+            case Type::UnsignedLong:
                 return this->convert<unsigned long>(); break;
-            case MT_Type::LongLong:
+            case Type::LongLong:
                 return this->convert<long long>(); break;
-            case MT_Type::UnsignedLongLong:
+            case Type::UnsignedLongLong:
                 return this->convert<unsigned long long>(); break;
-            case MT_Type::Float:
+            case Type::Float:
                 return this->convert<float>(); break;
-            case MT_Type::Double:
+            case Type::Double:
                 return this->convert<double>(); break;
-            case MT_Type::LongDouble:
+            case Type::LongDouble:
                 return this->convert<long double>(); break;
-            case MT_Type::Bool:
+            case Type::Bool:
                 return this->convert<bool>(); break;
-            case MT_Type::VoidPointer:
+            case Type::VoidPointer:
                 return this->convert<void*>(); break;
-            case MT_Type::String:
+            case Type::String:
                 return this->convert<std::string>(); break;
-            case MT_Type::Vector2:
+            case Type::Vector2:
                 return this->convert<orxonox::Vector2>(); break;
-            case MT_Type::Vector3:
+            case Type::Vector3:
                 return this->convert<orxonox::Vector3>(); break;
-            case MT_Type::Vector4:
+            case Type::Vector4:
                 return this->convert<orxonox::Vector4>(); break;
-            case MT_Type::ColourValue:
+            case Type::ColourValue:
                 return this->convert<orxonox::ColourValue>(); break;
-            case MT_Type::Quaternion:
+            case Type::Quaternion:
                 return this->convert<orxonox::Quaternion>(); break;
-            case MT_Type::Radian:
+            case Type::Radian:
                 return this->convert<orxonox::Radian>(); break;
-            case MT_Type::Degree:
+            case Type::Degree:
                 return this->convert<orxonox::Degree>(); break;
             default:
                 this->reset(); return false; break;
@@ -103,106 +105,106 @@
     */
     std::string MultiType::getTypename() const
     {
-        MT_Type::Value type = (this->value_) ? this->value_->type_ : MT_Type::Null;
+        Type::Enum type = (this->value_) ? this->value_->type_ : Type::Null;
 
         switch (type)
         {
-            case MT_Type::Char:
+            case Type::Char:
                 return "char"; break;
-            case MT_Type::UnsignedChar:
+            case Type::UnsignedChar:
                 return "unsigned char"; break;
-            case MT_Type::Short:
+            case Type::Short:
                 return "short"; break;
-            case MT_Type::UnsignedShort:
+            case Type::UnsignedShort:
                 return "unsigned short"; break;
-            case MT_Type::Int:
+            case Type::Int:
                 return "int"; break;
-            case MT_Type::UnsignedInt:
+            case Type::UnsignedInt:
                 return "unsigned int"; break;
-            case MT_Type::Long:
+            case Type::Long:
                 return "long"; break;
-            case MT_Type::UnsignedLong:
+            case Type::UnsignedLong:
                 return "unsigned long"; break;
-            case MT_Type::LongLong:
+            case Type::LongLong:
                 return "long long"; break;
-            case MT_Type::UnsignedLongLong:
+            case Type::UnsignedLongLong:
                 return "unsigned long long"; break;
-            case MT_Type::Float:
+            case Type::Float:
                 return "float"; break;
-            case MT_Type::Double:
+            case Type::Double:
                 return "double"; break;
-            case MT_Type::LongDouble:
+            case Type::LongDouble:
                 return "long double"; break;
-            case MT_Type::Bool:
+            case Type::Bool:
                 return "bool"; break;
-            case MT_Type::VoidPointer:
+            case Type::VoidPointer:
                 return "void*"; break;
-            case MT_Type::String:
+            case Type::String:
                 return "std::string"; break;
-            case MT_Type::Vector2:
+            case Type::Vector2:
                 return "orxonox::Vector2"; break;
-            case MT_Type::Vector3:
+            case Type::Vector3:
                 return "orxonox::Vector3"; break;
-            case MT_Type::Vector4:
+            case Type::Vector4:
                 return "orxonox::Vector4"; break;
-            case MT_Type::ColourValue:
+            case Type::ColourValue:
                 return "orxonox::ColourValue"; break;
-            case MT_Type::Quaternion:
+            case Type::Quaternion:
                 return "orxonox::Quaternion"; break;
-            case MT_Type::Radian:
+            case Type::Radian:
                 return "orxonox::Radian"; break;
-            case MT_Type::Degree:
+            case Type::Degree:
                 return "orxonox::Degree"; break;
             default:
                 return "unknown"; break;
         };
     }
 
-    MultiType::operator char()                 const { return (this->value_) ? ((this->value_->type_ == MT_Type::Char            ) ? (static_cast<MT_Value<char>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator unsigned char()        const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedChar    ) ? (static_cast<MT_Value<unsigned char>       *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator short()                const { return (this->value_) ? ((this->value_->type_ == MT_Type::Short           ) ? (static_cast<MT_Value<short>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator unsigned short()       const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedShort   ) ? (static_cast<MT_Value<unsigned short>      *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator int()                  const { return (this->value_) ? ((this->value_->type_ == MT_Type::Int             ) ? (static_cast<MT_Value<int>                 *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator unsigned int()         const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedInt     ) ? (static_cast<MT_Value<unsigned int>        *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator long()                 const { return (this->value_) ? ((this->value_->type_ == MT_Type::Long            ) ? (static_cast<MT_Value<long>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator unsigned long()        const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedLong    ) ? (static_cast<MT_Value<unsigned long>       *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator long long()            const { return (this->value_) ? ((this->value_->type_ == MT_Type::LongLong        ) ? (static_cast<MT_Value<long long>           *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator unsigned long long()   const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedLongLong) ? (static_cast<MT_Value<unsigned long long>  *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator float()                const { return (this->value_) ? ((this->value_->type_ == MT_Type::Float           ) ? (static_cast<MT_Value<float>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator double()               const { return (this->value_) ? ((this->value_->type_ == MT_Type::Double          ) ? (static_cast<MT_Value<double>              *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator long double()          const { return (this->value_) ? ((this->value_->type_ == MT_Type::LongDouble      ) ? (static_cast<MT_Value<long double>         *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator bool()                 const { return (this->value_) ? ((this->value_->type_ == MT_Type::Bool            ) ? (static_cast<MT_Value<bool>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator void*()                const { return (this->value_) ? ((this->value_->type_ == MT_Type::VoidPointer     ) ? (static_cast<MT_Value<void*>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator std::string()          const { return (this->value_) ? ((this->value_->type_ == MT_Type::String          ) ? (static_cast<MT_Value<std::string>         *>(this->value_))->value_ : (*this->value_)) : NilValue<std::string>();          } ///< Returns the current value, converted to the requested type.
-    MultiType::operator orxonox::Vector2()     const { return (this->value_) ? ((this->value_->type_ == MT_Type::Vector2         ) ? (static_cast<MT_Value<orxonox::Vector2>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector2>();     } ///< Returns the current value, converted to the requested type.
-    MultiType::operator orxonox::Vector3()     const { return (this->value_) ? ((this->value_->type_ == MT_Type::Vector3         ) ? (static_cast<MT_Value<orxonox::Vector3>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector3>();     } ///< Returns the current value, converted to the requested type.
-    MultiType::operator orxonox::Vector4()     const { return (this->value_) ? ((this->value_->type_ == MT_Type::Vector4         ) ? (static_cast<MT_Value<orxonox::Vector4>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector4>();     } ///< Returns the current value, converted to the requested type.
-    MultiType::operator orxonox::ColourValue() const { return (this->value_) ? ((this->value_->type_ == MT_Type::ColourValue     ) ? (static_cast<MT_Value<orxonox::ColourValue>*>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::ColourValue>(); } ///< Returns the current value, converted to the requested type.
-    MultiType::operator orxonox::Quaternion()  const { return (this->value_) ? ((this->value_->type_ == MT_Type::Quaternion      ) ? (static_cast<MT_Value<orxonox::Quaternion> *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Quaternion>();  } ///< Returns the current value, converted to the requested type.
-    MultiType::operator orxonox::Radian()      const { return (this->value_) ? ((this->value_->type_ == MT_Type::Radian          ) ? (static_cast<MT_Value<orxonox::Radian>     *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Radian>();      } ///< Returns the current value, converted to the requested type.
-    MultiType::operator orxonox::Degree()      const { return (this->value_) ? ((this->value_->type_ == MT_Type::Degree          ) ? (static_cast<MT_Value<orxonox::Degree>     *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Degree>();      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator char()                 const { return (this->value_) ? ((this->value_->type_ == Type::Char            ) ? (static_cast<MT_Value<char>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator unsigned char()        const { return (this->value_) ? ((this->value_->type_ == Type::UnsignedChar    ) ? (static_cast<MT_Value<unsigned char>       *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator short()                const { return (this->value_) ? ((this->value_->type_ == Type::Short           ) ? (static_cast<MT_Value<short>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator unsigned short()       const { return (this->value_) ? ((this->value_->type_ == Type::UnsignedShort   ) ? (static_cast<MT_Value<unsigned short>      *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator int()                  const { return (this->value_) ? ((this->value_->type_ == Type::Int             ) ? (static_cast<MT_Value<int>                 *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator unsigned int()         const { return (this->value_) ? ((this->value_->type_ == Type::UnsignedInt     ) ? (static_cast<MT_Value<unsigned int>        *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator long()                 const { return (this->value_) ? ((this->value_->type_ == Type::Long            ) ? (static_cast<MT_Value<long>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator unsigned long()        const { return (this->value_) ? ((this->value_->type_ == Type::UnsignedLong    ) ? (static_cast<MT_Value<unsigned long>       *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator long long()            const { return (this->value_) ? ((this->value_->type_ == Type::LongLong        ) ? (static_cast<MT_Value<long long>           *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator unsigned long long()   const { return (this->value_) ? ((this->value_->type_ == Type::UnsignedLongLong) ? (static_cast<MT_Value<unsigned long long>  *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator float()                const { return (this->value_) ? ((this->value_->type_ == Type::Float           ) ? (static_cast<MT_Value<float>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator double()               const { return (this->value_) ? ((this->value_->type_ == Type::Double          ) ? (static_cast<MT_Value<double>              *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator long double()          const { return (this->value_) ? ((this->value_->type_ == Type::LongDouble      ) ? (static_cast<MT_Value<long double>         *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator bool()                 const { return (this->value_) ? ((this->value_->type_ == Type::Bool            ) ? (static_cast<MT_Value<bool>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator void*()                const { return (this->value_) ? ((this->value_->type_ == Type::VoidPointer     ) ? (static_cast<MT_Value<void*>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator std::string()          const { return (this->value_) ? ((this->value_->type_ == Type::String          ) ? (static_cast<MT_Value<std::string>         *>(this->value_))->value_ : (*this->value_)) : NilValue<std::string>();          } ///< Returns the current value, converted to the requested type.
+    MultiType::operator orxonox::Vector2()     const { return (this->value_) ? ((this->value_->type_ == Type::Vector2         ) ? (static_cast<MT_Value<orxonox::Vector2>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector2>();     } ///< Returns the current value, converted to the requested type.
+    MultiType::operator orxonox::Vector3()     const { return (this->value_) ? ((this->value_->type_ == Type::Vector3         ) ? (static_cast<MT_Value<orxonox::Vector3>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector3>();     } ///< Returns the current value, converted to the requested type.
+    MultiType::operator orxonox::Vector4()     const { return (this->value_) ? ((this->value_->type_ == Type::Vector4         ) ? (static_cast<MT_Value<orxonox::Vector4>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector4>();     } ///< Returns the current value, converted to the requested type.
+    MultiType::operator orxonox::ColourValue() const { return (this->value_) ? ((this->value_->type_ == Type::ColourValue     ) ? (static_cast<MT_Value<orxonox::ColourValue>*>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::ColourValue>(); } ///< Returns the current value, converted to the requested type.
+    MultiType::operator orxonox::Quaternion()  const { return (this->value_) ? ((this->value_->type_ == Type::Quaternion      ) ? (static_cast<MT_Value<orxonox::Quaternion> *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Quaternion>();  } ///< Returns the current value, converted to the requested type.
+    MultiType::operator orxonox::Radian()      const { return (this->value_) ? ((this->value_->type_ == Type::Radian          ) ? (static_cast<MT_Value<orxonox::Radian>     *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Radian>();      } ///< Returns the current value, converted to the requested type.
+    MultiType::operator orxonox::Degree()      const { return (this->value_) ? ((this->value_->type_ == Type::Degree          ) ? (static_cast<MT_Value<orxonox::Degree>     *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Degree>();      } ///< Returns the current value, converted to the requested type.
 
-    template <> void MultiType::createNewValueContainer(const char& value)                 { this->value_ = new MT_Value<char>                (value, MT_Type::Char            ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const unsigned char& value)        { this->value_ = new MT_Value<unsigned char>       (value, MT_Type::UnsignedChar    ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const short& value)                { this->value_ = new MT_Value<short>               (value, MT_Type::Short           ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const unsigned short& value)       { this->value_ = new MT_Value<unsigned short>      (value, MT_Type::UnsignedShort   ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const int& value)                  { this->value_ = new MT_Value<int>                 (value, MT_Type::Int             ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const unsigned int& value)         { this->value_ = new MT_Value<unsigned int>        (value, MT_Type::UnsignedInt     ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const long& value)                 { this->value_ = new MT_Value<long>                (value, MT_Type::Long            ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const unsigned long& value)        { this->value_ = new MT_Value<unsigned long>       (value, MT_Type::UnsignedLong    ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const long long& value)            { this->value_ = new MT_Value<long long>           (value, MT_Type::LongLong        ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const unsigned long long& value)   { this->value_ = new MT_Value<unsigned long long>  (value, MT_Type::UnsignedLongLong); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const float& value)                { this->value_ = new MT_Value<float>               (value, MT_Type::Float           ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const double& value)               { this->value_ = new MT_Value<double>              (value, MT_Type::Double          ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const long double& value)          { this->value_ = new MT_Value<long double>         (value, MT_Type::LongDouble      ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const bool& value)                 { this->value_ = new MT_Value<bool>                (value, MT_Type::Bool            ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(      void* const& value)          { this->value_ = new MT_Value<void*>               (value, MT_Type::VoidPointer     ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const std::string& value)          { this->value_ = new MT_Value<std::string>         (value, MT_Type::String          ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const orxonox::Vector2& value)     { this->value_ = new MT_Value<orxonox::Vector2>    (value, MT_Type::Vector2         ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const orxonox::Vector3& value)     { this->value_ = new MT_Value<orxonox::Vector3>    (value, MT_Type::Vector3         ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const orxonox::Vector4& value)     { this->value_ = new MT_Value<orxonox::Vector4>    (value, MT_Type::Vector4         ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const orxonox::ColourValue& value) { this->value_ = new MT_Value<orxonox::ColourValue>(value, MT_Type::ColourValue     ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const orxonox::Quaternion& value)  { this->value_ = new MT_Value<orxonox::Quaternion> (value, MT_Type::Quaternion      ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const orxonox::Radian& value)      { this->value_ = new MT_Value<orxonox::Radian>     (value, MT_Type::Radian          ); } ///< Creates a new value container for the given type.
-    template <> void MultiType::createNewValueContainer(const orxonox::Degree& value)      { this->value_ = new MT_Value<orxonox::Degree>     (value, MT_Type::Degree          ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const char& value)                 { this->value_ = new MT_Value<char>                (value, Type::Char            ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const unsigned char& value)        { this->value_ = new MT_Value<unsigned char>       (value, Type::UnsignedChar    ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const short& value)                { this->value_ = new MT_Value<short>               (value, Type::Short           ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const unsigned short& value)       { this->value_ = new MT_Value<unsigned short>      (value, Type::UnsignedShort   ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const int& value)                  { this->value_ = new MT_Value<int>                 (value, Type::Int             ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const unsigned int& value)         { this->value_ = new MT_Value<unsigned int>        (value, Type::UnsignedInt     ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const long& value)                 { this->value_ = new MT_Value<long>                (value, Type::Long            ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const unsigned long& value)        { this->value_ = new MT_Value<unsigned long>       (value, Type::UnsignedLong    ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const long long& value)            { this->value_ = new MT_Value<long long>           (value, Type::LongLong        ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const unsigned long long& value)   { this->value_ = new MT_Value<unsigned long long>  (value, Type::UnsignedLongLong); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const float& value)                { this->value_ = new MT_Value<float>               (value, Type::Float           ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const double& value)               { this->value_ = new MT_Value<double>              (value, Type::Double          ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const long double& value)          { this->value_ = new MT_Value<long double>         (value, Type::LongDouble      ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const bool& value)                 { this->value_ = new MT_Value<bool>                (value, Type::Bool            ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(      void* const& value)          { this->value_ = new MT_Value<void*>               (value, Type::VoidPointer     ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const std::string& value)          { this->value_ = new MT_Value<std::string>         (value, Type::String          ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector2& value)     { this->value_ = new MT_Value<orxonox::Vector2>    (value, Type::Vector2         ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector3& value)     { this->value_ = new MT_Value<orxonox::Vector3>    (value, Type::Vector3         ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector4& value)     { this->value_ = new MT_Value<orxonox::Vector4>    (value, Type::Vector4         ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const orxonox::ColourValue& value) { this->value_ = new MT_Value<orxonox::ColourValue>(value, Type::ColourValue     ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const orxonox::Quaternion& value)  { this->value_ = new MT_Value<orxonox::Quaternion> (value, Type::Quaternion      ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const orxonox::Radian& value)      { this->value_ = new MT_Value<orxonox::Radian>     (value, Type::Radian          ); } ///< Creates a new value container for the given type.
+    template <> void MultiType::createNewValueContainer(const orxonox::Degree& value)      { this->value_ = new MT_Value<orxonox::Degree>     (value, Type::Degree          ); } ///< Creates a new value container for the given type.
 }

Modified: code/branches/testing/src/libraries/util/MultiType.h
===================================================================
--- code/branches/testing/src/libraries/util/MultiType.h	2012-05-18 21:17:31 UTC (rev 9221)
+++ code/branches/testing/src/libraries/util/MultiType.h	2012-05-19 09:27:07 UTC (rev 9222)
@@ -110,40 +110,6 @@
 namespace orxonox
 {
     /**
-        @brief Enum of all possible types of a MultiType.
-    */
-    namespace MT_Type
-    {
-        enum Value
-        {
-            Null,
-            Char,
-            UnsignedChar,
-            Short,
-            UnsignedShort,
-            Int,
-            UnsignedInt,
-            Long,
-            UnsignedLong,
-            LongLong,
-            UnsignedLongLong,
-            Float,
-            Double,
-            LongDouble,
-            Bool,
-            VoidPointer,
-            String,
-            Vector2,
-            Vector3,
-            Vector4,
-            ColourValue,
-            Quaternion,
-            Radian,
-            Degree
-        };
-    }
-
-    /**
         @brief The MultiType can hold a value of many possible types and convert them to other types.
 
         The following types are supported by the MultiType:
@@ -164,6 +130,40 @@
         _UtilExport friend std::ostream& operator<<(std::ostream& outstream, const MultiType& mt);
         template <typename T> friend class MT_Value;
 
+        struct Type
+        {
+            /**
+                @brief Enum of all possible types of a MultiType.
+            */
+            enum Enum
+            {
+                Null,
+                Char,
+                UnsignedChar,
+                Short,
+                UnsignedShort,
+                Int,
+                UnsignedInt,
+                Long,
+                UnsignedLong,
+                LongLong,
+                UnsignedLongLong,
+                Float,
+                Double,
+                LongDouble,
+                Bool,
+                VoidPointer,
+                String,
+                Vector2,
+                Vector3,
+                Vector4,
+                ColourValue,
+                Quaternion,
+                Radian,
+                Degree
+            };
+        };
+
     public:
         /**
             @brief MT_ValueBase is an almost pure virtual baseclass of MT_Value<T>, which holds the value of the MultiType.
@@ -172,7 +172,7 @@
         class _UtilExport MT_ValueBase
         {
         public:
-            MT_ValueBase(MT_Type::Value type) : type_(type), bHasDefaultValue_(false) {}
+            MT_ValueBase(Type::Enum type) : type_(type), bHasDefaultValue_(false) {}
             virtual ~MT_ValueBase() {}
 
             virtual MT_ValueBase* clone() const = 0;
@@ -181,7 +181,7 @@
             virtual bool assimilate(const MultiType& other) = 0;
 
             /// Returns the type of the current value.
-            const MT_Type::Value& getType() const { return this->type_; }
+            const Type::Enum& getType() const { return this->type_; }
 
             /// Checks whether the value is a default one.
             bool hasDefaultValue()   const { return this->bHasDefaultValue_; }
@@ -264,11 +264,13 @@
             virtual void exportData( uint8_t*& mem ) const=0;
             virtual uint8_t getSize() const=0;
 
-            MT_Type::Value type_;   ///< The type of the current value
+            Type::Enum type_;       ///< The type of the current value
             bool bHasDefaultValue_; ///< True if the last conversion wasn't successful
         };
 
         public:
+            static const MultiType Null;
+
             inline MultiType()                                  : value_(0) {}                                      ///< Default constructor: Assigns no value and no type. The type will be determined by the first assignment of a value.
             inline MultiType(const char& value)                 : value_(0) { this->assignValue(value); }           ///< Constructor: Assigns the given value and sets the type.
             inline MultiType(const unsigned char& value)        : value_(0) { this->assignValue(value); }           ///< Constructor: Assigns the given value and sets the type.
@@ -296,7 +298,6 @@
             inline MultiType(const orxonox::mbool& value)       : value_(0) { this->assignValue((bool)value); }     ///< Constructor: Assigns the given mbool and converts it to bool.
             inline MultiType(const char* value)                 : value_(0) { this->setValue(std::string(value)); } ///< Constructor: Converts the char array to a std::string, assigns the value and sets the type.
             inline MultiType(const MultiType& other)            : value_(0) { this->setValue(other); }              ///< Copyconstructor: Assigns value and type of the other MultiType.
-            inline MultiType(MT_Type::Value type)               : value_(0) { this->setType(type); }                ///< Constructor: Sets the type, the next assignment will determine the value.
 
             /// Destructor: Deletes the MT_Value.
             inline ~MultiType() { if (this->value_) { delete this->value_; } }
@@ -304,7 +305,6 @@
             template <typename V> inline MultiType& operator=(const V& value)         { this->setValue(value); return (*this); } ///< Assigns a new value. The value will be converted to the current type of the MultiType.
             template <typename V> inline MultiType& operator=(V* value)               { this->setValue(value); return (*this); } ///< Assigns a pointer.
             inline                       MultiType& operator=(const MultiType& other) { this->setValue(other); return (*this); } ///< Assigns the value of the other MultiType and converts it to the current type of the MultiType.
-            inline                       MultiType& operator=(MT_Type::Value type)    { this->setType(type);   return (*this); } ///< Resets the value and changes the type.
 
             inline bool                                   setValue(const char& value);
             inline bool                                   setValue(const unsigned char& value);
@@ -345,38 +345,27 @@
 
 
             /// Copies the other MultiType by assigning value and type.
-            inline void                       copy(const MultiType& other)    { if (this == &other) { return; } if (this->value_) { delete this->value_; } this->value_ = (other.value_) ? other.value_->clone() : 0; }
+            inline void                       copy(const MultiType& other) { if (this == &other) { return; } if (this->value_) { delete this->value_; } this->value_ = (other.value_) ? other.value_->clone() : 0; }
 
             /// Converts the current value to type T.
-            template <typename T> inline bool convert()                       { return this->setValue<T>((typename Loki::TypeTraits<T>::UnqualifiedReferredType)(*this));  }
-            /// Converts the current value to the type of the other MultiType.
-            inline bool                       convert(const MultiType& other) { return this->convert(other.getType()); }
-            bool                              convert(MT_Type::Value type);
+            template <typename T> inline bool convert()                    { return this->setValue<T>((typename Loki::TypeTraits<T>::UnqualifiedReferredType)(*this));  }
 
-            /// Current content gets deleted. New type is MT_Type::Null
-            inline void                       reset()                         { if (this->value_) delete this->value_; this->value_ = 0; }
+            /// Resets value and type. Type will be void afterwards and null() returns true.
+            inline void                       reset()                      { if (this->value_) delete this->value_; this->value_ = 0; }
             /// Current content gets overridden with default zero value
-            inline void                       resetValue()                    { if (this->value_) this->value_->reset(); }
+            inline void                       resetValue()                 { if (this->value_) this->value_->reset(); }
 
             /// Resets the value and changes the internal type to T.
-            template <typename T> inline void setType()                       { this->assignValue(typename Loki::TypeTraits<T>::UnqualifiedReferredType()); }
-            /// Resets the value and changes the internal type to the type of the other MultiType.
-            inline void                       setType(const MultiType& other) { this->setType(other.getType());                                             }
-            /// Resets the value and changes the internal type to the given type.
-            inline void                       setType(MT_Type::Value type)    { this->reset(); this->convert(type); this->resetValue();                     }
+            template <typename T> inline void setType()                    { this->assignValue(typename Loki::TypeTraits<T>::UnqualifiedReferredType()); }
 
-            /// Returns the current type.
-            inline MT_Type::Value             getType()                   const { return (this->value_) ? this->value_->type_ : MT_Type::Null; }
-            /// Returns true if the current type equals the given type.
-            inline bool                       isType(MT_Type::Value type) const { return (this->value_) ? (this->value_->type_ == type) : (type == MT_Type::Null); }
             /// Returns true if the current type is T.
-            template <typename T> inline bool isType()                    const { return false; } // Only works for specialized values - see below
-            std::string                       getTypename()               const;
+            template <typename T> inline bool isType()               const { return false; } // Only works for specialized values - see below
+            std::string                       getTypename()          const;
 
             /// Saves the value of the MT to a bytestream (pointed at by mem) and increases mem pointer by size of MT
-            inline void                       exportData(uint8_t*& mem) const { assert(sizeof(MT_Type::Value)<=8); *static_cast<uint8_t*>(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); }
+            inline void                       exportData(uint8_t*& mem) const { assert(sizeof(Type::Enum)<=8); *static_cast<uint8_t*>(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); }
             /// Loads the value of the MT from a bytestream (pointed at by mem) and increases mem pointer by size of MT
-            inline void                       importData(uint8_t*& mem) { assert(sizeof(MT_Type::Value)<=8); this->setType(static_cast<MT_Type::Value>(*static_cast<uint8_t*>(mem))); mem+=sizeof(uint8_t); this->value_->importData(mem); }
+            inline void                       importData(uint8_t*& mem) { assert(sizeof(Type::Enum)<=8); this->setType(static_cast<Type::Enum>(*static_cast<uint8_t*>(mem))); mem+=sizeof(uint8_t); this->value_->importData(mem); }
             /// Saves the value of the MT to a bytestream and increases pointer to bytestream by size of MT
             inline uint8_t*&                  operator << (uint8_t*& mem) { importData(mem); return mem; }
             /// Loads the value of the MT to a bytestream and increases pointer to bytestream by size of MT
@@ -465,30 +454,37 @@
             template <typename T> inline T* getPointer()          const { return static_cast<T*>(this->getVoid());      } ///< Returns the current value, converted to a T* pointer.
 
         private:
-            inline bool assignValue(const char& value)                 { if (this->value_ && this->value_->type_ == MT_Type::Char)             { return this->value_->setValue(value); } else { this->changeValueContainer<char>(value);                 return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const unsigned char& value)        { if (this->value_ && this->value_->type_ == MT_Type::UnsignedChar)     { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned char>(value);        return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const short& value)                { if (this->value_ && this->value_->type_ == MT_Type::Short)            { return this->value_->setValue(value); } else { this->changeValueContainer<short>(value);                return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const unsigned short& value)       { if (this->value_ && this->value_->type_ == MT_Type::UnsignedShort)    { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned short>(value);       return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const int& value)                  { if (this->value_ && this->value_->type_ == MT_Type::Int)              { return this->value_->setValue(value); } else { this->changeValueContainer<int>(value);                  return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const unsigned int& value)         { if (this->value_ && this->value_->type_ == MT_Type::UnsignedInt)      { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned int>(value);         return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const long& value)                 { if (this->value_ && this->value_->type_ == MT_Type::Long)             { return this->value_->setValue(value); } else { this->changeValueContainer<long>(value);                 return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const unsigned long& value)        { if (this->value_ && this->value_->type_ == MT_Type::UnsignedLong)     { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long>(value);        return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const long long& value)            { if (this->value_ && this->value_->type_ == MT_Type::LongLong)         { return this->value_->setValue(value); } else { this->changeValueContainer<long long>(value);            return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const unsigned long long& value)   { if (this->value_ && this->value_->type_ == MT_Type::UnsignedLongLong) { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long long>(value);   return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const float& value)                { if (this->value_ && this->value_->type_ == MT_Type::Float)            { return this->value_->setValue(value); } else { this->changeValueContainer<float>(value);                return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const double& value)               { if (this->value_ && this->value_->type_ == MT_Type::Double)           { return this->value_->setValue(value); } else { this->changeValueContainer<double>(value);               return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const long double& value)          { if (this->value_ && this->value_->type_ == MT_Type::LongDouble)       { return this->value_->setValue(value); } else { this->changeValueContainer<long double>(value);          return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const bool& value)                 { if (this->value_ && this->value_->type_ == MT_Type::Bool)             { return this->value_->setValue(value); } else { this->changeValueContainer<bool>(value);                 return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(      void* const& value)          { if (this->value_ && this->value_->type_ == MT_Type::VoidPointer)      { return this->value_->setValue(value); } else { this->changeValueContainer<void*>(value);                return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const std::string& value)          { if (this->value_ && this->value_->type_ == MT_Type::String)           { return this->value_->setValue(value); } else { this->changeValueContainer<std::string>(value);          return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const orxonox::Vector2& value)     { if (this->value_ && this->value_->type_ == MT_Type::Vector2)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector2>(value);     return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const orxonox::Vector3& value)     { if (this->value_ && this->value_->type_ == MT_Type::Vector3)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector3>(value);     return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const orxonox::Vector4& value)     { if (this->value_ && this->value_->type_ == MT_Type::Vector4)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector4>(value);     return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const orxonox::ColourValue& value) { if (this->value_ && this->value_->type_ == MT_Type::ColourValue)      { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::ColourValue>(value); return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const orxonox::Quaternion& value)  { if (this->value_ && this->value_->type_ == MT_Type::Quaternion)       { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Quaternion>(value);  return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const orxonox::Radian& value)      { if (this->value_ && this->value_->type_ == MT_Type::Radian)           { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Radian>(value);      return true; } } ///< Assigns a new value by changing type and creating a new container.
-            inline bool assignValue(const orxonox::Degree& value)      { if (this->value_ && this->value_->type_ == MT_Type::Degree)           { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Degree>(value);      return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const char& value)                 { if (this->value_ && this->value_->type_ == Type::Char)             { return this->value_->setValue(value); } else { this->changeValueContainer<char>(value);                 return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const unsigned char& value)        { if (this->value_ && this->value_->type_ == Type::UnsignedChar)     { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned char>(value);        return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const short& value)                { if (this->value_ && this->value_->type_ == Type::Short)            { return this->value_->setValue(value); } else { this->changeValueContainer<short>(value);                return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const unsigned short& value)       { if (this->value_ && this->value_->type_ == Type::UnsignedShort)    { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned short>(value);       return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const int& value)                  { if (this->value_ && this->value_->type_ == Type::Int)              { return this->value_->setValue(value); } else { this->changeValueContainer<int>(value);                  return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const unsigned int& value)         { if (this->value_ && this->value_->type_ == Type::UnsignedInt)      { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned int>(value);         return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const long& value)                 { if (this->value_ && this->value_->type_ == Type::Long)             { return this->value_->setValue(value); } else { this->changeValueContainer<long>(value);                 return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const unsigned long& value)        { if (this->value_ && this->value_->type_ == Type::UnsignedLong)     { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long>(value);        return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const long long& value)            { if (this->value_ && this->value_->type_ == Type::LongLong)         { return this->value_->setValue(value); } else { this->changeValueContainer<long long>(value);            return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const unsigned long long& value)   { if (this->value_ && this->value_->type_ == Type::UnsignedLongLong) { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long long>(value);   return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const float& value)                { if (this->value_ && this->value_->type_ == Type::Float)            { return this->value_->setValue(value); } else { this->changeValueContainer<float>(value);                return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const double& value)               { if (this->value_ && this->value_->type_ == Type::Double)           { return this->value_->setValue(value); } else { this->changeValueContainer<double>(value);               return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const long double& value)          { if (this->value_ && this->value_->type_ == Type::LongDouble)       { return this->value_->setValue(value); } else { this->changeValueContainer<long double>(value);          return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const bool& value)                 { if (this->value_ && this->value_->type_ == Type::Bool)             { return this->value_->setValue(value); } else { this->changeValueContainer<bool>(value);                 return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(      void* const& value)          { if (this->value_ && this->value_->type_ == Type::VoidPointer)      { return this->value_->setValue(value); } else { this->changeValueContainer<void*>(value);                return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const std::string& value)          { if (this->value_ && this->value_->type_ == Type::String)           { return this->value_->setValue(value); } else { this->changeValueContainer<std::string>(value);          return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const orxonox::Vector2& value)     { if (this->value_ && this->value_->type_ == Type::Vector2)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector2>(value);     return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const orxonox::Vector3& value)     { if (this->value_ && this->value_->type_ == Type::Vector3)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector3>(value);     return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const orxonox::Vector4& value)     { if (this->value_ && this->value_->type_ == Type::Vector4)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector4>(value);     return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const orxonox::ColourValue& value) { if (this->value_ && this->value_->type_ == Type::ColourValue)      { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::ColourValue>(value); return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const orxonox::Quaternion& value)  { if (this->value_ && this->value_->type_ == Type::Quaternion)       { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Quaternion>(value);  return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const orxonox::Radian& value)      { if (this->value_ && this->value_->type_ == Type::Radian)           { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Radian>(value);      return true; } } ///< Assigns a new value by changing type and creating a new container.
+            inline bool assignValue(const orxonox::Degree& value)      { if (this->value_ && this->value_->type_ == Type::Degree)           { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Degree>(value);      return true; } } ///< Assigns a new value by changing type and creating a new container.
 
+            /// Resets the value and changes the internal type to the given type.
+            inline void       setType(Type::Enum type) { this->reset(); this->convert(type); this->resetValue(); }
+            /// Returns the current type.
+            inline Type::Enum getType()          const { return (this->value_) ? this->value_->type_ : Type::Null; }
+            /// Converts the current value to the given type.
+            bool              convert(Type::Enum type);
+
             /// Changes the value container.
             template <typename T> inline void changeValueContainer(const T& value) { if (this->value_) { delete this->value_; } this->createNewValueContainer<T>(value); }
             /// Creates a new value container (works only with specialized types).
@@ -501,31 +497,31 @@
     _UtilExport inline std::ostream& operator<<(std::ostream& outstream, const MultiType& mt) { if (mt.value_) { mt.value_->toString(outstream); } return outstream; }
 
     template <> inline bool MultiType::isType<void>()                 const { return this->null();                                                       } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<char>()                 const { return (this->value_ && this->value_->type_ == MT_Type::Char);             } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<unsigned char>()        const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedChar);     } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<short>()                const { return (this->value_ && this->value_->type_ == MT_Type::Short);            } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<unsigned short>()       const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedShort);    } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<int>()                  const { return (this->value_ && this->value_->type_ == MT_Type::Int);              } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<unsigned int>()         const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedInt);      } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<long>()                 const { return (this->value_ && this->value_->type_ == MT_Type::Long);             } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<unsigned long>()        const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedLong);     } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<long long>()            const { return (this->value_ && this->value_->type_ == MT_Type::LongLong);         } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<unsigned long long>()   const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedLongLong); } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<float>()                const { return (this->value_ && this->value_->type_ == MT_Type::Float);            } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<double>()               const { return (this->value_ && this->value_->type_ == MT_Type::Double);           } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<long double>()          const { return (this->value_ && this->value_->type_ == MT_Type::LongDouble);       } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<bool>()                 const { return (this->value_ && this->value_->type_ == MT_Type::Bool);             } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<void*>()                const { return (this->value_ && this->value_->type_ == MT_Type::VoidPointer);      } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<std::string>()          const { return (this->value_ && this->value_->type_ == MT_Type::String);           } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<orxonox::Vector2>()     const { return (this->value_ && this->value_->type_ == MT_Type::Vector2);          } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<orxonox::Vector3>()     const { return (this->value_ && this->value_->type_ == MT_Type::Vector3);          } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<orxonox::Vector4>()     const { return (this->value_ && this->value_->type_ == MT_Type::Vector4);          } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<orxonox::ColourValue>() const { return (this->value_ && this->value_->type_ == MT_Type::ColourValue);      } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<orxonox::Quaternion>()  const { return (this->value_ && this->value_->type_ == MT_Type::Quaternion);       } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<orxonox::Radian>()      const { return (this->value_ && this->value_->type_ == MT_Type::Radian);           } ///< Returns true if the current type equals the given type.
-    template <> inline bool MultiType::isType<orxonox::Degree>()      const { return (this->value_ && this->value_->type_ == MT_Type::Degree);           } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<char>()                 const { return (this->value_ && this->value_->type_ == Type::Char);             } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<unsigned char>()        const { return (this->value_ && this->value_->type_ == Type::UnsignedChar);     } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<short>()                const { return (this->value_ && this->value_->type_ == Type::Short);            } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<unsigned short>()       const { return (this->value_ && this->value_->type_ == Type::UnsignedShort);    } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<int>()                  const { return (this->value_ && this->value_->type_ == Type::Int);              } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<unsigned int>()         const { return (this->value_ && this->value_->type_ == Type::UnsignedInt);      } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<long>()                 const { return (this->value_ && this->value_->type_ == Type::Long);             } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<unsigned long>()        const { return (this->value_ && this->value_->type_ == Type::UnsignedLong);     } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<long long>()            const { return (this->value_ && this->value_->type_ == Type::LongLong);         } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<unsigned long long>()   const { return (this->value_ && this->value_->type_ == Type::UnsignedLongLong); } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<float>()                const { return (this->value_ && this->value_->type_ == Type::Float);            } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<double>()               const { return (this->value_ && this->value_->type_ == Type::Double);           } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<long double>()          const { return (this->value_ && this->value_->type_ == Type::LongDouble);       } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<bool>()                 const { return (this->value_ && this->value_->type_ == Type::Bool);             } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<void*>()                const { return (this->value_ && this->value_->type_ == Type::VoidPointer);      } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<std::string>()          const { return (this->value_ && this->value_->type_ == Type::String);           } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<orxonox::Vector2>()     const { return (this->value_ && this->value_->type_ == Type::Vector2);          } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<orxonox::Vector3>()     const { return (this->value_ && this->value_->type_ == Type::Vector3);          } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<orxonox::Vector4>()     const { return (this->value_ && this->value_->type_ == Type::Vector4);          } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<orxonox::ColourValue>() const { return (this->value_ && this->value_->type_ == Type::ColourValue);      } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<orxonox::Quaternion>()  const { return (this->value_ && this->value_->type_ == Type::Quaternion);       } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<orxonox::Radian>()      const { return (this->value_ && this->value_->type_ == Type::Radian);           } ///< Returns true if the current type equals the given type.
+    template <> inline bool MultiType::isType<orxonox::Degree>()      const { return (this->value_ && this->value_->type_ == Type::Degree);           } ///< Returns true if the current type equals the given type.
 
-    /// Deletes the content, type becomes MT_Type::Null.
+    /// Deletes the content, type becomes void.
     template <> inline bool MultiType::convert<void>()                 { this->reset(); return true; }
 
     // Specialization to avoid ambiguities with the conversion operator

Modified: code/branches/testing/src/libraries/util/MultiTypeValue.h
===================================================================
--- code/branches/testing/src/libraries/util/MultiTypeValue.h	2012-05-18 21:17:31 UTC (rev 9221)
+++ code/branches/testing/src/libraries/util/MultiTypeValue.h	2012-05-19 09:27:07 UTC (rev 9222)
@@ -54,7 +54,7 @@
     {
     public:
         /// Constructor: Assigns the value and the type identifier.
-        MT_Value(const T& value, MT_Type::Value type) : MT_ValueBase(type), value_(value) {}
+        MT_Value(const T& value, MultiType::Type::Enum type) : MT_ValueBase(type), value_(value) {}
 
         /// Creates a copy of itself.
         inline MT_ValueBase* clone() const { return new MT_Value<T>(this->value_, this->type_); }




More information about the Orxonox-commit mailing list