CMS 3D CMS Logo

ESIndices.h
Go to the documentation of this file.
1 #ifndef FWCore_Utilities_ESIndices_h
2 #define FWCore_Utilities_ESIndices_h
3 // -*- C++ -*-
4 //
5 // Package: Framework
6 // Class : ESIndices
7 //
18 //
19 // Author: Chris Jones
20 // Created: Sat Apr 6 14:47:35 EST 2019
21 //
22 
23 // system include files
24 #include <limits>
25 #include <ostream>
26 
27 // user include files
28 
29 namespace edm {
30  class ESProxyIndex {
31  public:
32  using Value_t = int;
33  constexpr ESProxyIndex() noexcept = default;
34  constexpr explicit ESProxyIndex(Value_t iValue) noexcept : index_{iValue} {}
35  constexpr ESProxyIndex(ESProxyIndex const&) noexcept = default;
36  constexpr ESProxyIndex(ESProxyIndex&&) noexcept = default;
37 
38  constexpr ESProxyIndex& operator=(ESProxyIndex const&) noexcept = default;
39  constexpr ESProxyIndex& operator=(ESProxyIndex&&) noexcept = default;
40 
41  constexpr bool operator==(ESProxyIndex iOther) const noexcept { return iOther.index_ == index_; }
42  constexpr bool operator!=(ESProxyIndex iOther) const noexcept { return iOther.index_ != index_; }
43 
44  constexpr Value_t value() const noexcept { return index_; }
45 
46  private:
48  };
49 
50  inline std::ostream& operator<<(std::ostream& iOS, ESProxyIndex const& iIndex) {
51  iOS << iIndex.value();
52  return iOS;
53  }
54 
55  class ESTokenIndex {
56  public:
57  using Value_t = int;
58 
59  constexpr ESTokenIndex() noexcept = default;
60  constexpr explicit ESTokenIndex(Value_t iValue) noexcept : index_{iValue} {}
61  constexpr ESTokenIndex(ESTokenIndex const&) noexcept = default;
62  constexpr ESTokenIndex(ESTokenIndex&&) noexcept = default;
63 
64  constexpr ESTokenIndex& operator=(ESTokenIndex const&) noexcept = default;
65  constexpr ESTokenIndex& operator=(ESTokenIndex&&) noexcept = default;
66 
67  constexpr bool operator==(ESTokenIndex iOther) const noexcept { return iOther.index_ == index_; }
68  constexpr bool operator!=(ESTokenIndex iOther) const noexcept { return iOther.index_ != index_; }
69 
70  constexpr Value_t value() const noexcept { return index_; }
71 
72  private:
74  };
75  inline std::ostream& operator<<(std::ostream& iOS, ESTokenIndex const& iIndex) {
76  iOS << iIndex.value();
77  return iOS;
78  }
79 
80  class ESRecordIndex {
81  public:
82  using Value_t = unsigned int;
83 
84  constexpr ESRecordIndex() noexcept = default;
85  constexpr explicit ESRecordIndex(unsigned int iValue) noexcept : index_{iValue} {}
86  constexpr ESRecordIndex(ESRecordIndex const&) noexcept = default;
87  constexpr ESRecordIndex(ESRecordIndex&&) noexcept = default;
88 
89  constexpr ESRecordIndex& operator=(ESRecordIndex const&) noexcept = default;
90  constexpr ESRecordIndex& operator=(ESRecordIndex&&) noexcept = default;
91 
92  constexpr bool operator==(ESRecordIndex iOther) const noexcept { return iOther.index_ == index_; }
93  constexpr bool operator!=(ESRecordIndex iOther) const noexcept { return iOther.index_ != index_; }
94 
95  constexpr Value_t value() const noexcept { return index_; }
96 
97  static constexpr Value_t invalidValue() { return std::numeric_limits<Value_t>::max(); }
98 
99  private:
101  };
102  inline std::ostream& operator<<(std::ostream& iOS, ESRecordIndex const& iIndex) {
103  iOS << iIndex.value();
104  return iOS;
105  }
106 
107 } // namespace edm
108 #endif
unsigned int Value_t
Definition: ESIndices.h:82
constexpr ESTokenIndex() noexcept=default
static constexpr Value_t invalidValue()
Definition: ESIndices.h:97
constexpr ESProxyIndex() noexcept=default
constexpr Value_t value() const noexcept
Definition: ESIndices.h:70
Value_t index_
Definition: ESIndices.h:73
constexpr bool operator!=(ESProxyIndex iOther) const noexcept
Definition: ESIndices.h:42
constexpr bool operator!=(ESRecordIndex iOther) const noexcept
Definition: ESIndices.h:93
constexpr bool operator!=(ESTokenIndex iOther) const noexcept
Definition: ESIndices.h:68
constexpr Value_t value() const noexcept
Definition: ESIndices.h:95
HLT enums.
constexpr Value_t value() const noexcept
Definition: ESIndices.h:44
Value_t index_
Definition: ESIndices.h:47
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
constexpr ESRecordIndex() noexcept=default