File indexing completed on 2024-04-06 12:13:12
0001 #ifndef FWCore_Utilities_ESIndices_h
0002 #define FWCore_Utilities_ESIndices_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include <limits>
0025 #include <ostream>
0026
0027
0028
0029 namespace edm {
0030 class ESResolverIndex {
0031 public:
0032 using Value_t = int;
0033 constexpr ESResolverIndex() noexcept = default;
0034 constexpr explicit ESResolverIndex(Value_t iValue) noexcept : index_{iValue} {}
0035 constexpr ESResolverIndex(ESResolverIndex const&) noexcept = default;
0036 constexpr ESResolverIndex(ESResolverIndex&&) noexcept = default;
0037
0038 constexpr ESResolverIndex& operator=(ESResolverIndex const&) noexcept = default;
0039 constexpr ESResolverIndex& operator=(ESResolverIndex&&) noexcept = default;
0040
0041 constexpr bool operator==(ESResolverIndex iOther) const noexcept { return iOther.index_ == index_; }
0042 constexpr bool operator!=(ESResolverIndex iOther) const noexcept { return iOther.index_ != index_; }
0043
0044 constexpr Value_t value() const noexcept { return index_; }
0045
0046 private:
0047 Value_t index_ = std::numeric_limits<int>::max();
0048 };
0049
0050 inline std::ostream& operator<<(std::ostream& iOS, ESResolverIndex const& iIndex) {
0051 iOS << iIndex.value();
0052 return iOS;
0053 }
0054
0055 class ESTokenIndex {
0056 public:
0057 using Value_t = int;
0058
0059 constexpr ESTokenIndex() noexcept = default;
0060 constexpr explicit ESTokenIndex(Value_t iValue) noexcept : index_{iValue} {}
0061 constexpr ESTokenIndex(ESTokenIndex const&) noexcept = default;
0062 constexpr ESTokenIndex(ESTokenIndex&&) noexcept = default;
0063
0064 constexpr ESTokenIndex& operator=(ESTokenIndex const&) noexcept = default;
0065 constexpr ESTokenIndex& operator=(ESTokenIndex&&) noexcept = default;
0066
0067 constexpr bool operator==(ESTokenIndex iOther) const noexcept { return iOther.index_ == index_; }
0068 constexpr bool operator!=(ESTokenIndex iOther) const noexcept { return iOther.index_ != index_; }
0069
0070 constexpr Value_t value() const noexcept { return index_; }
0071
0072 private:
0073 Value_t index_ = std::numeric_limits<Value_t>::max();
0074 };
0075 inline std::ostream& operator<<(std::ostream& iOS, ESTokenIndex const& iIndex) {
0076 iOS << iIndex.value();
0077 return iOS;
0078 }
0079
0080 class ESRecordIndex {
0081 public:
0082 using Value_t = unsigned int;
0083
0084 constexpr ESRecordIndex() noexcept = default;
0085 constexpr explicit ESRecordIndex(unsigned int iValue) noexcept : index_{iValue} {}
0086 constexpr ESRecordIndex(ESRecordIndex const&) noexcept = default;
0087 constexpr ESRecordIndex(ESRecordIndex&&) noexcept = default;
0088
0089 constexpr ESRecordIndex& operator=(ESRecordIndex const&) noexcept = default;
0090 constexpr ESRecordIndex& operator=(ESRecordIndex&&) noexcept = default;
0091
0092 constexpr bool operator==(ESRecordIndex iOther) const noexcept { return iOther.index_ == index_; }
0093 constexpr bool operator!=(ESRecordIndex iOther) const noexcept { return iOther.index_ != index_; }
0094
0095 constexpr Value_t value() const noexcept { return index_; }
0096
0097 static constexpr Value_t invalidValue() { return std::numeric_limits<Value_t>::max(); }
0098
0099 private:
0100 Value_t index_ = std::numeric_limits<Value_t>::max();
0101 };
0102 inline std::ostream& operator<<(std::ostream& iOS, ESRecordIndex const& iIndex) {
0103 iOS << iIndex.value();
0104 return iOS;
0105 }
0106
0107 }
0108 #endif