Changeset 7365 for code/branches/doc/src/libraries
- Timestamp:
- Sep 6, 2010, 2:35:53 PM (14 years ago)
- Location:
- code/branches/doc/src/libraries
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/doc/src/libraries/core/command/TclThreadManager.cc
r7361 r7365 256 256 void TclThreadManager::initialize(TclInterpreterBundle* bundle) 257 257 { 258 const std::string& id_string = getConvertedValue<unsigned int,std::string>(bundle->id_);258 const std::string& id_string = multi_cast<std::string>(bundle->id_); 259 259 260 260 // Initialize the new interpreter … … 408 408 { 409 409 // This query would lead to a deadlock - return with an error 410 TclThreadManager::error("Error: Circular query (" + this->dumpList(source_bundle->queriers_.getList()) + ' ' + getConvertedValue<unsigned int,std::string>(source_bundle->id_) \411 + " -> " + getConvertedValue<unsigned int,std::string>(target_bundle->id_) \412 + "), couldn't query Tcl-interpreter with ID " + getConvertedValue<unsigned int,std::string>(target_bundle->id_) \413 + " from other interpreter with ID " + getConvertedValue<unsigned int,std::string>(source_bundle->id_) + '.');410 TclThreadManager::error("Error: Circular query (" + this->dumpList(source_bundle->queriers_.getList()) + ' ' + multi_cast<std::string>(source_bundle->id_) \ 411 + " -> " + multi_cast<std::string>(target_bundle->id_) \ 412 + "), couldn't query Tcl-interpreter with ID " + multi_cast<std::string>(target_bundle->id_) \ 413 + " from other interpreter with ID " + multi_cast<std::string>(source_bundle->id_) + '.'); 414 414 } 415 415 else … … 477 477 // This happens if the main thread tries to query a busy interpreter 478 478 // To avoid a lock of the main thread, we simply don't proceed with the query in this case 479 TclThreadManager::error("Error: Couldn't query Tcl-interpreter with ID " + getConvertedValue<unsigned int,std::string>(target_bundle->id_) + ", interpreter is busy right now.");479 TclThreadManager::error("Error: Couldn't query Tcl-interpreter with ID " + multi_cast<std::string>(target_bundle->id_) + ", interpreter is busy right now."); 480 480 } 481 481 } … … 523 523 else 524 524 { 525 TclThreadManager::error("Error: No Tcl-interpreter with ID " + getConvertedValue<unsigned int,std::string>(id) + " existing.");525 TclThreadManager::error("Error: No Tcl-interpreter with ID " + multi_cast<std::string>(id) + " existing."); 526 526 return 0; 527 527 } … … 539 539 output += ' '; 540 540 541 output += getConvertedValue<unsigned int,std::string>(*it);541 output += multi_cast<std::string>(*it); 542 542 } 543 543 return output; … … 591 591 if (cc != TCL_OK) 592 592 { 593 TclThreadManager::error("Tcl error (" + action + ", ID " + getConvertedValue<unsigned int,std::string>(bundle->id_) + "): " + static_cast<std::string>(result));593 TclThreadManager::error("Tcl error (" + action + ", ID " + multi_cast<std::string>(bundle->id_) + "): " + static_cast<std::string>(result)); 594 594 return ""; 595 595 } -
code/branches/doc/src/libraries/util/Convert.h
r7364 r7365 161 161 } 162 162 }; 163 164 ////////////165 // upcast //166 ////////////167 namespace detail168 {169 // perform a static cast if ToType is a base of FromType170 template<class ToType, class FromType>171 FORCEINLINE ToType upcast(FromType input, Loki::Int2Type<true>)172 {173 return static_cast<ToType>(input);174 }175 176 // return zero if ToType is not a base of FromType177 template<class ToType, class FromType>178 FORCEINLINE ToType upcast(FromType input, Loki::Int2Type<false>)179 {180 return 0;181 }182 }183 184 // performs an upcast if ToType is a base of FromType, returns zero otherwise185 template <class ToType, class FromType>186 FORCEINLINE ToType upcast(FromType input)187 {188 enum { probe = ImplicitConversion<FromType, ToType>::exists };189 return detail::upcast<ToType, FromType>(input, Loki::Int2Type<probe>());190 }191 163 } 192 164 … … 381 353 } 382 354 383 template<class FromType, class ToType>384 FORCEINLINE ToType getConvertedValue(const FromType& input)385 {386 ToType output;387 convertValue(&output, input);388 return output;389 }390 391 355 /// Directly returns the converted value, but uses the fallback on failure. @see convertValue 392 356 template<class FromType, class ToType> … … 443 407 /// Conversion would exhibit ambiguous << or >> operators when using iostream 444 408 template <> 445 template <>446 409 struct ConverterExplicit<unsigned char, std::string> 447 410 { … … 453 416 }; 454 417 /// Conversion would exhibit ambiguous << or >> operators when using iostream 455 template <>456 418 template <> 457 419 struct ConverterExplicit<std::string, char>
Note: See TracChangeset
for help on using the changeset viewer.