shmap.h: hash map handling (key-value storage)


Map functions handle key-value storage, which is implemented as a hash table (O(n), with O(1) amortized time complexity for insert/read/delete)

Supported key/value modes (enum eSHM_Type):

        SHM_II32: int32_t key, int32_t value
        SHM_UU32: uint32_t key, uint32_t value
        SHM_II: int64_t key, int64_t value
        SHM_FF: float (single-precision floating point) key, float value
        SHM_DD: double (double-precision floating point) key, double value
        SHM_IS: int64_t key, string value
        SHM_IP: int64_t key, pointer value
        SHM_SI: string key, int64_t value
        SHM_DS: double key, string value
        SHM_DP: double key, pointer value
        SHM_SD: string key, double value
        SHM_SS: string key, string value
        SHM_SP: string key, pointer value

Callback types for the shm_itp_*() functions:

        typedef srt_bool (*srt_hmap_it_ii32)(int32_t k, int32_t v, void *context);
        typedef srt_bool (*srt_hmap_it_uu32)(uint32_t k, uint32_t v, void *context);
        typedef srt_bool (*srt_hmap_it_ii)(int64_t k, int64_t v, void *context);
        typedef srt_bool (*srt_hmap_it_ff)(float k, float v, void *context);
        typedef srt_bool (*srt_hmap_it_dd)(double k, double v, void *context);
        typedef srt_bool (*srt_hmap_it_is)(int64_t k, const srt_string *, void *context);
        typedef srt_bool (*srt_hmap_it_ip)(int64_t k, const void *, void *context);
        typedef srt_bool (*srt_hmap_it_si)(const srt_string *, int64_t v, void *context);
        typedef srt_bool (*srt_hmap_it_ds)(double k, const srt_string *, void *context);
        typedef srt_bool (*srt_hmap_it_dp)(double k, const void *, void *context);
        typedef srt_bool (*srt_hmap_it_sd)(const srt_string *, double v, void *context);
        typedef srt_bool (*srt_hmap_it_ss)(const srt_string *, const srt_string *, void *context);
        typedef srt_bool (*srt_hmap_it_sp)(const srt_string *, const void *, void *context);

 shm_alloca  shm_capacity_left  shm_dup  shm_insert_ii  shm_it_i32_k  shm_itp_ds 
 shm_at_dd  shm_clear  shm_empty  shm_insert_ii32  shm_it_i_k  shm_itp_ff 
 shm_at_dp  shm_count_d  shm_free  shm_insert_ip  shm_it_ii32_v  shm_itp_ii 
 shm_at_ds  shm_count_f  shm_grow  shm_insert_is  shm_it_ii_v  shm_itp_ii32 
 shm_at_ff  shm_count_i  shm_inc_dd  shm_insert_sd  shm_it_ip_v  shm_itp_ip 
 shm_at_ii  shm_count_i32  shm_inc_ff  shm_insert_si  shm_it_is_v  shm_itp_is 
 shm_at_ii32  shm_count_s  shm_inc_ii  shm_insert_sp  shm_it_s_k  shm_itp_sd 
 shm_at_ip  shm_count_u32  shm_inc_ii32  shm_insert_ss  shm_it_sd_v  shm_itp_si 
 shm_at_is  shm_cpy  shm_inc_sd  shm_insert_uu32  shm_it_si_v  shm_itp_sp 
 shm_at_sd  shm_delete_d  shm_inc_si  shm_it_d_k  shm_it_sp_v  shm_itp_ss 
 shm_at_si  shm_delete_f  shm_inc_uu32  shm_it_dd_v  shm_it_ss_v  shm_itp_uu32 
 shm_at_sp  shm_delete_i  shm_insert_dd  shm_it_dp_v  shm_it_u32_k  shm_max_size 
 shm_at_ss  shm_delete_i32  shm_insert_dp  shm_it_ds_v  shm_it_uu32_v  shm_reserve 
 shm_at_uu32  shm_delete_s  shm_insert_ds  shm_it_f_k  shm_itp_dd  shm_shrink 
 shm_capacity  shm_delete_u32  shm_insert_ff  shm_it_ff_v  shm_itp_dp  shm_size 


