mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 13:57:13 +02:00
wip
This commit is contained in:
@ -519,6 +519,23 @@ std::string ToString(const defs::timingSourceType s) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string ToString(const defs::EthernetInterface s) {
|
||||
std::ostringstream os;
|
||||
std::string rs;
|
||||
switch (s) {
|
||||
case defs::NONE:
|
||||
return std::string("none");
|
||||
default:
|
||||
if (s & defs::I3GBE)
|
||||
os << "3gbe, ";
|
||||
if (s & defs::I10GBE)
|
||||
os << "10gbe, ";
|
||||
auto rs = os.str();
|
||||
rs.erase(rs.end() - 2);
|
||||
return rs;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string &ToString(const std::string &s) { return s; }
|
||||
|
||||
template <> defs::detectorType StringTo(const std::string &s) {
|
||||
@ -859,6 +876,18 @@ template <> defs::timingSourceType StringTo(const std::string &s) {
|
||||
throw sls::RuntimeError("Unknown timing source type " + s);
|
||||
}
|
||||
|
||||
template <> defs::EthernetInterface StringTo(const std::string &s) {
|
||||
std::string rs = s;
|
||||
rs.erase(rs.find(','));
|
||||
if (rs == "none")
|
||||
return defs::NONE;
|
||||
if (rs == "3gbe")
|
||||
return defs::I3GBE;
|
||||
if (rs == "10gbe")
|
||||
return defs::I10GBE;
|
||||
throw sls::RuntimeError("Unknown EthernetInterface type " + s);
|
||||
}
|
||||
|
||||
template <> uint32_t StringTo(const std::string &s) {
|
||||
int base = s.find("0x") != std::string::npos ? 16 : 10;
|
||||
return std::stoul(s, nullptr, base);
|
||||
|
Reference in New Issue
Block a user