ATLAS Offline Software
Loading...
Searching...
No Matches
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*/
16
17
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
28namespace SG {
29
30
32typedef uint32_t sgkey_t;
33
34
38inline
39constexpr bool sgkeyEqual (const sgkey_t a, const sgkey_t b)
40{
41 return a == b;
42}
43
44
48inline
49constexpr bool sgkeyLess (const sgkey_t a, const sgkey_t b)
50{
51 return a < b;
52}
53
54
59{
60 inline
61 constexpr size_t operator() (const sgkey_t k) const
62 {
63 return k;
64 }
65};
66
67
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
84inline
85constexpr uint32_t sgkeyShort (const sgkey_t k)
86{
87 return k;
88}
89
90
92template <class T>
93using SGKeyMap = std::unordered_map<sgkey_t, T>;
94
95
97using SGKeySet = std::unordered_set<sgkey_t>;
98
99
100} // namespace SG
101
102
103#endif // not CXXUTILS_SGKEY_T_H
static Double_t a
Forward declaration.
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition sgkey_t.h:32
std::unordered_set< sgkey_t > SGKeySet
A set of sgkey_t values.
Definition sgkey_t.h:97
constexpr uint32_t sgkeyShort(const sgkey_t k)
Convert a sgkey to the 32-bit form used for older data.
Definition sgkey_t.h:85
constexpr bool sgkeyEqual(const sgkey_t a, const sgkey_t b)
Compare two sgkeys for equality.
Definition sgkey_t.h:39
std::unordered_map< sgkey_t, T > SGKeyMap
A map using sgkey_t as a key.
Definition sgkey_t.h:93
constexpr bool sgkeyLess(const sgkey_t a, const sgkey_t b)
Compare two sgkeys for ordering.
Definition sgkey_t.h:49
Comparison functional for sgkey_t.
Definition sgkey_t.h:72
constexpr bool operator()(const sgkey_t a, const sgkey_t b) const
Definition sgkey_t.h:74
Hash functional for sgkey_t.
Definition sgkey_t.h:59
constexpr size_t operator()(const sgkey_t k) const
Definition sgkey_t.h:61