shset.h: hash set handling (key-only storage)


Set functions handle key-only storage, which is implemented as a hash table (O(n), with O(1) amortized time complexity for insert/ count/delete).

Supported set modes (enum eSHS_Type):

        SHS_I32: int32_t key
        SHS_U32: uint32_t key
        SHS_I: int64_t key
        SHS_F: float (single-precision floating point) key
        SHS_D: double (double-precision floating point) key
        SHS_S: string key

Callback types for the shs_itp_*() functions:

        typedef srt_bool (*srt_hset_it_i32)(int32_t k, void *context);
        typedef srt_bool (*srt_hset_it_u32)(uint32_t k, void *context);
        typedef srt_bool (*srt_hset_it_i)(int64_t k, void *context);
        typedef srt_bool (*srt_hset_it_f)(float k, void *context);
        typedef srt_bool (*srt_hset_it_d)(double k, void *context);
        typedef srt_bool (*srt_hset_it_s)(const srt_string *, void *context);

 shs_alloc  shs_count_i32  shs_delete_s  shs_insert_i  shs_it_s  shs_max_size 
 shs_alloca  shs_count_s  shs_delete_u32  shs_insert_i32  shs_it_u32  shs_reserve 
 shs_capacity  shs_count_u32  shs_dup  shs_insert_s  shs_itp_d  shs_shrink 
 shs_capacity_left  shs_cpy  shs_empty  shs_insert_u32  shs_itp_f  shs_size 
 shs_clear  shs_delete_d  shs_free  shs_it_d  shs_itp_i 
 shs_count_d  shs_delete_f  shs_grow  shs_it_f  shs_itp_i32 
 shs_count_f  shs_delete_i  shs_insert_d  shs_it_i  shs_itp_s 
 shs_count_i  shs_delete_i32  shs_insert_f  shs_it_i32  shs_itp_u32 


srt_hset *shs_alloc(enum eSHS_Type t, size_t init_size)



srt_hset *shs_alloca(enum eSHS_Type t, size_t n)



size_t shs_capacity(const srt_hset *hs)



size_t shs_capacity_left(const srt_hset *hs)



void shs_clear(srt_hset *hs)



size_t shs_count_d(const srt_hset *hs, double k)



size_t shs_count_f(const srt_hset *hs, float k)



size_t shs_count_i(const srt_hset *hs, int64_t k)



size_t shs_count_i32(const srt_hset *hs, int32_t k)



size_t shs_count_s(const srt_hset *hs, const srt_string *k)



size_t shs_count_u32(const srt_hset *hs, uint32_t k)



srt_hset *shs_cpy(srt_hset **hs, const srt_hset *src)



srt_bool shs_delete_d(srt_hset *hs, double k)



srt_bool shs_delete_f(srt_hset *hs, float k)



srt_bool shs_delete_i(srt_hset *hs, int64_t k)



srt_bool shs_delete_i32(srt_hset *hs, int32_t k)



srt_bool shs_delete_s(srt_hset *hs, const srt_string *k)



srt_bool shs_delete_u32(srt_hset *hs, uint32_t k)



srt_hset *shs_dup(const srt_hset *src)



srt_bool shs_empty(const srt_hset *hs)



void shs_free(srt_hset **hs, ...)



size_t shs_grow(srt_hset **hs, size_t extra_elems)



srt_bool shs_insert_d(srt_hset **hs, double k)



srt_bool shs_insert_f(srt_hset **hs, float k)



srt_bool shs_insert_i(srt_hset **hs, int64_t k)



srt_bool shs_insert_i32(srt_hset **hs, int32_t k)



srt_bool shs_insert_s(srt_hset **hs, const srt_string *k)



srt_bool shs_insert_u32(srt_hset **hs, uint32_t k)



double shs_it_d(const srt_hset *hs, size_t i)



float shs_it_f(const srt_hset *hs, size_t i)



int64_t shs_it_i(const srt_hset *hs, size_t i)



int32_t shs_it_i32(const srt_hset *hs, size_t i)



const srt_string *shs_it_s(const srt_hset *hs, size_t i)



uint32_t shs_it_u32(const srt_hset *hs, size_t i)



size_t shs_itp_d(const srt_hset *s, size_t begin, size_t end, srt_hset_it_d f, void *context)



size_t shs_itp_f(const srt_hset *s, size_t begin, size_t end, srt_hset_it_f f, void *context)



size_t shs_itp_i(const srt_hset *s, size_t begin, size_t end, srt_hset_it_i f, void *context)



size_t shs_itp_i32(const srt_hset *s, size_t begin, size_t end, srt_hset_it_i32 f, void *context)



size_t shs_itp_s(const srt_hset *s, size_t begin, size_t end, srt_hset_it_s f, void *context)



size_t shs_itp_u32(const srt_hset *s, size_t begin, size_t end, srt_hset_it_u32 f, void *context)



size_t shs_max_size(const srt_hset *hs)



size_t shs_reserve(srt_hset **hs, size_t max_elems)



srt_hset *shs_shrink(srt_hset **hs)



size_t shs_size(const srt_hset *hs)