Index: code/trunk/src/core/ConfigValueContainer.cc
===================================================================
--- code/trunk/src/core/ConfigValueContainer.cc	(revision 1505)
+++ code/trunk/src/core/ConfigValueContainer.cc	(revision 1747)
@@ -47,11 +47,7 @@
 {
     /**
-        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
-        @param type The type of the corresponding config-file
-        @param identifier The identifier of the class the variable belongs to
-        @param varname The name of the variable
-        @param defvalue The default-value
-    */
-    ConfigValueContainer::ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, const MultiTypeMath& defvalue)
+        @brief Initializes the ConfigValueContainer with defaultvalues.
+    */
+    void ConfigValueContainer::init(ConfigFileType type, Identifier* identifier, const std::string& varname)
     {
         this->type_ = type;
@@ -59,43 +55,45 @@
         this->sectionname_ = identifier->getName();
         this->varname_ = varname;
-
+        this->callback_ = 0;
+        this->bContainerIsNew_ = true;
+        this->bDoInitialCallback_ = false;
+        this->bAddedDescription_ = false;
+    }
+
+    /**
+        @brief Does some special initialization for single config-values.
+    */
+    void ConfigValueContainer::initValue(const MultiType& defvalue)
+    {
         this->value_ = defvalue;
-        this->bAddedDescription_ = false;
         this->bIsVector_ = false;
 
-        this->defvalueString_ = defvalue.toString();
+        this->defvalueString_ = this->value_.getString();
         this->update();
     }
 
     /**
-        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
-        @param type The type of the corresponding config-file
-        @param identifier The identifier of the class the variable belongs to
-        @param varname The name of the variable
-        @param defvalue The default-value
-    */
-    ConfigValueContainer::ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, const std::vector<MultiTypeMath>& defvalue)
-    {
-        this->type_ = type;
-        this->identifier_ = identifier;
-        this->sectionname_ = identifier->getName();
-        this->varname_ = varname;
-
-        this->valueVector_ = defvalue;
-        this->bAddedDescription_ = false;
+        @brief Does some special initialization for vector config-values.
+    */
+    void ConfigValueContainer::initVector()
+    {
         this->bIsVector_ = true;
 
-        if (defvalue.size() > 0)
-        {
-                this->value_ = defvalue[0];
-
-            for (unsigned int i = 0; i < defvalue.size(); i++)
-            {
-                ConfigFileManager::getSingleton()->getValue(this->type_, this->sectionname_, this->varname_, i, defvalue[i].toString(), this->value_.isA(MT_string));
-                this->defvalueStringVector_.push_back(defvalue[i].toString());
-            }
-
-            this->update();
-        }
+        for (unsigned int i = 0; i < this->valueVector_.size(); i++)
+        {
+            ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_string));
+            this->defvalueStringVector_.push_back(this->valueVector_[i]);
+        }
+
+        this->update();
+    }
+
+    /**
+        @brief Destructor: Deletes the callback object if necessary.
+    */
+    ConfigValueContainer::~ConfigValueContainer()
+    {
+        if (this->callback_)
+            delete this->callback_;
     }
 
@@ -105,9 +103,9 @@
         @return True if the new value was successfully assigned
     */
