[Orxonox-commit 2660] r7365 - in code/branches/doc/src/libraries: core/command util
rgrieder at orxonox.net
rgrieder at orxonox.net
Mon Sep 6 14:35:53 CEST 2010
Author: rgrieder
Date: 2010-09-06 14:35:53 +0200 (Mon, 06 Sep 2010)
New Revision: 7365
Modified:
code/branches/doc/src/libraries/core/command/TclThreadManager.cc
code/branches/doc/src/libraries/util/Convert.h
Log:
Removed obsolete code from Convert.h and replaced last occurrences of getConvertedValue with just two arguments.
Modified: code/branches/doc/src/libraries/core/command/TclThreadManager.cc
===================================================================
--- code/branches/doc/src/libraries/core/command/TclThreadManager.cc 2010-09-06 12:30:12 UTC (rev 7364)
+++ code/branches/doc/src/libraries/core/command/TclThreadManager.cc 2010-09-06 12:35:53 UTC (rev 7365)
@@ -255,7 +255,7 @@
void TclThreadManager::initialize(TclInterpreterBundle* bundle)
{
- const std::string& id_string = getConvertedValue<unsigned int, std::string>(bundle->id_);
+ const std::string& id_string = multi_cast<std::string>(bundle->id_);
// Initialize the new interpreter
try
@@ -407,10 +407,10 @@
if ((source_bundle->id_ == target_bundle->id_) || source_bundle->queriers_.is_in(target_bundle->id_))
{
// This query would lead to a deadlock - return with an error
- TclThreadManager::error("Error: Circular query (" + this->dumpList(source_bundle->queriers_.getList()) + ' ' + getConvertedValue<unsigned int, std::string>(source_bundle->id_) \
- + " -> " + getConvertedValue<unsigned int, std::string>(target_bundle->id_) \
- + "), couldn't query Tcl-interpreter with ID " + getConvertedValue<unsigned int, std::string>(target_bundle->id_) \
- + " from other interpreter with ID " + getConvertedValue<unsigned int, std::string>(source_bundle->id_) + '.');
+ TclThreadManager::error("Error: Circular query (" + this->dumpList(source_bundle->queriers_.getList()) + ' ' + multi_cast<std::string>(source_bundle->id_) \
+ + " -> " + multi_cast<std::string>(target_bundle->id_) \
+ + "), couldn't query Tcl-interpreter with ID " + multi_cast<std::string>(target_bundle->id_) \
+ + " from other interpreter with ID " + multi_cast<std::string>(source_bundle->id_) + '.');
}
else
{
@@ -476,7 +476,7 @@
{
// This happens if the main thread tries to query a busy interpreter
// To avoid a lock of the main thread, we simply don't proceed with the query in this case
- TclThreadManager::error("Error: Couldn't query Tcl-interpreter with ID " + getConvertedValue<unsigned int, std::string>(target_bundle->id_) + ", interpreter is busy right now.");
+ TclThreadManager::error("Error: Couldn't query Tcl-interpreter with ID " + multi_cast<std::string>(target_bundle->id_) + ", interpreter is busy right now.");
}
}
@@ -522,7 +522,7 @@
}
else
{
- TclThreadManager::error("Error: No Tcl-interpreter with ID " + getConvertedValue<unsigned int, std::string>(id) + " existing.");
+ TclThreadManager::error("Error: No Tcl-interpreter with ID " + multi_cast<std::string>(id) + " existing.");
return 0;
}
}
@@ -538,7 +538,7 @@
if (it != list.begin())
output += ' ';
- output += getConvertedValue<unsigned int, std::string>(*it);
+ output += multi_cast<std::string>(*it);
}
return output;
}
@@ -590,7 +590,7 @@
if (cc != TCL_OK)
{
- TclThreadManager::error("Tcl error (" + action + ", ID " + getConvertedValue<unsigned int, std::string>(bundle->id_) + "): " + static_cast<std::string>(result));
+ TclThreadManager::error("Tcl error (" + action + ", ID " + multi_cast<std::string>(bundle->id_) + "): " + static_cast<std::string>(result));
return "";
}
else
Modified: code/branches/doc/src/libraries/util/Convert.h
===================================================================
--- code/branches/doc/src/libraries/util/Convert.h 2010-09-06 12:30:12 UTC (rev 7364)
+++ code/branches/doc/src/libraries/util/Convert.h 2010-09-06 12:35:53 UTC (rev 7365)
@@ -160,34 +160,6 @@
return false;
}
};
-
- ////////////
- // upcast //
- ////////////
- namespace detail
- {
- // perform a static cast if ToType is a base of FromType
- template<class ToType, class FromType>
- FORCEINLINE ToType upcast(FromType input, Loki::Int2Type<true>)
- {
- return static_cast<ToType>(input);
- }
-
- // return zero if ToType is not a base of FromType
- template<class ToType, class FromType>
- FORCEINLINE ToType upcast(FromType input, Loki::Int2Type<false>)
- {
- return 0;
- }
- }
-
- // performs an upcast if ToType is a base of FromType, returns zero otherwise
- template <class ToType, class FromType>
- FORCEINLINE ToType upcast(FromType input)
- {
- enum { probe = ImplicitConversion<FromType, ToType>::exists };
- return detail::upcast<ToType, FromType>(input, Loki::Int2Type<probe>());
- }
}
@@ -380,14 +352,6 @@
}
}
- template<class FromType, class ToType>
- FORCEINLINE ToType getConvertedValue(const FromType& input)
- {
- ToType output;
- convertValue(&output, input);
- return output;
- }
-
/// Directly returns the converted value, but uses the fallback on failure. @see convertValue
template<class FromType, class ToType>
FORCEINLINE ToType getConvertedValue(const FromType& input, const ToType& fallback)
@@ -442,7 +406,6 @@
};
/// Conversion would exhibit ambiguous << or >> operators when using iostream
template <>
- template <>
struct ConverterExplicit<unsigned char, std::string>
{
FORCEINLINE static bool convert(std::string* output, const unsigned char input)
@@ -453,7 +416,6 @@
};
/// Conversion would exhibit ambiguous << or >> operators when using iostream
template <>
- template <>
struct ConverterExplicit<std::string, char>
{
FORCEINLINE static bool convert(char* output, const std::string& input)
More information about the Orxonox-commit
mailing list