Skip to content

Commit c01dffa

Browse files
committed
clang-format
1 parent 91678dc commit c01dffa

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

src/CommandLineUtilities/ProgramConfig.cxx

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ namespace po = boost::program_options;
3737
std::string cmd; // program command invoked
3838

3939
/// Get a status report of given card
40-
std::string getStatusReport(Parameters::CardIdType cardId) {
40+
std::string getStatusReport(Parameters::CardIdType cardId)
41+
{
4142

4243
auto card = RocPciDevice(cardId).getCardDescriptor();
4344
auto cardType = card.cardType;
@@ -48,7 +49,7 @@ std::string getStatusReport(Parameters::CardIdType cardId) {
4849
std::string header;
4950
std::string lineFat;
5051
std::string lineThin;
51-
const char *linkMask = "0-11";
52+
const char* linkMask = "0-11";
5253

5354
if (cardType == CardType::type::Crorc) {
5455
formatHeader = " %-9s %-8s %-19s\n";
@@ -57,7 +58,7 @@ std::string getStatusReport(Parameters::CardIdType cardId) {
5758
lineFat = std::string(header.length(), '=') + '\n';
5859
lineThin = std::string(header.length(), '-') + '\n';
5960

60-
auto params = Parameters::makeParameters(cardId, 0); //status available on BAR0
61+
auto params = Parameters::makeParameters(cardId, 0); // status available on BAR0
6162
params.setLinkMask(Parameters::linkMaskFromString(linkMask));
6263
auto bar0 = ChannelFactory().getBar(params);
6364
auto crorcBar0 = std::dynamic_pointer_cast<CrorcBar>(bar0);
@@ -79,7 +80,6 @@ std::string getStatusReport(Parameters::CardIdType cardId) {
7980
table << "Time Frame Length: " << reportInfo.timeFrameLength << std::endl;
8081
table << "-----------------------------" << std::endl;
8182

82-
8383
table << lineFat << header << lineThin;
8484

8585
/* PARAMETERS PER LINK */
@@ -104,7 +104,7 @@ std::string getStatusReport(Parameters::CardIdType cardId) {
104104
lineFat = std::string(header.length(), '=') + '\n';
105105
lineThin = std::string(header.length(), '-') + '\n';
106106

107-
auto params = Parameters::makeParameters(cardId, 2); //status available on BAR2
107+
auto params = Parameters::makeParameters(cardId, 2); // status available on BAR2
108108
params.setLinkMask(Parameters::linkMaskFromString(linkMask));
109109
auto bar2 = ChannelFactory().getBar(params);
110110
auto cruBar2 = std::dynamic_pointer_cast<CruBar>(bar2);
@@ -131,7 +131,6 @@ std::string getStatusReport(Parameters::CardIdType cardId) {
131131
table << "Run statistics enabled" << std::endl;
132132
}
133133

134-
135134
Cru::OnuStatus onuStatus = cruBar2->reportOnuStatus(0);
136135

137136
std::string onuUpstreamStatus = Cru::LinkStatusToString(onuStatus.stickyStatus.upstreamStatus);
@@ -166,7 +165,7 @@ std::string getStatusReport(Parameters::CardIdType cardId) {
166165
/* PARAMETERS PER LINK */
167166
for (const auto& el : reportInfo.linkMap) {
168167
auto link = el.second;
169-
int globalId = el.first; //Use the "new" link mapping
168+
int globalId = el.first; // Use the "new" link mapping
170169
std::string gbtTxMode = GbtMode::toString(link.gbtTxMode);
171170
std::string gbtRxMode = GbtMode::toString(link.gbtRxMode);
172171
std::string gbtTxRxMode = gbtTxMode + "/" + gbtRxMode;
@@ -315,22 +314,24 @@ class ProgramConfig : public Program
315314
"Sets the FEE ID");
316315
options.add_options()("status-report",
317316
po::value<std::string>(&mOptions.statusReport),
318-
"Sets file where to output card status (similar to roc-status). Can be stdout, infologger, or a file name. The file name can be preceded with + for appending the file. Name can contain special escape sequences %t (timestamp) %T (date/time) or %i (card ID). Infologger reports are set with error code 4805.");
317+
"Sets file where to output card status (similar to roc-status). Can be stdout, infologger, or a file name. The file name can be preceded with + for appending the file. Name can contain special escape sequences %t (timestamp) %T (date/time) or %i (card ID). Infologger reports are set with error code 4805.");
319318
Options::addOptionCardId(options);
320319
}
321320

322-
static std::string cardIdToString(const Parameters::CardIdType &cardId) {
323-
if ( auto *id = boost::get<o2::roc::PciAddress>( &cardId ) ) {
321+
static std::string cardIdToString(const Parameters::CardIdType& cardId)
322+
{
323+
if (auto* id = boost::get<o2::roc::PciAddress>(&cardId)) {
324324
return id->toString();
325-
} else if ( auto *id = boost::get<o2::roc::PciSequenceNumber>( &cardId ) ) {
325+
} else if (auto* id = boost::get<o2::roc::PciSequenceNumber>(&cardId)) {
326326
return id->toString();
327-
} else if ( auto *id = boost::get<o2::roc::SerialId>( &cardId ) ) {
327+
} else if (auto* id = boost::get<o2::roc::SerialId>(&cardId)) {
328328
return id->toString();
329329
}
330330
return "";
331331
}
332332

333-
virtual void reportStatus(Parameters::CardIdType cardId) {
333+
virtual void reportStatus(Parameters::CardIdType cardId)
334+
{
334335
if (mOptions.statusReport != "") {
335336

336337
// create report
@@ -348,7 +349,7 @@ class ProgramConfig : public Program
348349
report += "Command: " + cmd + "\n";
349350

350351
// do as in roc-status
351-
report += "Status: \n" + getStatusReport(cardId);
352+
report += "Status: \n" + getStatusReport(cardId);
352353

353354
// parse filename
354355
std::string fileName;
@@ -393,11 +394,11 @@ class ProgramConfig : public Program
393394
std::string line;
394395
std::stringstream ss;
395396
ss << report;
396-
while(std::getline(ss, line)) {
397-
theLog << LogInfoSupport_(4805) << line << InfoLogger::endm;
397+
while (std::getline(ss, line)) {
398+
theLog << LogInfoSupport_(4805) << line << InfoLogger::endm;
398399
}
399400
} else {
400-
FILE *fp = fopen(fileName.c_str(), fileMode);
401+
FILE* fp = fopen(fileName.c_str(), fileMode);
401402
if (fp == nullptr) {
402403
BOOST_THROW_EXCEPTION(Exception() << ErrorInfo::Message("Failed to open report file " + fileName + " : " + strerror(errno)));
403404
} else {
@@ -409,7 +410,7 @@ class ProgramConfig : public Program
409410
return;
410411
}
411412

412-
const char *ilFacility = "ReadoutCard/config";
413+
const char* ilFacility = "ReadoutCard/config";
413414

414415
virtual void run(const boost::program_options::variables_map& map)
415416
{
@@ -595,7 +596,7 @@ class ProgramConfig : public Program
595596

596597
int main(int argc, char** argv)
597598
{
598-
for (int i=0; i<argc; i++) {
599+
for (int i = 0; i < argc; i++) {
599600
cmd += argv[i] + std::string(" ");
600601
}
601602
// true here enables InfoLogger output by default

0 commit comments

Comments
 (0)