mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 03:10:02 +02:00
fixed order
This commit is contained in:
parent
c6fd13e49c
commit
cfb017f66a
@ -20,6 +20,17 @@
|
|||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
|
|
||||||
|
inline std::string ToString(const slsDetectorDefs::runStatus s){
|
||||||
|
return slsDetectorDefs::runStatusType(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
// in case we already have a string
|
||||||
|
// causes a copy but might be needed in generic code
|
||||||
|
inline std::string ToString(const std::string& s){
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
/** Convert std::chrono::duration with specified output unit */
|
/** Convert std::chrono::duration with specified output unit */
|
||||||
template <typename T, typename Rep = double>
|
template <typename T, typename Rep = double>
|
||||||
typename std::enable_if<is_duration<T>::value, std::string>::type
|
typename std::enable_if<is_duration<T>::value, std::string>::type
|
||||||
@ -73,6 +84,9 @@ ToString(const T &value) {
|
|||||||
return std::to_string(value);
|
return std::to_string(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For a container loop over all elements and call ToString on the element
|
* For a container loop over all elements and call ToString on the element
|
||||||
* Container<std::string> is excluded
|
* Container<std::string> is excluded
|
||||||
@ -177,17 +191,8 @@ ToString(const T &obj) {
|
|||||||
return obj.str();
|
return obj.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Call ToString with a string, causes copy but might be needed
|
|
||||||
* in generic code.
|
|
||||||
*/
|
|
||||||
inline std::string ToString(const std::string& s){
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::string ToString(slsDetectorDefs::runStatus s){
|
|
||||||
return slsDetectorDefs::runStatusType(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
|
@ -135,3 +135,9 @@ TEST_CASE("string to detectorType"){
|
|||||||
REQUIRE(StringTo<dt>("Gotthard2") == dt::GOTTHARD2);
|
REQUIRE(StringTo<dt>("Gotthard2") == dt::GOTTHARD2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("vec"){
|
||||||
|
using rs = slsDetectorDefs::runStatus;
|
||||||
|
std::vector<rs> vec{rs::ERROR, rs::IDLE};
|
||||||
|
REQUIRE(ToString(vec) == "[error, idle]");
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user