Turnstone Operating System
|
hashmap interface More...
Macros | |
#define | ___HASHMAP_H 0 |
#define | hashmap_new_with_hkg(c, hkg) hashmap_new_with_hkg_with_hkc(c, hkg, NULL) |
create hashmap with key generator, uses default key comparator More... | |
#define | hashmap_new_with_hkc(c, hkc) hashmap_new_with_hkg_with_hkc(c, NULL, hkc) |
create hashmap with key comparator, uses default key generator More... | |
#define | hashmap_new(c) hashmap_new_with_hkg_with_hkc(c, NULL, NULL) |
create hashmap, uses default key generator and key comparator More... | |
#define | hashmap_integer(c) hashmap_new(c) |
create hashmap with integer key, uses integer key generator and key comparator More... | |
Typedefs | |
typedef struct hashmap_t | hashmap_t |
opaque hashmap type | |
typedef uint64_t(* | hashmap_key_generator_f) (const void *item) |
hashmap key generator function type More... | |
typedef int8_t(* | hashmap_key_comparator_f) (const void *item1, const void *item2) |
hashmap key comparator function type More... | |
Functions | |
hashmap_t * | hashmap_new_with_hkg_with_hkc (uint64_t capacity, hashmap_key_generator_f hkg, hashmap_key_comparator_f hkc) |
create hashmap with key generator and key comparator More... | |
hashmap_t * | hashmap_string (uint64_t capacity) |
create hashmap with string key, uses string key generator and key comparator More... | |
boolean_t | hashmap_destroy (hashmap_t *hm) |
destroy hashmap More... | |
const void * | hashmap_put (hashmap_t *hm, const void *key, const void *item) |
put item to hashmap More... | |
const void * | hashmap_get (hashmap_t *hm, const void *key) |
get item from hashmap More... | |
const void * | hashmap_get_key (hashmap_t *hm, const void *key) |
get key from hashmap More... | |
boolean_t | hashmap_exists (hashmap_t *hm, const void *key) |
check existence of key in hashmap More... | |
boolean_t | hashmap_delete (hashmap_t *hm, const void *key) |
delete item from hashmap More... | |
uint64_t | hashmap_size (hashmap_t *hm) |
get size of hashmap More... | |
iterator_t * | hashmap_iterator_create (hashmap_t *hm) |
create iterator of hashmap More... | |
hashmap interface
This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.
#define ___HASHMAP_H 0 |
macro for avoiding multiple inclusion
#define hashmap_integer | ( | c | ) | hashmap_new(c) |
create hashmap with integer key, uses integer key generator and key comparator
[in] | c | capacity of hashmap |
#define hashmap_new | ( | c | ) | hashmap_new_with_hkg_with_hkc(c, NULL, NULL) |
create hashmap, uses default key generator and key comparator
[in] | c | capacity of hashmap |
#define hashmap_new_with_hkc | ( | c, | |
hkc | |||
) | hashmap_new_with_hkg_with_hkc(c, NULL, hkc) |
create hashmap with key comparator, uses default key generator
[in] | c | capacity of hashmap |
[in] | hkc | key comparator function |
#define hashmap_new_with_hkg | ( | c, | |
hkg | |||
) | hashmap_new_with_hkg_with_hkc(c, hkg, NULL) |
create hashmap with key generator, uses default key comparator
[in] | c | capacity of hashmap |
[in] | hkg | key generator function |
hashmap_key_comparator_f |
hashmap key comparator function type
[in] | item1 | item to compare |
[in] | item2 | item to compare |
hashmap_key_generator_f |
hashmap key generator function type
[in] | item | item to generate key |
boolean_t hashmap_delete | ( | hashmap_t * | hm, |
const void * | key | ||
) |
delete item from hashmap
[in] | hm | hashmap to delete item |
[in] | key | key of item |
boolean_t hashmap_destroy | ( | hashmap_t * | hm | ) |
destroy hashmap
[in] | hm | hashmap to destroy |
boolean_t hashmap_exists | ( | hashmap_t * | hm, |
const void * | key | ||
) |
check existence of key in hashmap
[in] | hm | hashmap to check existence |
[in] | key | key of item |
const void * hashmap_get | ( | hashmap_t * | hm, |
const void * | key | ||
) |
get item from hashmap
[in] | hm | hashmap to get item |
[in] | key | key of item |
const void * hashmap_get_key | ( | hashmap_t * | hm, |
const void * | key | ||
) |
get key from hashmap
[in] | hm | hashmap to get key |
[in] | key | key of item |
iterator_t * hashmap_iterator_create | ( | hashmap_t * | hm | ) |
create iterator of hashmap
[in] | hm | hashmap to create iterator |
hashmap_t * hashmap_new_with_hkg_with_hkc | ( | uint64_t | capacity, |
hashmap_key_generator_f | hkg, | ||
hashmap_key_comparator_f | hkc | ||
) |
create hashmap with key generator and key comparator
[in] | capacity | capacity of hashmap |
[in] | hkg | key generator function |
[in] | hkc | key comparator function |
const void * hashmap_put | ( | hashmap_t * | hm, |
const void * | key, | ||
const void * | item | ||
) |
put item to hashmap
[in] | hm | hashmap to put item |
[in] | key | key of item |
[in] | item | item to put |
get size of hashmap
[in] | hm | hashmap to get size |