aGrUM  0.16.0
gum::HashFunc< learning::EdgeAddition > Class Template Reference

the hash function for Edge Additions More...

#include <graphChange.h>

+ Inheritance diagram for gum::HashFunc< learning::EdgeAddition >:
+ Collaboration diagram for gum::HashFunc< learning::EdgeAddition >:

Public Member Functions

void resize (const Size new_size)
 Update the hash function to take into account a resize of the hash table. More...
 
Size size () const
 Returns the hash table size as known by the hash function. More...
 

Protected Attributes

Size _hash_size
 The size of the hash table. More...
 
unsigned int _hash_log2_size
 Log of the number of slots of the hash table in base 2. More...
 
Size _hash_mask
 performing y = x & _hash_mask guarantees that y is a slot index of the hash table More...
 
unsigned int _right_shift
 performing y = x >> _right_shift guarantees that y is a slot index of the hash table More...
 

Detailed Description

template<>
class gum::HashFunc< learning::EdgeAddition >

the hash function for Edge Additions

Definition at line 551 of file graphChange.h.

Member Function Documentation

◆ castToSize()

static Size gum::HashFunc< learning::EdgeAddition >::castToSize ( const learning::EdgeAddition key)
staticprivate

Returns the value of a key as a Size.

Parameters
keyThe value to return as a Size.
Returns
Returns the value of a key as a Size.

◆ operator()()

virtual Size gum::HashFunc< learning::EdgeAddition >::operator() ( const learning::EdgeAddition key) const
finaloverrideprivatevirtual

computes the hashed value of a key

Implements gum::HashFuncBase< learning::EdgeAddition >.

◆ resize()

void gum::HashFuncBase< learning::EdgeAddition >::resize ( const Size  new_size)
inherited

Update the hash function to take into account a resize of the hash table.

When the user wishes to resize the gum::HashTable so that the array is of size s, the gum::HashTable resizes itself to the smallest power of 2 greater than or equal to s. This new size is computed by function gum::HashFuncBase::resize(gum::Size). Hence, s should be the size of the array of lists, not the number of elements stored into the gum::HashTable.

Parameters
new_sizeThe hashtable's size wished by the user. Actually, a hashtable of size n is an array of n lists.
Exceptions
SizeErrorRaised if s is too small.

◆ size()

Size gum::HashFuncBase< learning::EdgeAddition >::size ( ) const
inherited

Returns the hash table size as known by the hash function.

Returns
Returns the size of the hash table, i.e., the number of slots (lists) it contains.

Member Data Documentation

◆ _hash_log2_size

unsigned int gum::HashFuncBase< learning::EdgeAddition >::_hash_log2_size
protectedinherited

Log of the number of slots of the hash table in base 2.

Definition at line 204 of file hashFunc.h.

◆ _hash_mask

Size gum::HashFuncBase< learning::EdgeAddition >::_hash_mask
protectedinherited

performing y = x & _hash_mask guarantees that y is a slot index of the hash table

To transform a Size x into a slot index of the hash table, you can either use x & _hash_mask or x >> _right_shift depending on whether you want to exploit the least significant bits of x (&) or the most significant one (>>).

Definition at line 215 of file hashFunc.h.

◆ _hash_size

Size gum::HashFuncBase< learning::EdgeAddition >::_hash_size
protectedinherited

The size of the hash table.

Definition at line 201 of file hashFunc.h.

◆ _right_shift

unsigned int gum::HashFuncBase< learning::EdgeAddition >::_right_shift
protectedinherited

performing y = x >> _right_shift guarantees that y is a slot index of the hash table

To transform a Size x into a slot index of the hash table, you can either use x & _hash_mask or x >> _right_shift depending on whether you want to exploit the least significant bits of x (&) or the most significant one (>>).

Definition at line 226 of file hashFunc.h.


The documentation for this class was generated from the following file: