Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework
v36r11 (bdb84f5f)
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerations
a
c
d
e
f
i
l
m
n
o
p
r
s
t
Enumerator
a
b
c
d
e
f
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Properties
Related Functions
:
a
b
c
d
e
g
h
i
m
o
p
s
t
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
_
b
c
e
f
g
h
i
l
m
n
o
p
r
s
t
u
z
Variables
a
b
c
d
e
g
h
i
m
o
p
r
s
t
v
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
Enumerations
Enumerator
c
e
f
p
u
v
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Hash.h
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#ifndef GAUDIKERNEL_HASH_H
12
#define GAUDIKERNEL_HASH_H 1
13
// ============================================================================
14
// Include files
15
// ============================================================================
16
// STD & STL
17
// ============================================================================
18
#include <cstddef>
19
#include <numeric>
20
// ============================================================================
21
// Boost
22
// ============================================================================
23
#include "boost/functional/hash.hpp"
24
// ============================================================================
25
namespace
GaudiUtils
{
27
// To enable the generic hash for a user defined class, it is enough to add
28
// few lines to the .cpp files that needs them
29
// @code
30
// #include "GaudiKernel/Hash.h"
31
// class MyType;
32
// namespace GaudiUtils {
33
// template <>
34
// struct Hash<MyType>: public GenericHash<MyType> {};
35
// }
36
// @endcode
37
template
<
class
T>
38
struct
GenericHash
{
39
// ========================================================================
41
inline
std::size_t
operator()
(
const
T&
key
)
const
{
42
const
char
* p =
reinterpret_cast<
const
char
*
>
( &
key
);
43
return
std::accumulate
( p, p +
sizeof
( T ),
std::size_t
{ 0 },
44
[](
std::size_t
res,
const
char
&
c
) {
return
( res << 1 ) ^
c
; } );
45
}
46
// ========================================================================
47
};
48
49
// ==========================================================================
102
template
<
class
T>
103
struct
Hash
{
104
// ========================================================================
106
inline
std::size_t
operator()
(
const
T&
key
)
const
;
107
// ========================================================================
108
};
109
// ==========================================================================
111
template
<
class
T>
112
struct
Hash
<T*> {
113
// ========================================================================
115
inline
std::size_t
operator()(
const
T*
key
)
const
;
116
// ========================================================================
117
};
118
// ==========================================================================
120
template
<
class
T,
unsigned
N>
121
struct
Hash
<T ( & )[
N
]> {
122
// ========================================================================
124
inline
std::size_t
operator()
( T ( &
key
)[
N
] )
const
{
return
boost::hash_range(
key
,
key
+
N
); }
125
// ========================================================================
126
};
128
template
<
class
T,
unsigned
N>
129
struct
Hash
<const T ( & )[
N
]> {
130
// ========================================================================
132
inline
std::size_t
operator()
(
const
T ( &
key
)[
N
] )
const
{
return
boost::hash_range(
key
,
key
+
N
); }
133
// ========================================================================
134
};
135
// ==========================================================================
137
template
<
class
T>
138
struct
Hash
<const T> :
public
Hash
<T> {};
140
template
<
class
T>
141
struct
Hash
<const T*> :
public
Hash<T*>
{};
143
template
<
class
T>
144
struct
Hash
<T&> :
public
Hash<T>
{};
146
template
<
class
T>
147
struct
Hash
<const T&> :
public
Hash<T>
{};
148
// ==========================================================================
150
template
<
class
T>
151
inline
std::size_t
Hash<T>::operator()
(
const
T&
key
)
const
{
152
using namespace
boost
;
153
return
hash_value
(
key
);
154
}
156
template
<
class
T>
157
inline
std::size_t
Hash<T*>::operator()
(
const
T*
key
)
const
{
158
using namespace
boost
;
159
return
hash_value
(
key
);
160
}
162
template
<>
163
inline
std::size_t
Hash<char*>::operator()
(
const
char
*
key
)
const
{
164
std::size_t
seed = 0;
165
while
(
key
) {
166
boost::hash_combine( seed, *
key
);
167
++
key
;
168
}
169
return
seed;
170
}
171
172
// ==========================================================================
173
}
// end of namespace GaudiUtils
174
// ============================================================================
175
// The END
176
// ============================================================================
177
#endif // GAUDIKERNEL_HASH_H
GaudiUtils::GenericHash
Generic hash implementation (for easy migration to the new Hash class).
Definition:
Hash.h:38
IOTest.N
int N
Definition:
IOTest.py:115
gaudirun.c
c
Definition:
gaudirun.py:525
boost
Definition:
WatchdogThread.h:24
GaudiUtils::GenericHash::operator()
std::size_t operator()(const T &key) const
the generic hash function
Definition:
Hash.h:41
Tuples::hash_value
std::size_t hash_value(TupleID const &b)
Definition:
TupleID.h:33
GaudiUtils::Hash< T * >
the partial specialization for pointers
Definition:
Hash.h:112
GaudiUtils::Hash::operator()
std::size_t operator()(const T &key) const
the hash-function
Definition:
Hash.h:151
std::accumulate
T accumulate(T... args)
GaudiUtils::Hash< const T(&)[N]>::operator()
std::size_t operator()(const T(&key)[N]) const
the hash-function
Definition:
Hash.h:132
GaudiUtils::Hash
Definition:
Hash.h:103
GaudiUtils::Hash< T(&)[N]>::operator()
std::size_t operator()(T(&key)[N]) const
the hash-function
Definition:
Hash.h:124
std::size_t
GaudiUtils
Definition:
GaudiHistoID.h:145
ProduceConsume.key
key
Definition:
ProduceConsume.py:81
GaudiKernel
include
GaudiKernel
Hash.h
Generated on Mon Feb 27 2023 19:04:38 for The Gaudi Framework by
1.8.18