GaudiUtils::Hash< T > Class Template Reference
#include <GaudiKernel/Hash.h>
List of all members.
Detailed Description
template<class T>
class GaudiUtils::Hash< T >
Simple hash function based on Stroustrup example.
It provides correct handling of pointers, std::string and char*.
- Author:
- Marco Clemencic
- Date:
- 2005-10-07
Definition at line 21 of file Hash.h.
Member Enumeration Documentation
- Enumerator:
-
Definition at line 25 of file Hash.h.
Member Function Documentation
Definition at line 58 of file Hash.h.
00058 {
00059 size_t res = 0 ;
00060 size_t len = sizeof(T) ;
00061 const char* p = reinterpret_cast<const char*>( &key );
00062 while( len-- ) { res = ( res << 1 ) ^ *p; ++p; }
00063 return res;
00064 }
template<class T>
| bool GaudiUtils::Hash< T >::operator() |
( |
const T & |
key1, |
|
|
const T & |
key2 | |
|
) |
| | const [inline] |
Definition at line 29 of file Hash.h.
00029 {
00030
00031 return comp(key1,key2);
00032 }
Definition at line 67 of file Hash.h.
00067 { return (size_t)key; }
Definition at line 70 of file Hash.h.
00070 { return (size_t)key; }
Definition at line 73 of file Hash.h.
00073 { return (size_t)key; }
Definition at line 76 of file Hash.h.
00076 { return (size_t)key; }
Definition at line 79 of file Hash.h.
00079 { return (size_t)key; }
Definition at line 82 of file Hash.h.
00082 { return (size_t)key; }
Definition at line 96 of file Hash.h.
00096 {
00097 size_t res = 0 ;
00098 std::string::const_iterator e = key.end();
00099 std::string::const_iterator p = key.begin();
00100 while( p != e ) { res = ( res << 1 ) ^ *p; ++p; }
00101 return res;
00102 }
Definition at line 105 of file Hash.h.
00105 {
00106 size_t res = 0 ;
00107 if ( 0 == key ) { return 0; }
00108 while ( *key ) { res = ( res << 1 ) ^ *key; ++key; }
00109 return res;
00110 }
Member Data Documentation
comparison operator needed for VC++
Definition at line 35 of file Hash.h.
The documentation for this class was generated from the following file:
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r4/GaudiKernel/GaudiKernel/Hash.h