libamxc
1.10.3
C Generic Data Containers
|
Ambiorix hash table API header file. More...
Go to the source code of this file.
Data Structures | |
struct | _amxc_htable_it |
The hash table iterator structure. More... | |
struct | _amxc_htable |
The hash table structure. More... | |
Macros | |
#define | amxc_htable_it_get_data(it, type, member) ((type*) (((char*) it) - offsetof(type, member))) |
Gets the data pointer from an hash table iterator. More... | |
#define | amxc_htable_for_each(it, htable) |
Loops over items in the hash table. More... | |
#define | amxc_htable_iterate(it, htable) |
Loops over items in the hash table. More... | |
#define | AMXC_HTABLE_RANGE UINT32_MAX |
Out of range indicator. More... | |
Typedefs | |
typedef struct _amxc_htable_it | amxc_htable_it_t |
typedef unsigned int(* | amxc_htable_hash_func_t) (const char *key, const unsigned int len) |
Definition of the hash function. More... | |
typedef void(* | amxc_htable_it_delete_t) (const char *key, amxc_htable_it_t *it) |
Definition of the hash table item delete function. More... | |
typedef struct _amxc_htable | amxc_htable_t |
The hash table structure. More... | |
Functions | |
int | amxc_htable_new (amxc_htable_t **htable, const size_t reserve) |
Allocates a hash table. More... | |
void | amxc_htable_delete (amxc_htable_t **htable, amxc_htable_it_delete_t func) |
Frees the previously allocated hash table. More... | |
int | amxc_htable_init (amxc_htable_t *const htable, const size_t reserve) |
Initializes a hash table. More... | |
void | amxc_htable_clean (amxc_htable_t *const htable, amxc_htable_it_delete_t func) |
Removes all items from the hash table. More... | |
void | amxc_htable_set_hash_func (amxc_htable_t *const htable, amxc_htable_hash_func_t func) |
Sets the hash function for the hash table. More... | |
unsigned int | amxc_htable_key2index (const amxc_htable_t *const htable, const char *const key) |
Converts a key into an index. More... | |
AMXC_INLINE bool | amxc_htable_is_empty (const amxc_htable_t *const htable) |
Checks that the hash table is empty. More... | |
AMXC_INLINE size_t | amxc_htable_size (const amxc_htable_t *const htable) |
Calculates the size of the hash table. More... | |
AMXC_INLINE size_t | amxc_htable_capacity (const amxc_htable_t *const htable) |
Calculates the capacity of the hash table. More... | |
int | amxc_htable_insert (amxc_htable_t *const htable, const char *const key, amxc_htable_it_t *const it) |
Inserts an item in the hash table. More... | |
amxc_htable_it_t * | amxc_htable_get (const amxc_htable_t *const htable, const char *const key) |
Gets a hash table iterator from the hash table. More... | |
amxc_htable_it_t * | amxc_htable_take (amxc_htable_t *const htable, const char *const key) |
Removes a hash table iterator from the hash table. More... | |
amxc_htable_it_t * | amxc_htable_get_first (const amxc_htable_t *const htable) |
Gets the first item stored in the table. More... | |
amxc_htable_it_t * | amxc_htable_get_last (const amxc_htable_t *const htable) |
Gets the last item stored in the table. More... | |
amxc_array_t * | amxc_htable_get_sorted_keys (const amxc_htable_t *const htable) |
Creates an array containing all keys of the hash table. More... | |
AMXC_INLINE bool | amxc_htable_contains (const amxc_htable_t *const htable, const char *const key) |
Verifies that a key is in the hash table. More... | |
int | amxc_htable_move (amxc_htable_t *const dest, amxc_htable_t *const src) |
Moves all items from one hash table to another hash table. More... | |
int | amxc_htable_it_init (amxc_htable_it_t *const it) |
Initializes a hash table.iterator. More... | |
void | amxc_htable_it_clean (amxc_htable_it_t *const it, amxc_htable_it_delete_t func) |
Removes the iterator from the htable and frees allocated memory. More... | |
amxc_htable_it_t * | amxc_htable_it_get_next (const amxc_htable_it_t *const reference) |
Gets the next iterator in the hash table. More... | |
amxc_htable_it_t * | amxc_htable_it_get_previous (const amxc_htable_it_t *const reference) |
Gets the previous iterator in the hash table. More... | |
amxc_htable_it_t * | amxc_htable_it_get_next_key (const amxc_htable_it_t *const reference) |
Gets the next iterator in the hash table with the same key. More... | |
amxc_htable_it_t * | amxc_htable_it_get_previous_key (const amxc_htable_it_t *const reference) |
Gets the previous iterator in the hash table with the same key. More... | |
void | amxc_htable_it_take (amxc_htable_it_t *const it) |
Removes the iterator from the hash table. More... | |
AMXC_INLINE const char * | amxc_htable_it_get_key (const amxc_htable_it_t *const it) |
Gets the key from the iterator. More... | |
AMXC_INLINE amxc_htable_it_t * | amxc_htable_take_first (const amxc_htable_t *const htable) |
Removes the first item stored in the table. More... | |
Ambiorix hash table API header file.
Definition in file amxc_htable.h.
typedef struct _amxc_htable_it amxc_htable_it_t |
Definition at line 1 of file amxc_htable.h.