1 #ifndef GAUDIKERNEL_HASH_H
2 #define GAUDIKERNEL_HASH_H 1
12 #include "boost/functional/hash.hpp"
28 struct GenericHash :
public std::unary_function<T,std::size_t>
32 inline std::size_t
operator() (
const T& key )
const {
34 std::size_t len =
sizeof(T) ;
35 const char* p =
reinterpret_cast<const char*
>( &key );
36 while( len-- ) { res = ( res << 1 ) ^ *p; ++p; }
96 struct Hash :
public std::unary_function<T,std::size_t>
100 inline std::size_t
operator() (
const T& key )
const;
106 struct Hash<T*> :
public std::unary_function<const T*,std::size_t>
110 inline std::size_t operator() (
const T* key )
const;
115 template <
class T,
unsigned N>
116 struct Hash<T(&)[
N]> :
public std::unary_function<T(&)[
N],std::size_t>
120 inline std::size_t operator() ( T (&key) [
N] )
const
121 {
return boost::hash_range ( key , key + N ) ; }
125 template <
class T,
unsigned N>
126 struct Hash<const T(&)[
N]> :
public std::unary_function<
const T(&)[
N],std::size_t>
130 inline std::size_t operator() (
const T (&key) [
N] )
const
131 {
return boost::hash_range ( key , key + N ) ; }
137 struct Hash<const T> :
public Hash<T> {} ;
140 struct Hash<const T*> :
public Hash<T*> {} ;
143 struct Hash<T&> :
public Hash<T> {} ;
146 struct Hash<const T&> :
public Hash<T> {} ;
152 using namespace boost ;
159 using namespace boost ;
166 std::size_t seed = 0 ;
167 while ( key ) { boost::hash_combine ( seed , *key ) ; ++key ; }
176 #endif // GAUDIKERNEL_HASH_H
The namespace threadpool contains a thread pool and related utility classes.
std::size_t hash_value(const Gaudi::StringKey &key)
hash-function: heeded for boost::hash
std::size_t operator()(const T &key) const
the generic hash function
std::size_t operator()(const T &key) const
the hash-function
Forward declarations for the functions in SerializeSTL.h.