20 #ifndef _libint2_src_bin_libint_hashable_h_ 21 #define _libint2_src_bin_libint_hashable_h_ 23 #include <libint2/intrinsic_types.h> 31 template <KeyManagePolicy KeyManage>
struct OwnKey {
enum {result=
false}; };
32 template<>
struct OwnKey<CacheKey> {
enum {result=
true}; };
35 template <
class T,
bool HasAKey>
59 typedef const std::string& ReturnType;
62 template <
typename T,
size_t Size>
65 typedef const T*
const ReturnType;
71 template <
typename KeyType, KeyManagePolicy KeyMP>
75 typedef typename KeyTraits<KeyType>::ReturnType KeyReturnType;
80 virtual KeyReturnType key()
const =0;
96 inline LIBINT2_UINT_LEAST64 hash(
const std::string& S);
100 static const LIBINT2_UINT_LEAST64 hval_init = 0xcbf29ce484222325UL;
101 static const LIBINT2_UINT_LEAST64 fnv_prime64 = 0x100000001b3UL;
103 static const LIBINT2_UINT_LEAST64 hval_init = 0xcbf29ce484222325ULL;
104 static const LIBINT2_UINT_LEAST64 fnv_prime64 = 0x100000001b3ULL;
106 LIBINT2_UINT_LEAST64 hval_;
111 const unsigned char* cS =
reinterpret_cast<const unsigned char*
>(S.c_str());
112 const unsigned char* cptr = cS;
114 hval_ ^= (LIBINT2_UINT_LEAST64)*cptr;
116 hval_ *= fnv_prime64;
KeyTraits<T> describes following properties of type T: 1) how to return objects of type T...
Definition: hashable.h:51
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:23
Objects of Hashable<T> class provide hashing function key() which computes keys of type KeyType...
Definition: hashable.h:72
Definition: stdarray.h:18
KeyManagePolicy
KeyManagePolicy defines whether to compute+cache, compute, or key is just an object.
Definition: hashable.h:28
FNVStringHash uses Fowler/Noll/Vo algorithm to hash a char string to a 64-bit integer.
Definition: hashable.h:87
LIBINT2_UINT_LEAST64 KeyType
The type of key computed using this hash.
Definition: hashable.h:90
use OwnKey to figure out whether the key should be stored in Hashable
Definition: hashable.h:31
If OwnsKey is true then KeyStore<T> has the key of type T, otherwise it's empty.
Definition: hashable.h:36
LIBINT2_UINT_LEAST64 hash(const std::string &S)
Returns 64-bit integer hash of S.
Definition: hashable.h:110