CMS 3D CMS Logo

ESGetToken.h
Go to the documentation of this file.
1 #ifndef FWCore_Utilities_ESGetToken_h
2 #define FWCore_Utilities_ESGetToken_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Utilities
6 // Class : ESGetToken
7 //
19 #include <limits>
20 
21 namespace edm {
22  class EDConsumerBase;
23  class ESProducer;
24  class ESConsumesCollector;
25  class EventSetup;
26  class EventSetupImpl;
27  namespace eventsetup {
28  class EventSetupRecord;
29  }
30 
31  // A ESGetToken is created by calls to 'esConsumes' from an EDM
32  // module.
33  template <typename ESProduct, typename ESRecord>
34  class ESGetToken {
35  friend class EDConsumerBase;
36  friend class ESProducer;
37  friend class ESConsumesCollector;
38  friend class EventSetup;
39  friend class EventSetupImpl;
41 
42  public:
44 
45  constexpr ESGetToken(ESGetToken<ESProduct, ESRecord> const&) noexcept = default;
46  constexpr ESGetToken(ESGetToken<ESProduct, ESRecord>&&) noexcept = default;
47 
48  constexpr ESGetToken<ESProduct, ESRecord>& operator=(ESGetToken<ESProduct, ESRecord>&&) noexcept = default;
49  constexpr ESGetToken<ESProduct, ESRecord>& operator=(ESGetToken<ESProduct, ESRecord> const&) noexcept = default;
50 
51  constexpr unsigned int transitionID() const noexcept { return m_transitionID; }
53  constexpr ESTokenIndex index() const noexcept { return m_index; }
54  constexpr bool hasValidIndex() const noexcept { return index() != invalidIndex(); }
56 
57  private:
58  explicit constexpr ESGetToken(unsigned int transitionID, ESTokenIndex index, char const* label) noexcept
59  : m_label{label}, m_transitionID{transitionID}, m_index{index} {}
60 
61  constexpr char const* name() const noexcept { return m_label; }
62  char const* m_label{nullptr};
63  unsigned int m_transitionID{std::numeric_limits<unsigned int>::max()};
65  };
66 
67 } // namespace edm
68 
69 #endif
static constexpr ESTokenIndex invalidIndex() noexcept
Definition: ESGetToken.h:55
char const * label
constexpr ESGetToken(unsigned int transitionID, ESTokenIndex index, char const *label) noexcept
Definition: ESGetToken.h:58
#define noexcept
constexpr char const * name() const noexcept
Definition: ESGetToken.h:61
constexpr ESTokenIndex index() const noexcept
Definition: ESGetToken.h:53
HLT enums.
constexpr bool isInitialized() const noexcept
Definition: ESGetToken.h:52
constexpr bool hasValidIndex() const noexcept
Definition: ESGetToken.h:54
#define constexpr