File indexing completed on 2024-04-06 12:13:04
0001 #include "monitor_file_utilities.h"
0002 #include "FWCore/Utilities/interface/OStreamColumn.h"
0003
0004 #include <vector>
0005
0006 namespace {
0007 std::string const space{" "};
0008 }
0009
0010 namespace edm::service::monitor_file_utilities {
0011 void moduleIdToLabel(std::ostream& oStream,
0012 std::vector<std::string> const& iModuleLabels,
0013 char moduleIdSymbol,
0014 std::string const& iIDHeader,
0015 std::string const& iLabelHeader) {
0016 std::size_t const width{std::to_string(iModuleLabels.size()).size()};
0017 OStreamColumn col0{iIDHeader, width};
0018 std::string const& lastCol = iLabelHeader;
0019
0020 oStream << "\n# " << col0 << space << lastCol << '\n';
0021 oStream << "# " << std::string(col0.width() + space.size() + lastCol.size(), '-') << '\n';
0022
0023 for (std::size_t i{}; i < iModuleLabels.size(); ++i) {
0024 auto const& label = iModuleLabels[i];
0025 if (not label.empty()) {
0026 oStream << '#' << moduleIdSymbol << ' ' << std::setw(width) << std::left << col0(i) << space << std::left
0027 << label << '\n';
0028 }
0029 }
0030 oStream << '\n';
0031 }
0032 }