Skip to content

Commit 52bfa16

Browse files
committed
[roc-status] Use parameter toString() methods where possible
1 parent f7ca340 commit 52bfa16

File tree

4 files changed

+13
-20
lines changed

4 files changed

+13
-20
lines changed

include/ReadoutCard/ParameterTypes/GbtMux.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct GbtMux
3030
Ttc = Cru::GBT_MUX_TTC,
3131
Ddg = Cru::GBT_MUX_DDG,
3232
Swt = Cru::GBT_MUX_SWT,
33+
Na = -1,
3334
};
3435

3536
/// Converts a GbtMux to an int

src/CommandLineUtilities/ProgramStatus.cxx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ class ProgramStatus: public Program
8383
for (const auto& el : reportInfo.linkMap) {
8484
auto link = el.second;
8585
int globalId = el.first; //Use the "new" link mapping
86-
std::string gbtTxMode = (link.gbtTxMode == Cru::GBT_MODE_WB ? "WB" : "GBT");
87-
std::string gbtRxMode = (link.gbtRxMode == Cru::GBT_MODE_WB ? "WB" : "GBT");
86+
std::string gbtTxMode = GbtMode::toString(link.gbtTxMode);
87+
std::string gbtRxMode = GbtMode::toString(link.gbtRxMode);
8888
std::string gbtTxRxMode = gbtTxMode + "/" + gbtRxMode;
8989
std::string loopback = (link.loopback == false ? "None" : "Enabled");
9090

@@ -97,21 +97,12 @@ class ProgramStatus: public Program
9797
downstreamData = "MIDTRG";
9898
}
9999

100-
std::string gbtMux;
101-
if (link.gbtMux == Cru::GBT_MUX_TTC) {
102-
gbtMux = "TTC:" + downstreamData;
103-
} else if (link.gbtMux == Cru::GBT_MUX_DDG) {
104-
gbtMux = "DDG";
105-
} else if (link.gbtMux == Cru::GBT_MUX_SWT) {
106-
gbtMux = "SWT";
100+
std::string gbtMux = GbtMux::toString(link.gbtMux);
101+
if (gbtMux == "TTC") {
102+
gbtMux += ":" + downstreamData;
107103
}
108104

109-
std::string datapathMode;
110-
if (link.datapathMode == Cru::GBT_PACKET) {
111-
datapathMode = "Packet";
112-
} else {
113-
datapathMode = "Continuous";
114-
}
105+
std::string datapathMode = DatapathMode::toString(link.datapathMode);
115106

116107
std::string enabled = (link.enabled) ? "Enabled" : "Disabled" ;
117108

src/ParameterTypes/GbtMode.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ namespace roc {
2121
namespace {
2222

2323
static const auto converter = Utilities::makeEnumConverter<GbtMode::type>("GbtMode", {
24-
{ GbtMode::Gbt, "Gbt" },
25-
{ GbtMode::Wb, "Wb" },
24+
{ GbtMode::Gbt, "GBT" },
25+
{ GbtMode::Wb, "WB" },
2626
});
2727

2828
} // Anonymous namespace

src/ParameterTypes/GbtMux.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ namespace roc {
2121
namespace {
2222

2323
static const auto converter = Utilities::makeEnumConverter<GbtMux::type>("GbtMux", {
24-
{ GbtMux::Ttc, "Ttc" },
25-
{ GbtMux::Ddg, "Ddg" },
26-
{ GbtMux::Swt, "Swt" },
24+
{ GbtMux::Ttc, "TTC" },
25+
{ GbtMux::Ddg, "DDG" },
26+
{ GbtMux::Swt, "SWT" },
27+
{ GbtMux::Na, "N/A" },
2728
});
2829

2930
} // Anonymous namespace

0 commit comments

Comments
 (0)