Elmer FEM solver
Elmer is an open source finite element software for multiphysical problems
 All Classes Files Functions Variables Typedefs Macros Groups Pages
hashtable Module Reference

Data Types

type  hashbucket_t
 
type  hashentry_t
 
type  hashtable_t
 
type  hashvalue_t
 

Public Member Functions

type(hashtable_t) function, pointer hashcreate (InitialBucketSize, MaxAvgEntries)
 
integer function hashstringfunc (key, size)
 
logical function hashequalkeys (key1, key2)
 
type(hashentry_t) function, pointer hashfind (hash, key, n)
 
recursive function hashadd (hash, key, value)
 
subroutine hashremove (Hash, key)
 
subroutine hashclean (hash)
 
subroutine hashdelete (Hash)
 
recursive function hashrebuild (hash)
 
type(hashvalue_t) function, pointer hashvalue (Hash, key)
 
subroutine hashinitwalk (Hash)
 
type(hashentry_t) function, pointer hashnext (Hash)
 

Member Function/Subroutine Documentation

recursive function hashtable::hashadd ( type(hashtable_t), pointer  hash,
character(len=*)  key,
type(hashvalue_t), pointer  value 
)

Add an entry to a hash table. If the key is already in the table just change the "value" pointer.

The hash table entries contain a "key" and an associated "value". Currently the (key) and value entries are not copied to the hash table, but only pointers to them are being stored. So one should not alter the memory where the components are actually stored after adding them to the hash table. Note that, potential problems in this respect are, for example, automatic variables in functions.

References messages::error(), hashfind(), and hashrebuild().

Referenced by checkkeyword(), and hashrebuild().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine hashtable::hashclean ( type(hashtable_t), pointer  hash)

Clean all entries from the hash table, the bucket array is kept. One may start refilling the hash table directly after cleaning.

Referenced by hashdelete(), and hashrebuild().

Here is the caller graph for this function:

type(hashtable_t) function, pointer hashtable::hashcreate ( integer  InitialBucketSize,
integer  MaxAvgEntries 
)

Initialize a hash table given initial bucket size. The size of the bucket is rounded up to next power of two. The bucket doubles in size whenever the size of the hash table grows over "MaxAvgEntries" entries / bucket on the average. Keep the "MaxAvgEntries" small enough (ordinarily from 3 entries up ?) to keep the hash table build & lookup reasonably quick.

The hash table entries contain a "key" and an associated "value". Currently the value structures are not copied to the hash table, but only pointers to them are being stored. So one should not alter the memory where the components are actually stored after adding them to the hash table. Note that, potential problems in this respect are, among others, automatic variables in functions. (C-Version: Bright side is, that the "value" entries may be whatsoever as you manage them yourself...)

References messages::error().

Referenced by checkkeyword(), and hashrebuild().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine hashtable::hashdelete ( type(hashtable_t), pointer  Hash)

Delete a hash table by removing all the entries and freeing the bucket and hash structures.

References hashclean().

Here is the call graph for this function:

logical function hashtable::hashequalkeys ( character(len=*)  key1,
character(len=*)  key2 
)

Return equality of given two strings. This is for internal use only.

Referenced by checkkeyword(), hashfind(), and hashremove().

Here is the caller graph for this function:

type(hashentry_t) function, pointer hashtable::hashfind ( type(hashtable_t), pointer  hash,
character(len=*)  key,
integer  n 
)

Search for a key from a hash table, return value is pointer to the entry or NULL if not found. Bucket number of the entry (if found) is given in int *bucket. This is for internal use only.

References hashequalkeys(), and hashstringfunc().

Referenced by hashadd(), and hashvalue().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine hashtable::hashinitwalk ( type(hashtable_t), pointer  Hash)

Initialize hash table walk through.

type(hashentry_t) function, pointer hashtable::hashnext ( type(hashtable_t), pointer  Hash)

Return pointer to "next" entry in a hash table. The walk must be initialized with a call to HashInitWalk. The "key" and "value" of the table entry may be referenced as follows:

recursive function hashtable::hashrebuild ( type(hashtable_t), pointer  hash)

Rebuild a hash table using a larger bucket array. This is for internal use only.

References hashadd(), hashclean(), and hashcreate().

Referenced by hashadd().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine hashtable::hashremove ( type(hashtable_t), pointer  Hash,
character(len=*)  key 
)

Remove an entry from a hash table given key of the entry.

References hashequalkeys(), and hashstringfunc().

Here is the call graph for this function:

integer function hashtable::hashstringfunc ( character(len=*)  key,
integer  size 
)

Generate index to a hash table from given string. Hash table size is assumed to be a power of two.

Referenced by hashfind(), and hashremove().

Here is the caller graph for this function:

type(hashvalue_t) function, pointer hashtable::hashvalue ( type(hashtable_t), pointer  Hash,
character(len=*)  key 
)

Given a "key" to hash table return pointer to the "value" memory or NULL if not found in the table.

References hashfind().

Referenced by checkkeyword().

Here is the call graph for this function:

Here is the caller graph for this function:


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