hashtable.h File Reference
#include "cfg/cfg_hashtable.h"#include <cfg/compiler.h>#include <cfg/macros.h>#include <cfg/debug.h>Go to the source code of this file.
Data Structures | |
| struct | HashTable |
| Hash table description. More... | |
| struct | HashIterator |
| Iterator to walk the hash table. More... | |
Defines | |
| #define | INTERNAL_KEY_MAX_LENGTH 15 |
| Maximum length of the internal key (use (2^n)-1 for slight speedup). | |
| #define | DECLARE_HASHTABLE(name, size, hook_gk) |
| Declare a hash table in the current scope. | |
| #define | DECLARE_HASHTABLE_STATIC(name, size, hook_gk) |
Exactly like DECLARE_HASHTABLE, but the variable will be declared as static. | |
| #define | DECLARE_HASHTABLE_INTERNALKEY(name, size) |
| Declare a hash table with internal copies of the keys. | |
| #define | DECLARE_HASHTABLE_INTERNALKEY_STATIC(name, size) |
Exactly like DECLARE_HASHTABLE_INTERNALKEY, but the variable will be declared as static. | |
| #define | ht_insert_str(ht, key, data) ht_insert_with_key(ht, key, strlen(key), data) |
Similar to ht_insert_with_key() but key is an ASCIIZ string. | |
| #define | ht_find_str(ht, key) ht_find(ht, key, strlen(key)) |
Similar to ht_find() but key is an ASCIIZ string. | |
Typedefs | |
| typedef const void *(* | hook_get_key )(const void *data, uint8_t *key_length) |
| Hook to get the key from data, which is an element of the hash table. | |
Functions | |
| void | ht_init (struct HashTable *ht) |
| Initialize (and clear) a hash table in a memory buffer. | |
| bool | ht_insert (struct HashTable *ht, const void *data) |
| Insert an element into the hash table. | |
| bool | ht_insert_with_key (struct HashTable *ht, const void *key, uint8_t key_length, const void *data) |
| Insert an element into the hash table. | |
| const void * | ht_find (struct HashTable *ht, const void *key, uint8_t key_length) |
| Find an element in the hash table. | |
| HashIterator | ht_iter_begin (struct HashTable *ht) |
| Get an iterator to the begin of the hash table ht. | |
| HashIterator | ht_iter_end (struct HashTable *ht) |
| Get an iterator to the (exclusive) end of the hash table ht. | |
| bool | ht_iter_cmp (HashIterator it1, HashIterator it2) |
| Compare it1 and it2 for equality. | |
| const void * | ht_iter_get (HashIterator iter) |
| Get the element within the hash table ht pointed by the iterator iter. | |
| HashIterator | ht_iter_next (HashIterator h) |
| Return an iterator pointing to the element following h. | |
Detailed Description
Definition in file hashtable.h.
