CMS 3D CMS Logo

MayConsumeChooser.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_es_impl_MayConsumeChooser_h
2 #define FWCore_Framework_es_impl_MayConsumeChooser_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : MayConsumeChooser
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Thu, 19 Sep 2019 15:29:50 GMT
19 //
20 
21 // system include files
22 #include <type_traits>
23 
24 // user include files
29 
30 // forward declarations
31 
32 namespace edm::eventsetup::impl {
33  template <typename RECBASE, typename PRODUCT, typename RCD, typename FUNC, typename PTAG>
34  class MayConsumeChooser : public MayConsumeChooserBase<RECBASE> {
35  public:
36  using Record_t = typename PTAG::Record;
37  using GetType_t = typename PTAG::Type;
38 
39  MayConsumeChooser(FUNC&& iFunc) : func_(std::forward<FUNC>(iFunc)) {}
40 
41  // ---------- const member functions ---------------------
42  ESResolverIndex makeChoice(RECBASE const& iRecord) const final {
43  return func_(this->tagGetter(), iRecord.getTransientHandle(token_));
44  }
45 
46  EventSetupRecordKey recordKey() const noexcept final { return EventSetupRecordKey::makeKey<RCD>(); }
47  TypeTag productType() const noexcept final { return DataKey::makeTypeTag<PRODUCT>(); }
48 
49  // ---------- static member functions --------------------
50 
51  // ---------- member functions ---------------------------
53 
54  private:
55  // ---------- member data --------------------------------
57  FUNC func_;
58  };
59 } // namespace edm::eventsetup::impl
60 
61 #endif
edm::ESGetToken< GetType_t, Record_t > & token()
EventSetupRecordKey recordKey() const noexcept final
ESResolverIndex makeChoice(RECBASE const &iRecord) const final
edm::ESGetToken< GetType_t, Record_t > token_
TypeTag productType() const noexcept final