Go to the source code of this file.
Typedefs | |
| typedef HAMT | HAMT |
| Hash array mapped trie data structure (opaque type). | |
| typedef HAMTEntry | HAMTEntry |
| Hash array mapped trie entry (opaque type). | |
Functions | |
| YASM_LIB_DECL HAMT * | HAMT_create (int nocase, void(*error_func)(const char *file, unsigned int line, const char *message)) |
| Create new, empty, HAMT. | |
| YASM_LIB_DECL void | HAMT_destroy (HAMT *hamt, void(*deletefunc)(void *data)) |
| Delete HAMT and all data associated with it. | |
| YASM_LIB_DECL void * | HAMT_insert (HAMT *hamt, const char *str, void *data, int *replace, void(*deletefunc)(void *data)) |
| Insert key into HAMT, associating it with data. | |
| YASM_LIB_DECL void * | HAMT_search (HAMT *hamt, const char *str) |
| Search for the data associated with a key in the HAMT. | |
| YASM_LIB_DECL int | HAMT_traverse (HAMT *hamt, void *d, int(*func)(void *node, void *d)) |
| Traverse over all keys in HAMT, calling function on each data item. | |
| YASM_LIB_DECL const HAMTEntry * | HAMT_first (const HAMT *hamt) |
| Get the first entry in a HAMT. | |
| YASM_LIB_DECL const HAMTEntry * | HAMT_next (const HAMTEntry *prev) |
| Get the next entry in a HAMT. | |
| YASM_LIB_DECL void * | HAMTEntry_get_data (const HAMTEntry *entry) |
| Get the corresponding data for a HAMT entry. | |
Definition in file hamt.h.
| YASM_LIB_DECL HAMT* HAMT_create | ( | int | nocase, | |
| void(*)(const char *file, unsigned int line, const char *message) | error_func | |||
| ) |
Create new, empty, HAMT.
error_func() is called when an internal error is encountered--it should NOT return to the calling function.
| nocase | nonzero if HAMT should be case-insensitive | |
| error_func | function called on internal error |
| YASM_LIB_DECL void HAMT_destroy | ( | HAMT * | hamt, | |
| void(*)(void *data) | deletefunc | |||
| ) |
Delete HAMT and all data associated with it.
Uses deletefunc() to delete each data item.
| hamt | Hash array mapped trie | |
| deletefunc | Data deletion function |
Get the first entry in a HAMT.
| hamt | Hash array mapped trie |
| YASM_LIB_DECL void* HAMT_insert | ( | HAMT * | hamt, | |
| const char * | str, | |||
| void * | data, | |||
| int * | replace, | |||
| void(*)(void *data) | deletefunc | |||
| ) |
Insert key into HAMT, associating it with data.
If the key is not present in the HAMT, inserts it, sets *replace to 1, and returns the data passed in. If the key is already present and *replace is 0, deletes the data passed in using deletefunc() and returns the data currently associated with the key. If the key is already present and *replace is 1, deletes the data currently associated with the key using deletefunc() and replaces it with the data passed in.
| hamt | Hash array mapped trie | |
| str | Key | |
| data | Data to associate with key | |
| replace | See above description | |
| deletefunc | Data deletion function if data is replaced |
Get the next entry in a HAMT.
| prev | Previous entry in HAMT |
| YASM_LIB_DECL void* HAMT_search | ( | HAMT * | hamt, | |
| const char * | str | |||
| ) |
Search for the data associated with a key in the HAMT.
| hamt | Hash array mapped trie | |
| str | Key |
| YASM_LIB_DECL int HAMT_traverse | ( | HAMT * | hamt, | |
| void * | d, | |||
| int(*)(void *node, void *d) | func | |||
| ) |
Traverse over all keys in HAMT, calling function on each data item.
| hamt | Hash array mapped trie | |
| d | Data to pass to each call to func. | |
| func | Function to call |
| YASM_LIB_DECL void* HAMTEntry_get_data | ( | const HAMTEntry * | entry | ) |
Get the corresponding data for a HAMT entry.
| entry | HAMT entry (as returned by HAMT_first() and HAMT_next()) |
1.5.2