File indexing completed on 2023-03-17 11:02:06
0001 #ifndef FWCore_Framework_ProductSelectorRules_h
0002 #define FWCore_Framework_ProductSelectorRules_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <iosfwd>
0013 #include <string>
0014 #include <vector>
0015
0016 #include <regex>
0017
0018 namespace edm {
0019 class BranchDescription;
0020 class ProductSelector;
0021 class ParameterSet;
0022 class ParameterSetDescription;
0023
0024 class ProductSelectorRules {
0025 public:
0026 ProductSelectorRules(ParameterSet const& pset,
0027 std::string const& parameterName,
0028 std::string const& parameterOwnerName);
0029
0030
0031
0032
0033 struct BranchSelectState {
0034 edm::BranchDescription const* desc;
0035 bool selectMe;
0036
0037
0038 explicit BranchSelectState(edm::BranchDescription const* bd) : desc(bd), selectMe(false) {}
0039 };
0040
0041 void applyToAll(std::vector<BranchSelectState>& branchstates) const;
0042
0043 bool keepAll() const { return keepAll_; }
0044
0045 static void fillDescription(ParameterSetDescription& desc,
0046 char const* parameterName,
0047 std::vector<std::string> const& defaultStrings = defaultSelectionStrings());
0048
0049 static const std::vector<std::string>& defaultSelectionStrings();
0050
0051 private:
0052 class Rule {
0053 public:
0054 Rule(std::string const& s, std::string const& parameterName, std::string const& owner);
0055
0056
0057
0058 void applyToAll(std::vector<BranchSelectState>& branchstates) const;
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068 void applyToOne(BranchDescription const* branch, bool& result) const;
0069
0070
0071
0072 bool appliesTo(BranchDescription const* branch) const;
0073
0074 private:
0075
0076
0077 bool selectflag_;
0078 std::regex productType_;
0079 std::regex moduleLabel_;
0080 std::regex instanceName_;
0081 std::regex processName_;
0082 };
0083
0084 private:
0085 std::vector<Rule> rules_;
0086 std::string parameterName_;
0087 std::string parameterOwnerName_;
0088 bool keepAll_;
0089 };
0090
0091 }
0092
0093 #endif