29 #ifndef GUM_HASH_FUNC_H 30 #define GUM_HASH_FUNC_H 35 #include <type_traits> 77 sizeof(
Size) == 4 ?
Size(2654435769UL) :
Size(11400714819323198486UL);
79 sizeof(
Size) == 4 ?
Size(3373259426UL) :
Size(14488038916154245684UL);
81 sizeof(
Size) == 4 ?
Size(4294967295UL) :
Size(18446744073709551615UL);
148 template <
typename Key >
166 void resize(
const Size new_size);
197 virtual Size operator()(
const Key& key)
const = 0;
204 unsigned int _hash_log2_size{0};
226 unsigned int _right_shift{0};
241 template <
typename Key >
254 static Size castToSize(
const Key& key);
261 virtual Size operator()(
const Key& key)
const override final;
273 template <
typename Key >
286 static Size castToSize(
const Key& key);
293 virtual Size operator()(
const Key& key)
const override final;
300 static constexpr
Size _small_key_mask{(
Size(1) << (8 *
sizeof(Key)))
313 template <
typename Key >
326 static Size castToSize(
const Key& key);
333 virtual Size operator()(
const Key& key)
const override final;
345 template <
typename Key >
358 static Size castToSize(
const Key& key);
365 virtual Size operator()(
const Key& key)
const override final;
381 template <
typename Key >
384 using type =
typename std::conditional<
385 sizeof(Key) <=
sizeof(
Size) && std::is_integral< Key >::value,
387 typename std::conditional<
388 sizeof(Key) <
sizeof(
Size),
390 typename std::conditional<
391 sizeof(Key) ==
sizeof(
Size),
393 typename std::conditional<
sizeof(Key) == 2 *
sizeof(
Size),
404 template <
typename Key >
408 template <
typename... >
412 template <
typename Key >
418 template <
typename KEY_TYPE,
typename TYPE >
420 using type =
typename std::conditional< std::is_same< KEY_TYPE, TYPE >::value,
446 template <
typename KEY_TYPE,
typename FIRST_TYPE,
typename... OTHER_TYPES >
448 using type =
typename std::conditional<
449 std::is_same< KEY_TYPE, FIRST_TYPE >::value,
470 template <
typename key >
481 template <
typename Key1,
typename Key2 >
490 static Size castToSize(
const std::pair< Key1, Key2 >& key);
498 operator()(
const std::pair< Key1, Key2 >& key)
const override final;
580 template <
typename Type >
596 static Size castToSize(
const std::string& key);
603 virtual Size operator()(
const std::string& key)
const override final;
621 static Size castToSize(
const std::vector< Idx >& key);
628 virtual Size operator()(
const std::vector< Idx >& key)
const override final;
645 static Size castToSize(
const Debug& key);
652 virtual Size operator()(
const Debug& key)
const override final;
654 template <
typename OTHER_KEY >
665 template <
typename Type >
687 #ifndef GUM_NO_INLINE
unsigned int __hashTableLog2(const Size nb)
Returns the size in bits - 1 necessary to store the smallest power of 2 greater than or equal to nb...
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
static constexpr Size offset
Generic hash functions for keys castable as Size and whose size is precisely twice that of Size...
static constexpr Size gold
typename std::conditional< std::is_same< KEY_TYPE, FIRST_TYPE >::value, dummyHash< KEY_TYPE >, typename HashFuncConditionalType< KEY_TYPE, OTHER_TYPES... >::type >::type type
static constexpr Size mask
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Class template representing hashing function of LpCol.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Generic hash functions for keys castable as Size whose size is either smaller than Size...
Generic hash functions for keys castable as Size and whose size is precisely that of Size...
Smart pointersaGrUM's smart pointers keep track of the number of times the value they point to is ref...
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Useful constants for hash functions.
Generic hash functions for numeric keys smaller than or equal to Size.
typename std::conditional< std::is_same< KEY_TYPE, TYPE >::value, dummyHash< KEY_TYPE >, KEY_TYPE >::type type
All hash functions should inherit from this class.
typename std::conditional< sizeof(Key)<=sizeof(Size) &&std::is_integral< Key >::value, HashFuncSmallKey< Key >, typename std::conditional< sizeof(Key)< sizeof(Size), HashFuncSmallCastKey< Key >, typename std::conditional< sizeof(Key)==sizeof(Size), HashFuncMediumCastKey< Key >, typename std::conditional< sizeof(Key)==2 *sizeof(Size), HashFuncLargeCastKey< Key >, void >::type >::type >::type >::type type
The type used by this class.
This class enables to safely define hash functions for types that may or may not already has defined ...
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Generic hash functions for keys castable as Size and whose size is strictly smaller than that of Size...