Skip to content

API Document : fhash_uint64

Yuzhang Hu edited this page May 29, 2014 · 1 revision

fhash_u64_create

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

fhash_u64_delete

void fhash_u64_delete(fhash *table)
  • brief: destroy a fhash table
  • param: table pointer of fhash table
  • return: void

fhash_u64_set

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

fhash_u64_get

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

fhash_u64_del

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_new

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

fhash_u64_iter_release

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

fhash_u64_next

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

fhash_u64_foreach

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