CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GroupSelectorRules.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_GroupSelectorRules_h
2 #define FWCore_Framework_GroupSelectorRules_h
3 
5 //
6 // Class GroupSelectorRules. Class for rules to select specific groups in event.
7 //
8 // Author: Bill Tanenbaum, Marc Paterno
9 //
11 
12 #include <iosfwd>
13 #include <string>
14 #include <vector>
15 
16 #include <boost/regex.hpp>
17 
18 namespace edm {
19  class BranchDescription;
20  class GroupSelector;
21  class ParameterSet;
23 
25  public:
26  GroupSelectorRules(ParameterSet const& pset, std::string const& parameterName, std::string const& parameterOwnerName);
27  //--------------------------------------------------
28  // BranchSelectState is a struct which associates a BranchDescription
29  // (*desc) with a bool indicating whether or not the branch with
30  // that name is to be selected. Note that desc may not be null.
33  bool selectMe;
34 
35  // N.B.: We assume bd is not null.
36  explicit BranchSelectState (edm::BranchDescription const* bd) :
37  desc(bd),
39  { }
40  };
41 
42  void applyToAll(std::vector<BranchSelectState>& branchstates) const;
43 
44  bool keepAll() const {return keepAll_;}
45 
46  static void fillDescription(ParameterSetDescription& desc, char const* parameterName);
47 
48  private:
49  class Rule {
50  public:
51  Rule(std::string const& s, std::string const& parameterName, std::string const& owner);
52 
53  // Apply the rule to all the given branch states. This may modify
54  // the given branch states.
55  void applyToAll(std::vector<BranchSelectState>& branchstates) const;
56 
57  // Apply the rule to the given BranchDescription. The return value
58  // is the value to which the 'select bit' should be set, according
59  // to application of this rule.
60  //bool applyToOne(BranchDescription const* branch) const;
61 
62  // If this rule applies to the given BranchDescription, then
63  // modify 'result' to match the rule's select flag. If the rule does
64  // not apply, do not modify 'result'.
65  void applyToOne(BranchDescription const* branch, bool& result) const;
66 
67  // Return the answer to the question: "Does the rule apply to this
68  // BranchDescription?"
69  bool appliesTo(BranchDescription const* branch) const;
70 
71  private:
72  // selectflag_ carries the value to which we should set the 'select
73  // bit' if this rule matches.
75  boost::regex productType_;
76  boost::regex moduleLabel_;
77  boost::regex instanceName_;
78  boost::regex processName_;
79  };
80  private:
81  std::vector<Rule> rules_;
82  std::string parameterName_;
83  std::string parameterOwnerName_;
84  bool keepAll_;
85  };
86 
87 } // namespace edm
88 
89 
90 
91 #endif
static void fillDescription(ParameterSetDescription &desc, char const *parameterName)
void applyToOne(BranchDescription const *branch, bool &result) const
tuple result
Definition: query.py:137
void applyToAll(std::vector< BranchSelectState > &branchstates) const
Rule(std::string const &s, std::string const &parameterName, std::string const &owner)
GroupSelectorRules(ParameterSet const &pset, std::string const &parameterName, std::string const &parameterOwnerName)
bool appliesTo(BranchDescription const *branch) const
std::vector< Rule > rules_
BranchSelectState(edm::BranchDescription const *bd)
void applyToAll(std::vector< BranchSelectState > &branchstates) const