![]() |
(git:b77b4be)
|
A simple hash table of integer keys, using hash function: H(k) = (k*p) mod n + 1 where: k = key p = a prime number >= n n = size of the hash table And collision resolvation is done by open addressing with linear probing. More...
Data Types | |
type | fb_hash_table_obj |
the object container which allows for the creation of an array of pointers to fb_hash_table objects More... | |
Functions/Subroutines | |
recursive subroutine, public | fb_hash_table_add (hash_table, key, val) |
Add element to a hash table, auto resize if necessary. | |
subroutine, public | fb_hash_table_create (hash_table, nmax) |
Creates and initialises an empty fb_hash_table object. | |
subroutine, public | fb_hash_table_get (hash_table, key, val, found) |
Retrieve value from a key from a hash table. | |
pure logical function, public | fb_hash_table_has_data (hash_table) |
check if the object has data associated to it | |
pure subroutine, public | fb_hash_table_nullify (hash_table) |
Nullifies a fb_hash_table object. | |
subroutine, public | fb_hash_table_release (hash_table) |
releases given object | |
A simple hash table of integer keys, using hash function: H(k) = (k*p) mod n + 1 where: k = key p = a prime number >= n n = size of the hash table And collision resolvation is done by open addressing with linear probing.
The table consists of an array of (key,val) pairs, and there are no intermediate buckets. For every new entry (k,v): We first look up slot H(k), and if it already contains an entry, then move to the next empty slot using a predefined linear probing sequence (e.g. iterate from slots H(k) to n, and then 1 to H(k)-1). When we look up, we use the same probing sequence.
recursive subroutine, public qs_fb_hash_table_types::fb_hash_table_add | ( | type(fb_hash_table_obj), intent(inout) | hash_table, |
integer(kind=int_8), intent(in) | key, | ||
integer, intent(in) | val | ||
) |
Add element to a hash table, auto resize if necessary.
hash_table | : the fb_hash_table object |
key | : key of the element |
val | : value of the element |
Definition at line 105 of file qs_fb_hash_table_types.F.
subroutine, public qs_fb_hash_table_types::fb_hash_table_create | ( | type(fb_hash_table_obj), intent(inout) | hash_table, |
integer, intent(in), optional | nmax | ||
) |
Creates and initialises an empty fb_hash_table object.
hash_table | : the fb_hash_table object, its content must be NULL and cannot be UNDEFINED |
nmax | : total size of the table, optional. If absent default size is 1. |
Definition at line 141 of file qs_fb_hash_table_types.F.
subroutine, public qs_fb_hash_table_types::fb_hash_table_get | ( | type(fb_hash_table_obj), intent(in) | hash_table, |
integer(kind=int_8), intent(in) | key, | ||
integer, intent(out) | val, | ||
logical, intent(out) | found | ||
) |
Retrieve value from a key from a hash table.
hash_table | : the fb_hash_table object |
key | : input key |
val | : output value, equals to 0 if key not found |
found | : .TRUE. if key is found, .FALSE. otherwise |
Definition at line 170 of file qs_fb_hash_table_types.F.
pure logical function, public qs_fb_hash_table_types::fb_hash_table_has_data | ( | type(fb_hash_table_obj), intent(in) | hash_table | ) |
check if the object has data associated to it
hash_table | : the fb_hash_table object in question |
Definition at line 198 of file qs_fb_hash_table_types.F.
pure subroutine, public qs_fb_hash_table_types::fb_hash_table_nullify | ( | type(fb_hash_table_obj), intent(inout) | hash_table | ) |
Nullifies a fb_hash_table object.
hash_table | : the fb_hash_table object |
Definition at line 254 of file qs_fb_hash_table_types.F.
subroutine, public qs_fb_hash_table_types::fb_hash_table_release | ( | type(fb_hash_table_obj), intent(inout) | hash_table | ) |
releases given object
hash_table | : the fb_hash_table object in question |
Definition at line 304 of file qs_fb_hash_table_types.F.