ATLAS Offline Software
CxxUtils/CxxUtils/sgkey_t.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 /*
3  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4 */
18 #ifndef CXXUTILS_SGKEY_T_H
19 #define CXXUTILS_SGKEY_T_H
20 
21 
22 #include <cstdint>
23 #include <cstddef>
24 #include <unordered_map>
25 #include <unordered_set>
26 
27 
28 namespace SG {
29 
30 
32 typedef uint32_t sgkey_t;
33 
34 
38 inline
39 constexpr bool sgkeyEqual (const sgkey_t a, const sgkey_t b)
40 {
41  return a == b;
42 }
43 
44 
48 inline
49 constexpr bool sgkeyLess (const sgkey_t a, const sgkey_t b)
50 {
51  return a < b;
52 }
53 
54 
58 struct SGKeyHash
59 {
60  inline
61  constexpr size_t operator() (const sgkey_t k) const
62  {
63  return k;
64  }
65 };
66 
67 
71 struct SGKeyEqual
72 {
73  inline
74  constexpr bool operator() (const sgkey_t a, const sgkey_t b) const
75  {
76  return sgkeyEqual (a, b);
77  }
78 };
79 
80 
84 inline
85 constexpr uint32_t sgkeyShort (const sgkey_t k)
86 {
87  return k;
88 }
89 
90 
92 template <class T>
93 using SGKeyMap = std::unordered_map<sgkey_t, T>;
94 
95 
97 using SGKeySet = std::unordered_set<sgkey_t>;
98 
99 
100 } // namespace SG
101 
102 
103 #endif // not CXXUTILS_SGKEY_T_H
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
SG::SGKeyHash
Hash functional for sgkey_t.
Definition: CxxUtils/CxxUtils/sgkey_t.h:59
SG::sgkeyLess
constexpr bool sgkeyLess(const sgkey_t a, const sgkey_t b)
Compare two sgkeys for ordering.
Definition: CxxUtils/CxxUtils/sgkey_t.h:49
SG::sgkeyShort
constexpr uint32_t sgkeyShort(const sgkey_t k)
Convert a sgkey to the 32-bit form used for older data.
Definition: CxxUtils/CxxUtils/sgkey_t.h:85
SG::SGKeyEqual::operator()
constexpr bool operator()(const sgkey_t a, const sgkey_t b) const
Definition: CxxUtils/CxxUtils/sgkey_t.h:74
SG::SGKeySet
std::unordered_set< sgkey_t > SGKeySet
A set of sgkey_t values.
Definition: CxxUtils/CxxUtils/sgkey_t.h:97
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
SG::sgkey_t
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition: CxxUtils/CxxUtils/sgkey_t.h:32
a
TList * a
Definition: liststreamerinfos.cxx:10
SG::SGKeyMap
std::unordered_map< sgkey_t, T > SGKeyMap
A map using sgkey_t as a key.
Definition: CxxUtils/CxxUtils/sgkey_t.h:93
SG::SGKeyHash::operator()
constexpr size_t operator()(const sgkey_t k) const
Definition: CxxUtils/CxxUtils/sgkey_t.h:61
SG::sgkeyEqual
constexpr bool sgkeyEqual(const sgkey_t a, const sgkey_t b)
Compare two sgkeys for equality.
Definition: CxxUtils/CxxUtils/sgkey_t.h:39
fitman.k
k
Definition: fitman.py:528
SG::SGKeyEqual
Comparison functional for sgkey_t.
Definition: CxxUtils/CxxUtils/sgkey_t.h:72