-    bool ConfigValueContainer::set(const MultiTypeMath& input)
-    {
-        if (this->bIsVector_)
-        {
-            return this->callFunctionWithIndex(&ConfigValueContainer::set, input.toString());
+    bool ConfigValueContainer::set(const MultiType& input)
+    {
+        if (this->bIsVector_)
+        {
+            return this->callFunctionWithIndex(&ConfigValueContainer::set, input);
         }
         else
@@ -115,5 +113,5 @@
             if (this->tset(input))
             {
-                ConfigFileManager::getSingleton()->setValue(this->type_, this->sectionname_, this->varname_, input.toString(), this->value_.isA(MT_string));
+                ConfigFileManager::getInstance()->setValue(this->type_, this->sectionname_, this->varname_, input, this->value_.isType(MT_string));
                 return true;
             }
@@ -128,5 +126,5 @@
         @return True if the new value was successfully assigned
     */
-    bool ConfigValueContainer::set(unsigned int index, const MultiTypeMath& input)
+    bool ConfigValueContainer::set(unsigned int index, const MultiType& input)
     {
         if (this->bIsVector_)
@@ -134,5 +132,5 @@
             if (this->tset(index, input))
             {
-                ConfigFileManager::getSingleton()->setValue(this->type_, this->sectionname_, this->varname_, index, input.toString(), this->value_.isA(MT_string));
+                ConfigFileManager::getInstance()->setValue(this->type_, this->sectionname_, this->varname_, index, input, this->value_.isType(MT_string));
                 return true;
             }
@@ -150,23 +148,20 @@
         @return True if the new value was successfully assigned
     */
-    bool ConfigValueContainer::tset(const MultiTypeMath& input)
-    {
-        if (this->bIsVector_)
-        {
-            return this->callFunctionWithIndex(&ConfigValueContainer::tset, input.toString());
-        }
-        else
-        {
-            MultiTypeMath temp = this->value_;
-            if (temp.assimilate(input))
-            {
-                this->value_ = temp;
-                if (this->identifier_)
-                    this->identifier_->updateConfigValues();
-
-                return true;
-            }
-        }
-        return false;
+    bool ConfigValueContainer::tset(const MultiType& input)
+    {
+        if (this->bIsVector_)
+        {
+            return this->callFunctionWithIndex(&ConfigValueContainer::tset, input);
+            return false;
+        }
+        else
+        {
+            this->value_ = input;
+
+            if (this->identifier_)
+                this->identifier_->updateConfigValues();
+
+            return true;
+        }
     }
 
@@ -177,5 +172,5 @@
         @return True if the new value was successfully assigned
     */
-    bool ConfigValueContainer::tset(unsigned int index, const MultiTypeMath& input)
+    bool ConfigValueContainer::tset(unsigned int index, const MultiType& input)
     {
         if (this->bIsVector_)
@@ -191,24 +186,20 @@
                 for (unsigned int i = this->valueVector_.size(); i <= index; i++)
                 {
-                    this->valueVector_.push_back(MultiTypeMath());
+                    this->valueVector_.push_back(MultiType());
                 }
             }
 
-            MultiTypeMath temp = this->value_;
-            if (temp.assimilate(input))
-            {
-                this->valueVector_[index] = temp;
-
-                if (this->identifier_)
-                    this->identifier_->updateConfigValues();
-
-                return true;
-            }
+            this->valueVector_[index] = input;
+
+            if (this->identifier_)
+                this->identifier_->updateConfigValues();
+
+            return true;
         }
         else
         {
             COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
-        }
-        return false;
+            return false;
+        }
     }
 
@@ -218,5 +209,5 @@
         @return True if the new entry was successfully added
     */
-    bool ConfigValueContainer::add(const MultiTypeMath& input)
+    bool ConfigValueContainer::add(const MultiType& input)
     {
         if (this->bIsVector_)
@@ -241,6 +232,6 @@
                 this->valueVector_.erase(this->valueVector_.begin() + index);
                 for (unsigned int i = index; i < this->valueVector_.size(); i++)
-                    ConfigFileManager::getSingleton()->setValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isA(MT_string));
-                ConfigFileManager::getSingleton()->deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->valueVector_.size());
+                    ConfigFileManager::getInstance()->setValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_string));
+                ConfigFileManager::getInstance()->deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->valueVector_.size());
 
                 return true;
@@ -266,5 +257,5 @@
                 if (!this->set(i, this->defvalueStringVector_[i]))
                     success = false;
-            ConfigFileManager::getSingleton()->deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->defvalueStringVector_.size());
+            ConfigFileManager::getInstance()->deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->defvalueStringVector_.size());
             return success;
         }
@@ -277,17 +268,17 @@
     {
         if (!this->bIsVector_)
-            this->value_.fromString(ConfigFileManager::getSingleton()->getValue(this->type_, this->sectionname_, this->varname_, this->defvalueString_, this->value_.isA(MT_string)));
+            this->value_ = ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, this->defvalueString_, this->value_.isType(MT_string));
         else
         {
             this->valueVector_.clear();
-            for (unsigned int i = 0; i < ConfigFileManager::getSingleton()->getVectorSize(this->type_, this->sectionname_, this->varname_); i++)
+            for (unsigned int i = 0; i < ConfigFileManager::getInstance()->getVectorSize(this->type_, this->sectionname_, this->varname_); i++)
             {
                 if (i < this->defvalueStringVector_.size())
                 {
-                    this->value_.fromString(ConfigFileManager::getSingleton()->getValue(this->type_, this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isA(MT_string)));
+                    this->value_ = ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isType(MT_string));
                 }
                 else
                 {
-                    this->value_.fromString(ConfigFileManager::getSingleton()->getValue(this->type_, this->sectionname_, this->varname_, i, MultiTypeMath(), this->value_.isA(MT_string)));
+                    this->value_ = ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, i, MultiType(), this->value_.isType(MT_string));
                 }
 
@@ -303,5 +294,5 @@
         @return The returnvalue of the functioncall
     */
-    bool ConfigValueContainer::callFunctionWithIndex(bool (ConfigValueContainer::* function) (unsigned int, const MultiTypeMath&), const std::string& input)
+    bool ConfigValueContainer::callFunctionWithIndex(bool (ConfigValueContainer::* function) (unsigned int, const MultiType&), const std::string& input)
     {
         SubString token(input, " ", SubString::WhiteSpaces, true, '\\', false, '"', false, '(', ')', false, '\0');
@@ -335,5 +326,5 @@
         @param description The description
     */
-    void ConfigValueContainer::description(const std::string& description)
+    ConfigValueContainer& ConfigValueContainer::description(const std::string& description)
     {
         if (!this->bAddedDescription_)
@@ -343,4 +334,5 @@
             this->bAddedDescription_ = true;
         }
+        return (*this);
     }
 
