Tinyhash
This is a library containing multiple C implementations of hashmap.
|
Go to the source code of this file.
Functions | |
th_t | th_create_default () |
Allocate then initialize a hashmap controller with its default values. | |
th_t | th_create (th_method_t method) |
Allocate then initialize a hashmap controller. based on the given method. | |
th_any_t | th_get (th_t *th, th_any_t data, size_t data_size) |
Returns a value from a hashmap. Return NULL if it doest not exist. | |
bool | th_put (th_t *th, th_any_t data, size_t data_size, th_any_t value) |
Insert element within the hashmap. Return true on success. | |
bool | th_delete (th_t *th, th_any_t data, size_t data_size) |
Delete a key value pair from a hashmap. Return true on success. | |
void | th_clear (th_t *th) |
Clear a hashmap. | |
void | th_free (th_t *th) |
Free a hashmap. | |
th_iterator_t * | th_begin_iterator (th_t *th) |
Return a pointer on an iterator with the first element. | |
th_iterator_t * | th_empty_iterator (th_t *th) |
Return an empty iterator. | |
int | th_len (th_t *th) |
Get the hashmap length (total amount of key value pairs). | |
Variables | |
static th_funcs_t | th_funcs [] |
Static array containing functions that accomplish hashmap operation associated with an implementation method. | |
static size_t | th_funcs_length = sizeof(th_funcs) / sizeof(th_funcs[0]) |
th_iterator_t * th_begin_iterator | ( | th_t * | th | ) |
Return a pointer on an iterator with the first element.
th |
Definition at line 73 of file tinyhash.c.
References th_funcs_t::begin_iterator, th_t::funcs, and th_t::table.
void th_clear | ( | th_t * | th | ) |
Clear a hashmap.
th |
Definition at line 65 of file tinyhash.c.
References th_funcs_t::_free, th_t::funcs, and th_t::table.
th_t th_create | ( | th_method_t | method | ) |
Allocate then initialize a hashmap controller. based on the given method.
method |
Definition at line 39 of file tinyhash.c.
References th_funcs_t::create, th_create_default(), th_funcs, and th_funcs_length.
Referenced by th_create_default().
th_t th_create_default | ( | ) |
Allocate then initialize a hashmap controller with its default values.
Definition at line 37 of file tinyhash.c.
References th_create(), and TH_SEPARATE_CHAINING.
Referenced by th_create().
Delete a key value pair from a hashmap. Return true on success.
th | |
data | |
data_size |
Definition at line 61 of file tinyhash.c.
References th_funcs_t::_delete, th_t::funcs, and th_t::table.
th_iterator_t * th_empty_iterator | ( | th_t * | th | ) |
Return an empty iterator.
th |
Definition at line 77 of file tinyhash.c.
References th_funcs_t::begin_iterator, th_t::funcs, and th_t::table.
void th_free | ( | th_t * | th | ) |
Free a hashmap.
th |
Definition at line 67 of file tinyhash.c.
References th_funcs_t::_free, th_t::funcs, and th_t::table.
Returns a value from a hashmap. Return NULL if it doest not exist.
th | |
data | |
data_size |
Definition at line 53 of file tinyhash.c.
References th_t::funcs, th_funcs_t::get, and th_t::table.
int th_len | ( | th_t * | th | ) |
Get the hashmap length (total amount of key value pairs).
th |
Definition at line 81 of file tinyhash.c.
References th_t::funcs, th_funcs_t::len, and th_t::table.
Insert element within the hashmap. Return true on success.
th | |
data | |
data_size | |
value |
Definition at line 57 of file tinyhash.c.
References th_t::funcs, th_funcs_t::put, and th_t::table.
|
static |
Static array containing functions that accomplish hashmap operation associated with an implementation method.
Definition at line 11 of file tinyhash.c.
Referenced by th_create().
Definition at line 35 of file tinyhash.c.
Referenced by th_create().