-
Notifications
You must be signed in to change notification settings - Fork 9
API Document : fhash_uint64
Yuzhang Hu edited this page May 29, 2014
·
1 revision
fhash* fhash_u64_create(uint32_t init_size, uint32_t flags)
- brief: create fhash table
- param:
init_size
The 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_u64_delete(fhash *table)
- brief: destroy a fhash table
- param:
table
pointer of fhash table - return: void
void fhash_u64_set(fhash *table, uint64_t key, void *value)
- brief: add or set a key-value pair into fhash table
- param:
table
pointer of fhash table - param:
key
key - param:
value
value - return: void
void* fhash_u64_get(fhash *table, uint64_t key)
- brief: get the value of the key
- param:
table
pointer of fhash table - param:
key
key - return: return value's pointer
void* fhash_u64_del(fhash *table, uint64_t key)
- brief: delete a key-value pair from the fhash table
- param:
table
pointer of fhash table - param:
key
key - return: void
fhash_u64_iter fhash_u64_iter_new(fhash *table)
- brief: create a iterator of the fhash table
- param:
table
pointer of fhash table - return: a iterator of this table
void fhash_u64_iter_release(fhash_u64_iter *iter)
- brief: release a iterator of the fhash table
- param:
iter
a pointer of iterator - return: void
- note: user must call this api if the iteration operation is done
void* fhash_u64_next(fhash_u64_iter *iter)
- brief: get the next element
- param:
iter
pointer of the iterator - return:
- the next element
- NULL if reach the end
void fhash_u64_foreach(fhash *table, fhash_u64_each_cb cb, void *ud)
- brief: another iteration way
- param:
table
pointer of fhash table - param:
cb
the callback function of the iteration - param:
ud
user private data, it will be passed to the callback function - return: void