CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
WillGetIfMatch.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_WillGetIfMatch_h
2 #define FWCore_Framework_WillGetIfMatch_h
3 
13 #include <functional>
18 
19 namespace edm {
20 
21  template <typename T>
22  class WillGetIfMatch {
23  public:
24  template <typename U>
26 
27  EDGetTokenT<T> operator()(BranchDescription const& branchDescription) {
28  if (match_(branchDescription)) {
29  auto transition = branchDescription.branchType();
31  branchDescription.moduleLabel(), branchDescription.productInstanceName(), branchDescription.processName()};
32  if (transition == edm::InEvent) {
33  return module_->template consumes<T>(tag);
34  } else if (transition == edm::InLumi) {
35  return module_->template consumes<T, edm::InLumi>(tag);
36  } else if (transition == edm::InRun) {
37  return module_->template consumes<T, edm::InRun>(tag);
38  } else if (transition == edm::InProcess) {
39  return module_->template consumes<T, edm::InProcess>(tag);
40  }
41  }
42  return EDGetTokenT<T>{};
43  }
44 
45  private:
46  std::function<bool(BranchDescription const&)> match_;
48  };
49 } // namespace edm
50 #endif
BranchType const & branchType() const
std::string const & processName() const
WillGetIfMatch(U const &match, EDConsumerBase *module)
std::string const & productInstanceName() const
EDConsumerBase * module_
std::function< bool(BranchDescription const &)> match_
HLT enums.
EDGetTokenT< T > operator()(BranchDescription const &branchDescription)
std::string const & moduleLabel() const
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)