Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:14

0001 // -*- C++ -*-
0002 //
0003 // Package:     FWCore/Utilities
0004 // namespace  :     path_configuration
0005 //
0006 // Implementation:
0007 //     [Notes on implementation]
0008 //
0009 // Original Author:  Christopher Jones
0010 //         Created:  Wed, 30 Mar 2022 15:04:35 GMT
0011 //
0012 
0013 // system include files
0014 #include <algorithm>
0015 #include <array>
0016 
0017 // user include files
0018 #include "FWCore/Utilities/interface/path_configuration.h"
0019 
0020 namespace edm::path_configuration {
0021 
0022   SchedulingConstructLabelSet const& schedulingConstructLabels() {
0023     static const SchedulingConstructLabelSet s_set({{"@"}, {"#"}});
0024     return s_set;
0025   }
0026 
0027   //Takes the Parameter associated to a given Path and converts it to the list of modules
0028   // in the same order as the Path's position bits
0029   std::vector<std::string> configurationToModuleBitPosition(std::vector<std::string> iConfig) {
0030     auto const& labelsToRemove = schedulingConstructLabels();
0031     iConfig.erase(
0032         std::remove_if(iConfig.begin(),
0033                        iConfig.end(),
0034                        [&labelsToRemove](auto const& n) { return labelsToRemove.find(n) != labelsToRemove.end(); }),
0035         iConfig.end());
0036     return iConfig;
0037   }
0038 
0039   std::string removeSchedulingTokensFromModuleLabel(std::string iLabel) {
0040     constexpr std::array<char, 4> s_tokens = {{'!', '-', '+', '|'}};
0041     if (not iLabel.empty()) {
0042       for (auto t : s_tokens) {
0043         if (t == iLabel[0]) {
0044           iLabel.erase(0, 1);
0045           break;
0046         }
0047       }
0048     }
0049     return iLabel;
0050   }
0051 
0052 }  // namespace edm::path_configuration