Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 1, 2009, 1:24:30 PM (15 years ago)
Author:
rgrieder
Message:
  • Removed superfluous convertToString and convertFromString (replaced them with multi_cast)
  • Replaced all getConvertedValue with multi_cast since it doesn't involve a potential implicit cast of the argument (template type deduction always leads to the right type)
  • Using NilValue<T>() instead of zeroise<T>() for better performance (detail, but just caught my eye)
Location:
code/branches/core4/src/core
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core4/src/core/ArgumentCompletionFunctions.cc

    r3250 r3265  
    143143
    144144            for (std::list<unsigned int>::const_iterator it = threadnumbers.begin(); it != threadnumbers.end(); ++it)
    145                 threads.push_back(ArgumentCompletionListElement(getConvertedValue<unsigned int, std::string>(*it)));
     145                threads.push_back(ArgumentCompletionListElement(multi_cast<std::string>(*it)));
    146146
    147147            return threads;
  • code/branches/core4/src/core/ConfigFileManager.cc

    r3250 r3265  
    124124    {
    125125        if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)
    126             return (this->name_ + "[" + getConvertedValue<unsigned int, std::string>(this->index_, "0") + "]" + "=" + this->value_);
    127         else
    128             return (this->name_ + "[" + getConvertedValue<unsigned int, std::string>(this->index_, "0") + "]=" + this->value_ + " " + this->additionalComment_);
     126            return (this->name_ + "[" + multi_cast<std::string>(this->index_, "0") + "]" + "=" + this->value_);
     127        else
     128            return (this->name_ + "[" + multi_cast<std::string>(this->index_, "0") + "]=" + this->value_ + " " + this->additionalComment_);
    129129    }
    130130
  • code/branches/core4/src/core/IRC.cc

    r3196 r3265  
    6868        {   COUT(1) << "Error while initializing Tcl (IRC): " << e.what();   }
    6969
    70         this->nickname_ = "orx" + getConvertedValue<int, std::string>((unsigned int)rand());
     70        this->nickname_ = "orx" + multi_cast<std::string>(static_cast<unsigned int>(rand()));
    7171        TclThreadManager::execute(threadID, "set nickname " + this->nickname_);
    7272        TclThreadManager::execute(threadID, "source irc.tcl");
  • code/branches/core4/src/core/TclThreadManager.cc

    r3196 r3265  
    9494        boost::mutex::scoped_lock bundles_lock(TclThreadManager::getInstance().bundlesMutex_);
    9595        TclThreadManager::getInstance().threadCounter_++;
    96         std::string name = getConvertedValue<unsigned int, std::string>(TclThreadManager::getInstance().threadCounter_);
     96        std::string name = multi_cast<std::string>(TclThreadManager::getInstance().threadCounter_);
    9797
    9898        TclInterpreterBundle* bundle = new TclInterpreterBundle;
     
    192192        {
    193193            boost::mutex::scoped_lock queue_lock(TclThreadManager::getInstance().orxonoxInterpreterBundle_.queueMutex_);
    194             output += getConvertedValue<unsigned int, std::string>(TclThreadManager::getInstance().orxonoxInterpreterBundle_.queue_.size());
     194            output += multi_cast<std::string>(TclThreadManager::getInstance().orxonoxInterpreterBundle_.queue_.size());
    195195        }
    196196        output += "\t\t";
     
    201201        for (std::map<unsigned int, TclInterpreterBundle*>::const_iterator it = TclThreadManager::getInstance().interpreterBundles_.begin(); it != TclThreadManager::getInstance().interpreterBundles_.end(); ++it)
    202202        {
    203             std::string output = getConvertedValue<unsigned int, std::string>((*it).first);
     203            std::string output = multi_cast<std::string>((*it).first);
    204204            output += "\t\t";
    205205            {
    206206                boost::mutex::scoped_lock queue_lock((*it).second->queueMutex_);
    207                 output += getConvertedValue<unsigned int, std::string>((*it).second->queue_.size());
     207                output += multi_cast<std::string>((*it).second->queue_.size());
    208208            }
    209209            output += "\t\t";
     
    342342        else
    343343        {
    344             this->error("Error: No Tcl-interpreter with ID " + getConvertedValue<unsigned int, std::string>(threadID) + " existing.");
     344            this->error("Error: No Tcl-interpreter with ID " + multi_cast<std::string>(threadID) + " existing.");
    345345            return 0;
    346346        }
     
    355355                output += " ";
    356356
    357             output += getConvertedValue<unsigned int, std::string>(*it);
     357            output += multi_cast<std::string>(*it);
    358358        }
    359359        return output;
     
    444444            if (bundle->queue_.size() >= TCLTHREADMANAGER_MAX_QUEUE_LENGTH)
    445445            {
    446                 this->error("Error: Queue of Tcl-interpreter " + getConvertedValue<unsigned int, std::string>(threadID) + " is full, couldn't add command.");
     446                this->error("Error: Queue of Tcl-interpreter " + multi_cast<std::string>(threadID) + " is full, couldn't add command.");
    447447                return;
    448448            }
     
    492492        if (std::find(target->queriers_.begin(), target->queriers_.end(), target->id_) != target->queriers_.end())
    493493        {
    494             this->error("Error: Circular query (" + this->dumpList(target->queriers_) + " -> " + getConvertedValue<unsigned int, std::string>(target->id_) + "), couldn't query Tcl-interpreter with ID " + getConvertedValue<unsigned int, std::string>(target->id_) + " from other interpreter with ID " + getConvertedValue<unsigned int, std::string>(querier->id_) + ".");
     494            this->error("Error: Circular query (" + this->dumpList(target->queriers_) + " -> " + multi_cast<std::string>(target->id_) + "), couldn't query Tcl-interpreter with ID " + multi_cast<std::string>(target->id_) + " from other interpreter with ID " + multi_cast<std::string>(querier->id_) + ".");
    495495            return false;
    496496        }
     
    585585                    else
    586586                    {
    587                         this->error("Error: Couldn't query Tcl-interpreter with ID " + getConvertedValue<unsigned int, std::string>(threadID) + ", interpreter is busy right now.");
     587                        this->error("Error: Couldn't query Tcl-interpreter with ID " + multi_cast<std::string>(threadID) + ", interpreter is busy right now.");
    588588                    }
    589589                }
     
    665665        catch (Tcl::tcl_error const &e)
    666666        {
    667             TclThreadManager::getInstance().error("Tcl (ID " + getConvertedValue<unsigned int, std::string>(interpreterBundle->id_) + ") error: " + e.what());
     667            TclThreadManager::getInstance().error("Tcl (ID " + multi_cast<std::string>(interpreterBundle->id_) + ") error: " + e.what());
    668668        }
    669669        catch (std::exception const &e)
    670670        {
    671             TclThreadManager::getInstance().error("Error while executing Tcl (ID " + getConvertedValue<unsigned int, std::string>(interpreterBundle->id_) + "): " + e.what());
     671            TclThreadManager::getInstance().error("Error while executing Tcl (ID " + multi_cast<std::string>(interpreterBundle->id_) + "): " + e.what());
    672672        }
    673673
  • code/branches/core4/src/core/input/KeyBinder.cc

    r3196 r3265  
    187187        for (unsigned int iDev = 0; iDev < numberOfJoySticks_; iDev++)
    188188        {
    189             std::string deviceNumber = convertToString(iDev);
     189            std::string deviceNumber = multi_cast<std::string>(iDev);
    190190            // joy stick buttons
    191191            for (unsigned int i = 0; i < JoyStickButtonCode::numberOfButtons; i++)
Note: See TracChangeset for help on using the changeset viewer.