Hash map. More...
#include <kanzi/core/legacy/util/collection/kzc_hash_code.hpp>
#include <kanzi/core/legacy/util/collection/kzc_comparator.hpp>
#include <kanzi/core/legacy/kzs_types.hpp>
#include <kanzi/core/legacy/debug/kzs_error.hpp>
#include "kzc_hash_map_accessors_hpp.inl"
Classes | |
struct | KzcHashMapIterator |
Accessor to the contents of a HashMap. More... | |
struct | KzcHashMapConfiguration |
Configuration parameters for a HashMap. More... | |
Macros | |
#define | kzcHashMapIterationBreak(hashMap) |
Break from hash map iteration - do nothing on release build. More... | |
#define | kzcHashMapIterate(iterator_param) |
Finds the next entry in the attached hash map. More... | |
#define | kzcHashMapIteratorRemove(iterator_param) |
Removes current entry of hash map pointed by the iterator. More... | |
Typedefs | |
typedef kzUint | KzcHashMapChainLengthType |
Chain length elementary type. More... | |
Enumerations | |
enum | KzcHashMapKeyType { KZC_HASH_MAP_KEY_TYPE_INT, KZC_HASH_MAP_KEY_TYPE_UINT, KZC_HASH_MAP_KEY_TYPE_FLOAT, KZC_HASH_MAP_KEY_TYPE_POINTER, KZC_HASH_MAP_KEY_TYPE_STRING, KZC_HASH_MAP_KEY_TYPE_CUSTOM } |
Key type identifier for hash map. More... | |
Functions | |
KANZI_API kzsError | kzcHashMapCreateWithCapacity (const struct KzcMemoryManager *memoryManager, struct KzcHashMapConfiguration configuration, kzUint capacity, struct KzcHashMap **out_hashMap) |
Creates a new initially empty hash map. More... | |
KANZI_API kzsError | kzcHashMapCreate (const struct KzcMemoryManager *memoryManager, struct KzcHashMapConfiguration configuration, struct KzcHashMap **out_hashMap) |
Creates a new initially empty hash map. More... | |
KANZI_API kzsError | kzcHashMapDelete (struct KzcHashMap *hashMap) |
Frees the memory allocated for the hash map. More... | |
KANZI_API kzsError | kzcHashMapClear (struct KzcHashMap *hashMap) |
Clears the content of the hash map. More... | |
KANZI_API struct KzcHashMapConfiguration | kzcHashMapGetConfiguration (const struct KzcHashMap *hashMap) |
Get hash map configuration. More... | |
KANZI_API kzUint | kzcHashMapGetSize (const struct KzcHashMap *HashMap) |
Returns the number of entries stored in the hash map. More... | |
KANZI_API kzBool | kzcHashMapIsEmpty (const struct KzcHashMap *hashMap) |
Checks if the hash map is empty or not. More... | |
KANZI_API struct KzcHashMapIterator | kzcHashMapGetIterator (const struct KzcHashMap *hashMap) |
Returns an iterator to the hash map. More... | |
KANZI_API kzBool | kzcHashMapIterate_private (struct KzcHashMapIterator *iterator) |
KANZI_API kzsError | kzcHashMapIteratorRemove_private (struct KzcHashMapIterator *it) |
Variables | |
KANZI_API const struct KzcHashMapConfiguration | KZC_HASH_MAP_CONFIGURATION_INT |
Configuration for hash maps where key type is an integer. More... | |
KANZI_API const struct KzcHashMapConfiguration | KZC_HASH_MAP_CONFIGURATION_UINT |
Configuration for hash maps where key type is an unsigned integer. More... | |
KANZI_API const struct KzcHashMapConfiguration | KZC_HASH_MAP_CONFIGURATION_FLOAT |
Configuration for hash maps where key type is a float. More... | |
KANZI_API const struct KzcHashMapConfiguration | KZC_HASH_MAP_CONFIGURATION_POINTER |
Configuration for hash maps where key type is an arbitrary pointer. More... | |
KANZI_API const struct KzcHashMapConfiguration | KZC_HASH_MAP_CONFIGURATION_STRING |
Configuration for hash maps where key type is a string. More... | |
Hash map.
Hash map stores arbitrary key -> value mappings.
Copyright 2008-2017 by Rightware. All rights reserved.
#define kzcHashMapIterationBreak | ( | hashMap | ) |
Break from hash map iteration - do nothing on release build.
#define kzcHashMapIterate | ( | iterator_param | ) |
Finds the next entry in the attached hash map.
Returns KZ_TRUE if next entry is found, otherwise KZ_FALSE.
#define kzcHashMapIteratorRemove | ( | iterator_param | ) |
Removes current entry of hash map pointed by the iterator.
Next iteration gives the entry that would have been next. Iterator should not be dereferenced at current state.
typedef kzUint KzcHashMapChainLengthType |
Chain length elementary type.
enum KzcHashMapKeyType |
Key type identifier for hash map.
To use custom hash and comparator functions set key type to KZC_HASH_MAP_KEY_TYPE_CUSTOM.
KANZI_API kzsError kzcHashMapCreateWithCapacity | ( | const struct KzcMemoryManager * | memoryManager, |
struct KzcHashMapConfiguration | configuration, | ||
kzUint | capacity, | ||
struct KzcHashMap ** | out_hashMap | ||
) |
Creates a new initially empty hash map.
Stores key-value pairs. Initial capacity is given as a parameter. configuration specifies what type of keys are used in the map. The caller is responsible for deleting returned hash map object with kzcHashMapDelete function.
KANZI_API kzsError kzcHashMapCreate | ( | const struct KzcMemoryManager * | memoryManager, |
struct KzcHashMapConfiguration | configuration, | ||
struct KzcHashMap ** | out_hashMap | ||
) |
Creates a new initially empty hash map.
Stores key-value pairs. configuration specifies what type of keys are used in the map. The caller is responsible for deleting returned hash map object with kzcHashMapDelete function.
KANZI_API kzsError kzcHashMapDelete | ( | struct KzcHashMap * | hashMap | ) |
Frees the memory allocated for the hash map.
KANZI_API kzsError kzcHashMapClear | ( | struct KzcHashMap * | hashMap | ) |
Clears the content of the hash map.
The capacity of the hash map does not change.
hashMap | Hash map to clear. |
KANZI_API struct KzcHashMapConfiguration kzcHashMapGetConfiguration | ( | const struct KzcHashMap * | hashMap | ) |
Get hash map configuration.
KANZI_API kzUint kzcHashMapGetSize | ( | const struct KzcHashMap * | HashMap | ) |
Returns the number of entries stored in the hash map.
KANZI_API kzBool kzcHashMapIsEmpty | ( | const struct KzcHashMap * | hashMap | ) |
Checks if the hash map is empty or not.
KANZI_API struct KzcHashMapIterator kzcHashMapGetIterator | ( | const struct KzcHashMap * | hashMap | ) |
Returns an iterator to the hash map.
Call kzcHashMapIterate before accessing the first and any subsequent entries.
KANZI_API kzBool kzcHashMapIterate_private | ( | struct KzcHashMapIterator * | iterator | ) |
KANZI_API kzsError kzcHashMapIteratorRemove_private | ( | struct KzcHashMapIterator * | it | ) |
KANZI_API const struct KzcHashMapConfiguration KZC_HASH_MAP_CONFIGURATION_INT |
Configuration for hash maps where key type is an integer.
KANZI_API const struct KzcHashMapConfiguration KZC_HASH_MAP_CONFIGURATION_UINT |
Configuration for hash maps where key type is an unsigned integer.
KANZI_API const struct KzcHashMapConfiguration KZC_HASH_MAP_CONFIGURATION_FLOAT |
Configuration for hash maps where key type is a float.
KANZI_API const struct KzcHashMapConfiguration KZC_HASH_MAP_CONFIGURATION_POINTER |
Configuration for hash maps where key type is an arbitrary pointer.
KANZI_API const struct KzcHashMapConfiguration KZC_HASH_MAP_CONFIGURATION_STRING |
Configuration for hash maps where key type is a string.