File indexing completed on 2024-04-06 12:13:12
0001 #ifndef FWCore_Utilities_ESGetTokenGeneric_h
0002 #define FWCore_Utilities_ESGetTokenGeneric_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "FWCore/Utilities/interface/ESIndices.h"
0017 #include "FWCore/Utilities/interface/TypeIDBase.h"
0018 #include <limits>
0019
0020 namespace edm {
0021 class EDConsumerBase;
0022 class EventSetup;
0023 class EventSetupImpl;
0024 namespace eventsetup {
0025 class EventSetupRecord;
0026 }
0027
0028
0029
0030 class ESGetTokenGeneric {
0031 friend class EDConsumerBase;
0032 friend class EventSetup;
0033 friend class EventSetupImpl;
0034 friend class eventsetup::EventSetupRecord;
0035
0036 public:
0037 constexpr ESGetTokenGeneric() noexcept = default;
0038
0039 constexpr ESGetTokenGeneric(ESGetTokenGeneric const&) noexcept = default;
0040 constexpr ESGetTokenGeneric(ESGetTokenGeneric&&) noexcept = default;
0041
0042 constexpr ESGetTokenGeneric& operator=(ESGetTokenGeneric&&) noexcept = default;
0043 constexpr ESGetTokenGeneric& operator=(ESGetTokenGeneric const&) noexcept = default;
0044
0045 constexpr unsigned int transitionID() const noexcept { return m_transitionID; }
0046 constexpr TypeIDBase const& recordType() const noexcept { return m_recordType; }
0047 constexpr bool isInitialized() const noexcept { return transitionID() != std::numeric_limits<unsigned int>::max(); }
0048 constexpr ESTokenIndex index() const noexcept { return m_index; }
0049 constexpr bool hasValidIndex() const noexcept { return index() != invalidIndex(); }
0050 static constexpr ESTokenIndex invalidIndex() noexcept { return ESTokenIndex{std::numeric_limits<int>::max()}; }
0051
0052 private:
0053 explicit constexpr ESGetTokenGeneric(unsigned int transitionID,
0054 ESTokenIndex index,
0055 TypeIDBase const& recordType) noexcept
0056 : m_recordType{recordType}, m_transitionID{transitionID}, m_index{index} {}
0057
0058 TypeIDBase m_recordType{};
0059 unsigned int m_transitionID{std::numeric_limits<unsigned int>::max()};
0060 ESTokenIndex m_index{std::numeric_limits<int>::max()};
0061 };
0062
0063 }
0064
0065 #endif