srt_hmap *shm_alloca(enum eSHM_Type t, size_t n)



double shm_at_dd(const srt_hmap *hm, double k)



const void *shm_at_dp(const srt_hmap *hm, double k)



const srt_string *shm_at_ds(const srt_hmap *hm, double k)



float shm_at_ff(const srt_hmap *hm, float k)



int64_t shm_at_ii(const srt_hmap *hm, int64_t k)



int32_t shm_at_ii32(const srt_hmap *hm, int32_t k)



const void *shm_at_ip(const srt_hmap *hm, int64_t k)



const srt_string *shm_at_is(const srt_hmap *hm, int64_t k)



double shm_at_sd(const srt_hmap *hm, const srt_string *k)



int64_t shm_at_si(const srt_hmap *hm, const srt_string *k)



const void *shm_at_sp(const srt_hmap *hm, const srt_string *k)



const srt_string *shm_at_ss(const srt_hmap *hm, const srt_string *k)



uint32_t shm_at_uu32(const srt_hmap *hm, uint32_t k)



size_t shm_capacity(const srt_hmap *hm)



size_t shm_capacity_left(const srt_hmap *hm)



void shm_clear(srt_hmap *hm)



size_t shm_count_d(const srt_hmap *hm, double k)



size_t shm_count_f(const srt_hmap *hm, float k)



size_t shm_count_i(const srt_hmap *hm, int64_t k)



size_t shm_count_i32(const srt_hmap *hm, int32_t k)



size_t shm_count_s(const srt_hmap *hm, const srt_string *k)



size_t shm_count_u32(const srt_hmap *hm, uint32_t k)



srt_hmap *shm_cpy(srt_hmap **hm, const srt_hmap *src)



srt_bool shm_delete_d(srt_hmap *hm, double k)



srt_bool shm_delete_f(srt_hmap *hm, float k)



srt_bool shm_delete_i(srt_hmap *hm, int64_t k)



srt_bool shm_delete_i32(srt_hmap *hm, int32_t k)



srt_bool shm_delete_s(srt_hmap *hm, const srt_string *k)



srt_bool shm_delete_u32(srt_hmap *hm, uint32_t k)



srt_hmap *shm_dup(const srt_hmap *src)



srt_bool shm_empty(const srt_hmap *hm)



void shm_free(srt_hmap **hm, ...)



size_t shm_grow(srt_hmap **hm, size_t extra_elems)



srt_bool shm_inc_dd(srt_hmap **hm, double k, double v)



srt_bool shm_inc_ff(srt_hmap **hm, float k, float v)



srt_bool shm_inc_ii(srt_hmap **hm, int64_t k, int64_t v)



srt_bool shm_inc_ii32(srt_hmap **hm, int32_t k, int32_t v)



srt_bool shm_inc_sd(srt_hmap **hm, const srt_string *k, double v)



srt_bool shm_inc_si(srt_hmap **hm, const srt_string *k, int64_t v)



srt_bool shm_inc_uu32(srt_hmap **hm, uint32_t k, uint32_t v)



srt_bool shm_insert_dd(srt_hmap **hm, double k, double v)



srt_bool shm_insert_dp(srt_hmap **hm, double k, const void *v)



srt_bool shm_insert_ds(srt_hmap **hm, double k, const srt_string *v)



srt_bool shm_insert_ff(srt_hmap **hm, float k, float v)



srt_bool shm_insert_ii(srt_hmap **hm, int64_t k, int64_t v)



srt_bool shm_insert_ii32(srt_hmap **hm, int32_t k, int32_t v)



srt_bool shm_insert_ip(srt_hmap **hm, int64_t k, const void *v)



