14 typedef struct _HashMap {
20 int32_t (*put) (
struct _HashMap*, Pair*, size_t);
24 int32_t (*
get) (
struct _HashMap*, Key, size_t, Value*);
28 int32_t (*find) (
struct _HashMap*, Key, size_t);
32 int32_t (*
remove) (
struct _HashMap*, Key, size_t);
36 int32_t (*size) (
struct _HashMap*);
40 int32_t (*iterate) (
struct _HashMap*, bool, Pair**);
44 int32_t (*set_destroy) (
struct _HashMap*, void (*) (Pair*));
48 int32_t (*set_hash) (
struct _HashMap*, uint32_t (*) (Key, size_t));
int32_t HashMapRemove(HashMap *self, Key key, size_t size)
Delete the key value pair corresponding to the designated key.
int32_t HashMapPut(HashMap *self, Pair *pPair, size_t size)
Insert a key value pair into the map.
void HashMapDeinit(HashMap **ppObj)
The destructor for HashMap.
int32_t HashMapGet(HashMap *self, Key key, size_t size, Value *pValue)
Retrieve the value corresponding to the designated key.
int32_t HashMapSize(HashMap *self)
Return the number of stored key value pairs.
int32_t HashMapSetDestroy(HashMap *self, void(*pFunc)(Pair *))
Set the custom key value pair resource clean method.
struct _HashMapData HashMapData
HashMapData is the data type for the container private information.
int32_t HashMapIterate(HashMap *self, bool bReset, Pair **ppPair)
Iterate through the map to retrieve each key value pair.
int32_t HashMapSetHash(HashMap *self, uint32_t(*pFunc)(Key, size_t))
Set the custom hash function.
int32_t HashMapFind(HashMap *self, Key key, size_t size)
Check if the map contains the designated key.
The implementation for hash map.
HashMapData * pData
The container private information.
int32_t HashMapInit(HashMap **ppObj)
The constructor for HashMap.