CMS 3D CMS Logo

EDPutToken.h
Go to the documentation of this file.
1 #ifndef FWCore_Utilities_EDPutToken_h
2 #define FWCore_Utilities_EDPutToken_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Utilities
6 // Class : EDPutToken
7 //
20 //
21 // Original Author: Chris Jones
22 // Created: Mon, 18 Sep 2017 17:54:11 GMT
23 //
24 
25 // system include files
26 
27 // user include files
28 
29 // forward declarations
30 namespace edm {
31  class ProductRegistryHelper;
32  template <typename T>
33  class EDPutTokenT;
34  namespace test {
35  class TestProcessorConfig;
36  }
37 
38  class EDPutToken {
39  friend class ProductRegistryHelper;
40 
41  public:
42  using value_type = unsigned int;
43 
44  constexpr EDPutToken() noexcept : m_value{s_uninitializedValue} {}
45 
46  template <typename T>
47  constexpr EDPutToken(EDPutTokenT<T> iOther) noexcept : m_value{iOther.m_value} {}
48 
49  // ---------- const member functions ---------------------
50  constexpr value_type index() const noexcept { return m_value; }
51  constexpr bool isUninitialized() const noexcept { return m_value == s_uninitializedValue; }
52 
53  private:
54  //for testing
55  friend class TestEDPutToken;
56 
57  static constexpr unsigned int s_uninitializedValue = 0xFFFFFFFF;
58 
59  explicit constexpr EDPutToken(unsigned int iValue) noexcept : m_value(iValue) {}
60 
61  // ---------- member data --------------------------------
63  };
64 
65  template <typename T>
66  class EDPutTokenT {
67  friend class ProductRegistryHelper;
68  friend class EDPutToken;
70 
71  public:
73 
74  constexpr EDPutTokenT() noexcept : m_value{s_uninitializedValue} {}
75 
76  constexpr EDPutTokenT(const EDPutTokenT<T>&) noexcept = default;
77  constexpr EDPutTokenT(EDPutTokenT<T>&&) noexcept = default;
78  constexpr EDPutTokenT(EDPutTokenT<T>& iToken) noexcept : EDPutTokenT(const_cast<EDPutTokenT<T> const&>(iToken)) {}
79 
80  template <typename ADAPTER>
81  constexpr explicit EDPutTokenT(ADAPTER&& iAdapter) noexcept : EDPutTokenT(iAdapter.template produces<T>()) {}
82 
83  constexpr EDPutTokenT& operator=(const EDPutTokenT<T>&) noexcept = default;
84  constexpr EDPutTokenT& operator=(EDPutTokenT<T>&&) noexcept = default;
85  constexpr EDPutTokenT& operator=(EDPutTokenT<T>& iOther) noexcept {
86  m_value = iOther.m_value;
87  return *this;
88  }
89 
90  template <typename ADAPTER>
91  constexpr EDPutTokenT& operator=(ADAPTER&& iAdapter) noexcept {
92  EDPutTokenT<T> temp(iAdapter.template produces<T>());
93  m_value = temp.m_value;
94 
95  return *this;
96  }
97 
98  // ---------- const member functions ---------------------
99  constexpr value_type index() const noexcept { return m_value; }
100  constexpr bool isUninitialized() const noexcept { return m_value == s_uninitializedValue; }
101 
102  private:
103  //for testing
104  friend class TestEDPutToken;
105 
106  static constexpr unsigned int s_uninitializedValue = 0xFFFFFFFF;
107 
108  constexpr explicit EDPutTokenT(unsigned int iValue) noexcept : m_value(iValue) {}
109  constexpr explicit EDPutTokenT(unsigned long int iValue) noexcept : m_value(iValue) {}
110 
111  // ---------- member data --------------------------------
113  };
114 } // namespace edm
115 
116 #endif
EDPutToken::value_type value_type
Definition: EDPutToken.h:72
value_type m_value
Definition: EDPutToken.h:112
constexpr bool isUninitialized() const noexcept
Definition: EDPutToken.h:51
friend class TestEDPutToken
Definition: EDPutToken.h:55
constexpr EDPutTokenT(ADAPTER &&iAdapter) noexcept
Definition: EDPutToken.h:81
constexpr EDPutToken(unsigned int iValue) noexcept
Definition: EDPutToken.h:59
constexpr EDPutToken() noexcept
Definition: EDPutToken.h:44
unsigned int value_type
Definition: EDPutToken.h:42
value_type m_value
Definition: EDPutToken.h:62
constexpr value_type index() const noexcept
Definition: EDPutToken.h:99
constexpr EDPutToken(EDPutTokenT< T > iOther) noexcept
Definition: EDPutToken.h:47
constexpr EDPutTokenT & operator=(ADAPTER &&iAdapter) noexcept
Definition: EDPutToken.h:91
friend class TestEDPutToken
Definition: EDPutToken.h:104
static constexpr unsigned int s_uninitializedValue
Definition: EDPutToken.h:106
constexpr value_type index() const noexcept
Definition: EDPutToken.h:50
constexpr EDPutTokenT(unsigned int iValue) noexcept
Definition: EDPutToken.h:108
HLT enums.
constexpr EDPutTokenT(unsigned long int iValue) noexcept
Definition: EDPutToken.h:109
constexpr EDPutTokenT & operator=(const EDPutTokenT< T > &) noexcept=default
static constexpr unsigned int s_uninitializedValue
Definition: EDPutToken.h:57
long double T
constexpr bool isUninitialized() const noexcept
Definition: EDPutToken.h:100
constexpr EDPutTokenT() noexcept
Definition: EDPutToken.h:74