srt_bool shm_insert_is(srt_hmap **hm, int64_t k, const srt_string *v)



srt_bool shm_insert_sd(srt_hmap **hm, const srt_string *k, double v)



srt_bool shm_insert_si(srt_hmap **hm, const srt_string *k, int64_t v)



srt_bool shm_insert_sp(srt_hmap **hm, const srt_string *k, const void *v)



srt_bool shm_insert_ss(srt_hmap **hm, const srt_string *k, const srt_string *v)



srt_bool shm_insert_uu32(srt_hmap **hm, uint32_t k, uint32_t v)



double shm_it_d_k(const srt_hmap *hm, size_t i)



double shm_it_dd_v(const srt_hmap *hm, size_t i)



const void *shm_it_dp_v(const srt_hmap *hm, size_t i)



const srt_string *shm_it_ds_v(const srt_hmap *hm, size_t i)



float shm_it_f_k(const srt_hmap *hm, size_t i)



float shm_it_ff_v(const srt_hmap *hm, size_t i)



int32_t shm_it_i32_k(const srt_hmap *hm, size_t i)



int64_t shm_it_i_k(const srt_hmap *hm, size_t i)



int32_t shm_it_ii32_v(const srt_hmap *hm, size_t i)



int64_t shm_it_ii_v(const srt_hmap *hm, size_t i)



const void *shm_it_ip_v(const srt_hmap *hm, size_t i)



const srt_string *shm_it_is_v(const srt_hmap *hm, size_t i)



const srt_string *shm_it_s_k(const srt_hmap *hm, size_t i)



double shm_it_sd_v(const srt_hmap *hm, size_t i)



int64_t shm_it_si_v(const srt_hmap *hm, size_t i)



const void *shm_it_sp_v(const srt_hmap *hm, size_t i)



const srt_string *shm_it_ss_v(const srt_hmap *hm, size_t i)



uint32_t shm_it_u32_k(const srt_hmap *hm, size_t i)



uint32_t shm_it_uu32_v(const srt_hmap *hm, size_t i)



size_t shm_itp_dd(const srt_hmap *m, size_t begin, size_t end, srt_hmap_it_dd f, void *context)



size_t shm_itp_dp(const srt_hmap *m, size_t begin, size_t end, srt_hmap_it_dp f, void *context)



size_t shm_itp_ds(const srt_hmap *m, size_t begin, size_t end, srt_hmap_it_ds f, void *context)



size_t shm_itp_ff(const srt_hmap *m, size_t begin, size_t end, srt_hmap_it_ff f, void *context)



size_t shm_itp_ii(const srt_hmap *m, size_t begin, size_t end, srt_hmap_it_ii f, void *context)



size_t shm_itp_ii32(const srt_hmap *m, size_t begin, size_t end, srt_hmap_it_ii32 f, void *context)



size_t shm_itp_ip(const srt_hmap *m, size_t begin, size_t end, srt_hmap_it_ip f, void *context)



size_t shm_itp_is(const srt_hmap *m, size_t begin, size_t end, srt_hmap_it_is f, void *context)



size_t shm_itp_sd(const srt_hmap *m, size_t begin, size_t end, srt_hmap_it_sd f, void *context)



size_t shm_itp_si(const srt_hmap *m, size_t begin, size_t end, srt_hmap_it_si f, void *context)



size_t shm_itp_sp(const srt_hmap *m, size_t begin, size_t end, srt_hmap_it_sp f, void *context)



size_t shm_itp_ss(const srt_hmap *m, size_t begin, size_t end, srt_hmap_it_ss f, void *context)



size_t shm_itp_uu32(const srt_hmap *m, size_t begin, size_t end, srt_hmap_it_uu32 f, void *context)



size_t shm_max_size(const srt_hmap *hm)



size_t shm_reserve(srt_hmap **hm, size_t max_elems)



srt_hmap *shm_shrink(srt_hmap **hm)



size_t shm_size(const srt_hmap *hm)