Turnstone Operating System
|
hashmap interface implementation More...
#include <hashmap.h>
#include <memory.h>
#include <cpu/sync.h>
#include <xxhash.h>
#include <strings.h>
Classes | |
struct | hashmap_item_t |
hashmap item More... | |
struct | hashmap_segment_t |
hashmap segment More... | |
struct | hashmap_t |
hashmap More... | |
struct | hashmap_iterator_metadata_t |
Metadata for the hashmap iterator. More... | |
Typedefs | |
typedef struct hashmap_item_t | hashmap_item_t |
hashmap item | |
typedef struct hashmap_segment_t | hashmap_segment_t |
hashmap segment | |
typedef struct hashmap_iterator_metadata_t | hashmap_iterator_metadata_t |
Typedef for hashmap iterator metadata. | |
Functions | |
MODULE ("turnstone.lib.hashmap") | |
uint64_t | hashmap_default_kg (const void *key) |
default key generator More... | |
int8_t | hashmap_default_kc (const void *item1, const void *item2) |
default key comparator More... | |
uint64_t | hashmap_string_kg (const void *key) |
string key generator More... | |
int8_t | hashmap_string_kc (const void *item1, const void *item2) |
string key comparator More... | |
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... | |
static hashmap_segment_t * | hashmap_segment_next_new (hashmap_t *hm, hashmap_segment_t *seg) |
get next new segment More... | |
const void * | hashmap_put (hashmap_t *hm, const void *key, const void *item) |
put item to 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... | |
const void * | hashmap_get (hashmap_t *hm, const void *key) |
get item from 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... | |
const void * | hashmap_iterator_get_item (iterator_t *iter) |
returns current item at iterator More... | |
const void * | hashmap_iterator_get_extra_data (iterator_t *iter) |
returns current key at iterator More... | |
iterator_t * | hashmap_iterator_next (iterator_t *iter) |
advances iterator to next item More... | |
int8_t | hashmap_iterator_destroy (iterator_t *iter) |
destroys iterator More... | |
int8_t | hashmap_iterator_end_of_iterator (iterator_t *iter) |
checks if iterator is at end More... | |
iterator_t * | hashmap_iterator_create (hashmap_t *hm) |
create iterator of hashmap More... | |
hashmap interface implementation
This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.
int8_t hashmap_default_kc | ( | const void * | item1, |
const void * | item2 | ||
) |
default key comparator
[in] | item1 | item1 |
[in] | item2 | item2 |
uint64_t hashmap_default_kg | ( | const void * | key | ) |
default key generator
[in] | key | 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 |
int8_t hashmap_iterator_destroy | ( | iterator_t * | iter | ) |
destroys iterator
[in] | iter | iterator |
int8_t hashmap_iterator_end_of_iterator | ( | iterator_t * | iter | ) |
checks if iterator is at end
[in] | iter | iterator |
const void * hashmap_iterator_get_extra_data | ( | iterator_t * | iter | ) |
returns current key at iterator
[in] | iter | iterator |
const void * hashmap_iterator_get_item | ( | iterator_t * | iter | ) |
returns current item at iterator
[in] | iter | iterator |
iterator_t * hashmap_iterator_next | ( | iterator_t * | iter | ) |
advances iterator to next item
[in] | iter | 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 |
|
static |
get next new segment
[in] | hm | hashmap |
[in] | seg | segment |
get size of hashmap
[in] | hm | hashmap to get size |
create hashmap with string key, uses string key generator and key comparator
[in] | capacity | capacity of hashmap |
int8_t hashmap_string_kc | ( | const void * | item1, |
const void * | item2 | ||
) |
string key comparator
[in] | item1 | item1 |
[in] | item2 | item2 |
uint64_t hashmap_string_kg | ( | const void * | key | ) |
string key generator
[in] | key | key |
MODULE | ( | "turnstone.lib.hashmap" | ) |
module name