All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
KzcHashMapConfiguration Struct Reference

Configuration parameters for a KzcHashMap. More...

#include <core/util/collection/kzc_hash_map.h>

Public Attributes

enum KzcHashMapKeyType keyType
 Type of the hash map key. More...
 
KzcHashFunction hashFunction
 Function for calculating the hash code for a specified key. More...
 
KzcComparatorFunction keyComparator
 Comparator function for the key. More...
 

Detailed Description

Configuration parameters for a KzcHashMap.

The configuration specifies the type of keys and the hash and comparator function of the hash map. Kanzi provides ready-made configurations for the most common use-cases: KZC_HASH_MAP_CONFIGURATION_POINTER for arbitrary pointer keys, KZC_HASH_MAP_CONFIGURATION_STRING for string keys and KZC_HASH_MAP_CONFIGURATION_INT for integer keys. Custom configurations can also be created for other key types such as structs by setting key type to be KZC_HASH_MAP_KEY_TYPE_CUSTOM and providing the required callbacks.

See also
KZC_HASH_MAP_CONFIGURATION_INT, KZC_HASH_MAP_CONFIGURATION_UINT, KZC_HASH_MAP_CONFIGURATION_FLOAT, KZC_HASH_MAP_CONFIGURATION_POINTER, KZC_HASH_MAP_CONFIGURATION_STRING.

Member Data Documentation

enum KzcHashMapKeyType KzcHashMapConfiguration::keyType

Type of the hash map key.

KzcHashFunction KzcHashMapConfiguration::hashFunction

Function for calculating the hash code for a specified key.

An optimal hash function returns different values for each different key. A bad hash function returns the same values for different keys, leading to slower element look-ups and frequent memory allocations.

KzcComparatorFunction KzcHashMapConfiguration::keyComparator

Comparator function for the key.


The documentation for this struct was generated from the following file: