added enum left right top bottom

This commit is contained in:
2021-07-21 09:25:27 +02:00
parent ec7ba7c508
commit 8ba37e99a7
9 changed files with 50 additions and 48 deletions

View File

@ -521,6 +521,25 @@ std::string ToString(const defs::timingSourceType s) {
}
}
std::string ToString(defs::M3_GainCaps s) {
std::ostringstream os;
if (s & defs::M3_C10pre)
os << "C10pre, ";
if (s & defs::M3_C15sh)
os << "C15sh, ";
if (s & defs::M3_C30sh)
os << "C30sh, ";
if (s & defs::M3_C50sh)
os << "C50sh, ";
if (s & defs::M3_C225ACsh)
os << "C225ACsh, ";
if (s & defs::M3_C15pre)
os << "C15pre, ";
auto rs = os.str();
rs.erase(rs.end() - 2);
return rs;
}
std::string ToString(const defs::portPosition s) {
switch (s) {
case defs::LEFT:
@ -876,6 +895,22 @@ template <> defs::timingSourceType StringTo(const std::string &s) {
throw sls::RuntimeError("Unknown timing source type " + s);
}
template <> defs::M3_GainCaps StringTo(const std::string &s) {
if (s == "C10pre")
return defs::M3_C10pre;
if (s == "C15sh")
return defs::M3_C15sh;
if (s == "C30sh")
return defs::M3_C30sh;
if (s == "C50sh")
return defs::M3_C50sh;
if (s == "C225ACsh")
return defs::M3_C225ACsh;
if (s == "C15pre")
return defs::M3_C15pre;
throw sls::RuntimeError("Unknown gain cap " + s);
}
template <> defs::portPosition StringTo(const std::string &s) {
if (s == "left")
return defs::LEFT;
@ -888,34 +923,6 @@ template <> defs::portPosition StringTo(const std::string &s) {
throw sls::RuntimeError("Unknown port position " + s);
}
template <> defs::timingSourceType StringTo(const std::string &s) {
if (s == "internal")
return defs::TIMING_INTERNAL;
if (s == "external")
return defs::TIMING_EXTERNAL;
throw sls::RuntimeError("Unknown timing source type " + s);
}
std::string ToString(defs::M3_GainCaps s){
std::ostringstream os;
if (s & defs::M3_C10pre)
os << "C10pre, ";
if (s & defs::M3_C15sh)
os << "C15sh, ";
if (s & defs::M3_C30sh)
os << "C30sh, ";
if (s & defs::M3_C50sh)
os << "C50sh, ";
if (s & defs::M3_C225ACsh)
os << "C225ACsh, ";
if (s & defs::M3_C15pre)
os << "C15pre, ";
auto rs = os.str();
rs.erase(rs.end()-2);
return rs;
}
template <> uint32_t StringTo(const std::string &s) {
int base = s.find("0x") != std::string::npos ? 16 : 10;
return std::stoul(s, nullptr, base);