|
MentOS
0.8.0
The Mentoring Operating System
|
Classes | |
| struct | hashmap_entry_t |
| Stores information of an entry of the hashmap. More... | |
| struct | hashmap_t |
| Stores information of a hashmap. More... | |
Functions | |
| static hashmap_t * | __alloc_hashmap (void) |
| Allocates the memory for an hasmap. More... | |
| static hashmap_entry_t * | __alloc_entry (void) |
| Allocates the memory for an entry of the hasmap. More... | |
| static void | __dealloc_entry (hashmap_entry_t *entry) |
| Frees the memory of an entry of the hasmap. More... | |
| static hashmap_entry_t ** | __alloc_entries (unsigned int size) |
| Allocates the memory for a number of entries in the hasmap. More... | |
| static void | __dealloc_entries (hashmap_entry_t **entries) |
| Frees the memory of a vector of entries. More... | |
| unsigned int | hashmap_int_hash (const void *key) |
| Transforms an integer key into a hash key. More... | |
| int | hashmap_int_comp (const void *a, const void *b) |
| Compares two integer hash keys. More... | |
| unsigned int | hashmap_str_hash (const void *_key) |
| Transforms a string key into a hash key. More... | |
| int | hashmap_str_comp (const void *a, const void *b) |
| Compares two string hash keys. More... | |
| void * | hashmap_do_not_duplicate (const void *value) |
| This function can be passed as hashmap_dupe_t, it does nothing. More... | |
| void | hashmap_do_not_free (void *value) |
| This function can be passed as hashmap_free_t, it does nothing. More... | |
| hashmap_t * | hashmap_create (unsigned int size, hashmap_hash_t hash_fun, hashmap_comp_t comp_fun, hashmap_dupe_t dupe_fun, hashmap_free_t key_free_fun) |
| User-defined hashmap. More... | |
| void | hashmap_free (hashmap_t *map) |
| Frees the memory of the hashmap. More... | |
| void * | hashmap_set (hashmap_t *map, const void *key, void *value) |
Sets the value for the given key in the hashmap map. More... | |
| void * | hashmap_get (hashmap_t *map, const void *key) |
| Access the value for the given key. More... | |
| void * | hashmap_remove (hashmap_t *map, const void *key) |
| Removes the entry with the given key. More... | |
| int | hashmap_is_empty (hashmap_t *map) |
| Checks if the hashmap is empty. More... | |
| int | hashmap_has (hashmap_t *map, const void *key) |
| Checks if the hashmap contains an entry with the given key. More... | |
| list_t * | hashmap_keys (hashmap_t *map) |
| Provides access to all the keys. More... | |
| list_t * | hashmap_values (hashmap_t *map) |
| Provides access to all the values. More... | |
|
inlinestatic |
Allocates the memory for a number of entries in the hasmap.
| size | the number of entries. |
|
inlinestatic |
Allocates the memory for an entry of the hasmap.
|
inlinestatic |
Allocates the memory for an hasmap.
|
inlinestatic |
Frees the memory of a vector of entries.
| entries | the vector of entries. |
|
inlinestatic |
Frees the memory of an entry of the hasmap.
| entry | the entry we destroy. |
| hashmap_t* hashmap_create | ( | unsigned int | size, |
| hashmap_hash_t | hash_fun, | ||
| hashmap_comp_t | comp_fun, | ||
| hashmap_dupe_t | dupe_fun, | ||
| hashmap_free_t | key_free_fun | ||
| ) |
User-defined hashmap.
| size | Dimension of the hashmap. |
| hash_fun | The hashing function. |
| comp_fun | The hash compare function. |
| dupe_fun | The key duplication function. |
| key_free_fun | The function used to free memory of keys. |
(key_free_fun) : No free function. (val_free_fun) : Standard free function.
| void* hashmap_do_not_duplicate | ( | const void * | value | ) |
This function can be passed as hashmap_dupe_t, it does nothing.
| value | The value to duplicate. |
| void hashmap_do_not_free | ( | void * | value | ) |
This function can be passed as hashmap_free_t, it does nothing.
| value | The value to free. |
| void hashmap_free | ( | hashmap_t * | map | ) |
Frees the memory of the hashmap.
| map | A pointer to the hashmap. |
| void* hashmap_get | ( | hashmap_t * | map, |
| const void * | key | ||
| ) |
Access the value for the given key.
| map | The hashmap. |
| key | The key of the entry we are searching. |
| int hashmap_has | ( | hashmap_t * | map, |
| const void * | key | ||
| ) |
Checks if the hashmap contains an entry with the given key.
| map | The hashmap. |
| key | The key of the entry we are searching. |
| int hashmap_int_comp | ( | const void * | a, |
| const void * | b | ||
| ) |
Compares two integer hash keys.
| a | The first hash key. |
| b | The second hash key. |
| unsigned int hashmap_int_hash | ( | const void * | key | ) |
Transforms an integer key into a hash key.
| key | The integer key. |
| int hashmap_is_empty | ( | hashmap_t * | map | ) |
Checks if the hashmap is empty.
| map | The hashmap. |
Provides access to all the keys.
| map | The hashmap. |
| void* hashmap_remove | ( | hashmap_t * | map, |
| const void * | key | ||
| ) |
Removes the entry with the given key.
| map | The hashmap. |
| key | The key of the entry we are searching. |
| void* hashmap_set | ( | hashmap_t * | map, |
| const void * | key, | ||
| void * | value | ||
| ) |
Sets the value for the given key in the hashmap map.
| map | The hashmap. |
| key | The entry key. |
| value | The entry value. |
| int hashmap_str_comp | ( | const void * | a, |
| const void * | b | ||
| ) |
Compares two string hash keys.
| a | The first hash key. |
| b | The second hash key. |
| unsigned int hashmap_str_hash | ( | const void * | key | ) |
Transforms a string key into a hash key.
| key | The string key. |