(git:c5411e0)
Loading...
Searching...
No Matches
qs_fb_hash_table_types Module Reference

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
 

Detailed Description

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.

Function/Subroutine Documentation

◆ fb_hash_table_add()

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.

Parameters
hash_table: the fb_hash_table object
key: key of the element
val: value of the element
Author
Lianheng Tong (LT) lianh.nosp@m.eng..nosp@m.tong@.nosp@m.kcl..nosp@m.ac.uk

Definition at line 105 of file qs_fb_hash_table_types.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_hash_table_create()

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.

Parameters
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.
Author
Lianheng Tong (LT) lianh.nosp@m.eng..nosp@m.tong@.nosp@m.kcl..nosp@m.ac.uk

Definition at line 141 of file qs_fb_hash_table_types.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_hash_table_get()

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.

Parameters
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
Author
Lianheng Tong (LT) lianh.nosp@m.eng..nosp@m.tong@.nosp@m.kcl..nosp@m.ac.uk

Definition at line 170 of file qs_fb_hash_table_types.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_hash_table_has_data()

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

Parameters
hash_table: the fb_hash_table object in question
Returns
: true if hash_tableobj is associated, false otherwise
Author
Lianheng Tong (LT) lianh.nosp@m.eng..nosp@m.tong@.nosp@m.kcl..nosp@m.ac.uk

Definition at line 198 of file qs_fb_hash_table_types.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_hash_table_nullify()

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.

Parameters
hash_table: the fb_hash_table object
Author
Lianheng Tong (LT) lianh.nosp@m.eng..nosp@m.tong@.nosp@m.kcl..nosp@m.ac.uk

Definition at line 254 of file qs_fb_hash_table_types.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_hash_table_release()

subroutine, public qs_fb_hash_table_types::fb_hash_table_release ( type(fb_hash_table_obj), intent(inout)  hash_table)

releases given object

Parameters
hash_table: the fb_hash_table object in question
Author
Lianheng Tong (LT) lianh.nosp@m.eng..nosp@m.tong@.nosp@m.kcl..nosp@m.ac.uk

Definition at line 304 of file qs_fb_hash_table_types.F.

Here is the call graph for this function:
Here is the caller graph for this function: