khash.h |
Generic hash table library.
__ac_X31_hash_string |
const char* hash function
static inline khint_t __ac_X31_hash_string( const char *s)
s
The hash value
kh_int_hash_func |
Integer hash function
#define kh_int_hash_func(key)
key
The hash value [khint_t]
kh_int_hash_equal |
Integer comparison function
#define kh_int_hash_equal(a, b)
kh_int64_hash_func |
64-bit integer hash function
#define kh_int64_hash_func(key)
key
The hash value [khint_t]
kh_int64_hash_equal |
64-bit integer comparison function
#define kh_int64_hash_equal(a, b)
kh_str_hash_func |
Another interface to const char* hash function
#define kh_str_hash_func(key) __ac_X31_hash_string(key)
key
The hash value [khint_t]
kh_str_hash_equal |
Const char* comparison function
#define kh_str_hash_equal(a, b)
khash_t |
Type of the hash table.
#define khash_t(name) kh_##name##_t
name
kh_init |
Initiate a hash table.
#define kh_init(name) kh_init_##name()
name
Pointer to the hash table [khash_t(name)*]
kh_destroy |
Destroy a hash table.
#define kh_destroy(name, h) kh_destroy_##name(h)
name
h
kh_clear |
Reset a hash table without deallocating memory.
#define kh_clear(name, h) kh_clear_##name(h)
name
h
kh_resize |
Resize a hash table.
#define kh_resize(name, h, s) kh_resize_##name(h, s)
name
h
s
kh_put |
Insert a key to the hash table.
#define kh_put(name, h, k, r) kh_put_##name(h, k, r)
name
h
k
r
Iterator to the inserted element [khint_t]
kh_get |
Retrieve a key from the hash table.
#define kh_get(name, h, k) kh_get_##name(h, k)
name
h
k
Iterator to the found element, or kh_end(h) is the element is absent [khint_t]
kh_del |
Remove a key from the hash table.
#define kh_del(name, h, k) kh_del_##name(h, k)
name
h
k
kh_exist |
Test whether a bucket contains data.
#define kh_exist(h, x)
h
x
1 if containing data; 0 otherwise [int]
kh_key |
Get key given an iterator
#define kh_key(h, x)
h
x
Key [type of keys]
kh_val |
Get value given an iterator
#define kh_val(h, x)
h
x
Value [type of values]
For hash sets, calling this results in segfault.
kh_value |
Alias of kh_val()
#define kh_value(h, x)
kh_begin |
Get the start iterator
#define kh_begin(h)
h
The start iterator [khint_t]
kh_end |
Get the end iterator
#define kh_end(h)
h
The end iterator [khint_t]
kh_size |
Get the number of elements in the hash table
#define kh_size(h)
h
Number of elements in the hash table [khint_t]
kh_n_buckets |
Get the number of buckets in the hash table
#define kh_n_buckets(h)
h
Number of buckets in the hash table [khint_t]
KHASH_SET_INIT_INT |
Instantiate a hash set containing integer keys
#define KHASH_SET_INIT_INT(name) \ KHASH_INIT(name, uint32_t, char, 0, kh_int_hash_func, kh_int_hash_equal)
name
KHASH_MAP_INIT_INT |
Instantiate a hash map containing integer keys
#define KHASH_MAP_INIT_INT(name, khval_t) \ KHASH_INIT(name, uint32_t, khval_t, 1, kh_int_hash_func, kh_int_hash_equal)
name
khval_t
KHASH_SET_INIT_INT64 |
Instantiate a hash map containing 64-bit integer keys
#define KHASH_SET_INIT_INT64(name) \ KHASH_INIT(name, uint64_t, char, 0, kh_int64_hash_func, kh_int64_hash_equal)
name
KHASH_MAP_INIT_INT64 |
Instantiate a hash map containing 64-bit integer keys
#define KHASH_MAP_INIT_INT64(name, khval_t) \ KHASH_INIT(name, uint64_t, khval_t, 1, kh_int64_hash_func, kh_int64_hash_equal)
name
khval_t
KHASH_SET_INIT_STR |
Instantiate a hash map containing const char* keys
#define KHASH_SET_INIT_STR(name) \ KHASH_INIT(name, kh_cstr_t, char, 0, kh_str_hash_func, kh_str_hash_equal)
name
KHASH_MAP_INIT_STR |
Instantiate a hash map containing const char* keys
#define KHASH_MAP_INIT_STR(name, khval_t) \ KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal)
name
khval_t
© Heng Li Last Updated: Tuesday, November 25, 2008