24#include "hitls_build.h"
30#include "bsl_hash_list.h"
40typedef struct BSL_HASH_Info BSL_HASH_Hash;
46typedef struct BSL_HASH_TagNode *BSL_HASH_Iterator;
53typedef uint32_t (*BSL_HASH_CodeCalcFunc)(uintptr_t key);
64typedef bool (*BSL_HASH_MatchFunc)(uintptr_t key1, uintptr_t key2);
82typedef int32_t (*BSL_HASH_UpdateNodeFunc)(BSL_HASH_Hash *hash, BSL_HASH_Iterator node,
83 uintptr_t value, uint32_t valueSize);
100uint32_t BSL_HASH_CodeCalc(
void *key, uint32_t keySize);
115uint32_t BSL_HASH_CodeCalcInt(uintptr_t key);
131uint32_t BSL_HASH_CodeCalcStr(uintptr_t key);
147bool BSL_HASH_MatchInt(uintptr_t key1, uintptr_t key2);
164bool BSL_HASH_MatchStr(uintptr_t key1, uintptr_t key2);
196BSL_HASH_Hash *BSL_HASH_Create(uint32_t bktSize, BSL_HASH_CodeCalcFunc hashFunc, BSL_HASH_MatchFunc matchFunc,
197 ListDupFreeFuncPair *keyFunc, ListDupFreeFuncPair *valueFunc);
219int32_t BSL_HASH_Insert(BSL_HASH_Hash *hash, uintptr_t key, uint32_t keySize, uintptr_t value, uint32_t valueSize);
242int32_t BSL_HASH_Put(BSL_HASH_Hash *hash, uintptr_t key, uint32_t keySize, uintptr_t value, uint32_t valueSize,
243 BSL_HASH_UpdateNodeFunc updateNodeFunc);
257int32_t BSL_HASH_At(
const BSL_HASH_Hash *hash, uintptr_t key, uintptr_t *value);
270BSL_HASH_Iterator BSL_HASH_Find(
const BSL_HASH_Hash *hash, uintptr_t key);
284bool BSL_HASH_Empty(
const BSL_HASH_Hash *hash);
295uint32_t BSL_HASH_Size(
const BSL_HASH_Hash *hash);
310BSL_HASH_Iterator BSL_HASH_Erase(BSL_HASH_Hash *hash, uintptr_t key);
322void BSL_HASH_Clear(BSL_HASH_Hash *hash);
334void BSL_HASH_Destroy(BSL_HASH_Hash *hash);
345BSL_HASH_Iterator BSL_HASH_IterBegin(
const BSL_HASH_Hash *hash);
357BSL_HASH_Iterator BSL_HASH_IterEnd(
const BSL_HASH_Hash *hash);
369BSL_HASH_Iterator BSL_HASH_IterNext(
const BSL_HASH_Hash *hash, BSL_HASH_Iterator it);
386uintptr_t BSL_HASH_HashIterKey(
const BSL_HASH_Hash *hash, BSL_HASH_Iterator it);
403uintptr_t BSL_HASH_IterValue(
const BSL_HASH_Hash *hash, BSL_HASH_Iterator it);
405struct BSL_HASH_Info {
406 ListDupFreeFuncPair keyFunc;
407 ListDupFreeFuncPair valueFunc;
408 BSL_HASH_MatchFunc matchFunc;
409 BSL_HASH_CodeCalcFunc hashFunc;
410 uint32_t initialSize;
411 uint32_t nextLevelSize;