programmer's documentation
Functions
mei_hash_table.c File Reference

Hash table, intended to provide a symbol table. More...

#include <stdio.h>
#include <string.h>
#include <math.h>
#include "bft_mem.h"
#include "bft_error.h"
#include "mei_math_util.h"
#include "mei_hash_table.h"
Include dependency graph for mei_hash_table.c:

Functions

void mei_hash_table_create (hash_table_t *const htable, const int modulo)
 Initialize the hash table to the size (modulo) asked for. Allocates space for the correct number of pointers and sets them to NULL. More...
 
struct itemmei_hash_table_find (hash_table_t *const htable, const char *const key)
 Find a record in a hash table. More...
 
void mei_hash_table_insert (hash_table_t *const htable, const char *const key, const mei_flag_t type, const double value, const func1_t f1, const func2_t f2, const func3_t f3, const func4_t f4, const interp1d_t i1d)
 Insert a record in a hash table. More...
 
struct itemmei_hash_table_lookup (hash_table_t *const htable, const char *const key)
 Find a record in a hash table. More...
 
void mei_hash_table_free (hash_table_t *const htable)
 Destroy a hash table. More...
 
void mei_hash_table_init (hash_table_t *const htable)
 Initialize the hash table with default symbols. More...
 
void mei_hash_table_item_print (struct item *item)
 Dump function of a single record. More...
 
void mei_hash_table_dump (hash_table_t *const htable)
 Dump of table contents for debuging purpose. More...
 

Detailed Description

Hash table, intended to provide a symbol table.

Function Documentation

void mei_hash_table_create ( hash_table_t *const  htable,
const int  modulo 
)

Initialize the hash table to the size (modulo) asked for. Allocates space for the correct number of pointers and sets them to NULL.

Parameters
[in]htablehash table
[in]modulosize of the hash table
void mei_hash_table_dump ( hash_table_t *const  htable)

Dump of table contents for debuging purpose.

Parameters
[in]htablehash table
struct item* mei_hash_table_find ( hash_table_t *const  htable,
const char *const  key 
)

Find a record in a hash table.

Parameters
[in]htablehash table
[in]keykey
Returns
a pointer containing the record
void mei_hash_table_free ( hash_table_t *const  htable)

Destroy a hash table.

Parameters
[in]htablehash table
void mei_hash_table_init ( hash_table_t *const  htable)

Initialize the hash table with default symbols.

Parameters
[in]htablehash table
void mei_hash_table_insert ( hash_table_t *const  htable,
const char *const  key,
const mei_flag_t  type,
const double  value,
const func1_t  f1,
const func2_t  f2,
const func3_t  f3,
const func4_t  f4,
const interp1d_t  i1d 
)

Insert a record in a hash table.

Parameters
[in]htablehash table
[in]keykey associated to the record
[in]typeflag associated to the record
[in]valuestore a value if the record if a real
[in]f1pointer on a one argument function
[in]f2pointer on a two argument function
[in]f3pointer on a three argument function
[in]f4pointer on a four argument function
[in]i1dpointer on a 1D interpolation function
void mei_hash_table_item_print ( struct item item)

Dump function of a single record.

Parameters
[in]itemrecord
struct item* mei_hash_table_lookup ( hash_table_t *const  htable,
const char *const  key 
)

Find a record in a hash table.

Parameters
[in]htablehash table
[in]keykey
Returns
a pointer containing the record