14 typedef struct _HashSet {
20 int32_t (*add) (
struct _HashSet*, Key, size_t);
24 int32_t (*find) (
struct _HashSet*, Key, size_t);
28 int32_t (*
remove) (
struct _HashSet*, Key, size_t);
32 int32_t (*size) (
struct _HashSet*);
36 int32_t (*iterate) (
struct _HashSet*, bool, Key*);
40 int32_t (*set_destroy) (
struct _HashSet*, void (*) (Key));
44 int32_t (*set_hash) (
struct _HashSet*, uint32_t (*) (Key, size_t));
struct _HashSetData HashSetData
HashSetData is the data type for the container private information.
int32_t HashSetSetHash(HashSet *self, uint32_t(*pFunc)(Key, size_t))
Set the custom hash function.
HashSetData * pData
The container private information.
int32_t HashSetAdd(HashSet *self, Key key, size_t size)
Insert a key into the set.
int32_t HashSetIntersect(HashSet *pFst, HashSet *pSnd, HashSet **ppDst)
Perform intersection operation for the designated two sets and create the result set.
int32_t HashSetSize(HashSet *self)
Return the number of stored unique keys.
void HashSetDeinit(HashSet **ppObj)
The destructor for HashSet.
int32_t HashSetSetDestroy(HashSet *self, void(*pFunc)(Key))
Set the custom key resource clean method.
int32_t HashSetRemove(HashSet *self, Key key, size_t size)
Delete the designated key from the set.
The implementation for hash set.
int32_t HashSetFind(HashSet *self, Key key, size_t size)
Check if the set contains the designated key.
int32_t HashSetIterate(HashSet *self, bool bReset, Key *pKey)
Iterate through the set to retrieve each key.
int32_t HashSetDifference(HashSet *pFst, HashSet *pSnd, HashSet **ppDst)
Perform difference operation for the first source set against the second source set and create the re...
int32_t HashSetUnion(HashSet *pFst, HashSet *pSnd, HashSet **ppDst)
Perform union operation for the designated two sets and create the result set.
int32_t HashSetInit(HashSet **ppObj)
The constructor for HashSet.