-
Notifications
You must be signed in to change notification settings - Fork 9
API Document : fhash_int
Yuzhang Hu edited this page May 29, 2014
·
1 revision
fhash* fhash_int_create(uint32_t init_size, uint32_t flags)- brief: create fhash table
- param:
init_sizeThe hash table index size, if it's 0, the default value 10 will be used - param:
flags- FHASH_MASK_NONE: the default value, no feature enabled
- FHASH_MASK_AUTO_REHASH: enable auto-rehash (recommended)
- return: fhash table pointer
void fhash_int_delete(fhash *table)- brief: destroy a fhash table
- param:
tablepointer of fhash table - return: void
void fhash_int_set(fhash *table, int key, void *value)- brief: add or set a key-value pair into fhash table
- param:
tablepointer of fhash table - param:
keykey - param:
valuevalue - return: void
void* fhash_int_get(fhash *table, int key)- brief: get the value of the key
- param:
tablepointer of fhash table - param:
keykey - return: return value's pointer
void* fhash_int_del(fhash *table, int key)- brief: delete a key-value pair from the fhash table
- param:
tablepointer of fhash table - param:
keykey - return: void
fhash_int_iter fhash_int_iter_new(fhash *table)- brief: create a iterator of the fhash table
- param:
tablepointer of fhash table - return: a iterator of this table
void fhash_int_iter_release(fhash_int_iter *iter)- brief: release a iterator of the fhash table
- param:
itera pointer of iterator - return: void
- note: user must call this api if the iteration operation is done
void* fhash_int_next(fhash_int_iter *iter)- brief: get the next element
- param:
iterpointer of the iterator - return:
- the next element
- NULL if reach the end
void fhash_int_foreach(fhash *table, fhash_int_each_cb cb, void *ud)- brief: another iteration way
- param:
tablepointer of fhash table - param:
cbthe callback function of the iteration - param:
uduser private data, it will be passed to the callback function - return: void