smap.h: map handling (key-value storage)


Map functions handle key-value storage, which is implemented as a Red-Black tree (O(log n) time complexity for insert/read/delete)

Supported key/value modes (enum eSM_Type):

        SM_II32: int32_t key, int32_t value
        SM_UU32: uint32_t key, uint32_t value
        SM_II: int64_t key, int64_t value
        SM_FF: float (single-precision floating point) key, float value
        SM_DD: double (double-precision floating point) key, double value
        SM_IS: int64_t key, string value
        SM_IP: int64_t key, pointer value
        SM_SI: string key, int64_t value
        SM_DS: double key, string value
        SM_DP: double key, pointer value
        SM_SD: string key, double value
        SM_SS: string key, string value
        SM_SP: string key, pointer value

Callback types for the sm_itr_*() functions:

        typedef srt_bool (*srt_map_it_ii32)(int32_t k, int32_t v, void *context);
        typedef srt_bool (*srt_map_it_uu32)(uint32_t k, uint32_t v, void *context);
        typedef srt_bool (*srt_map_it_ii)(int64_t k, int64_t v, void *context);
        typedef srt_bool (*srt_map_it_ff)(float k, float v, void *context);
        typedef srt_bool (*srt_map_it_dd)(double k, double v, void *context);
        typedef srt_bool (*srt_map_it_is)(int64_t k, const srt_string *, void *context);
        typedef srt_bool (*srt_map_it_ip)(int64_t k, const void *, void *context);
        typedef srt_bool (*srt_map_it_si)(const srt_string *, int64_t v, void *context);
        typedef srt_bool (*srt_map_it_ds)(double k, const srt_string *, void *context);
        typedef srt_bool (*srt_map_it_dp)(double k, const void *, void *context);
        typedef srt_bool (*srt_map_it_sd)(const srt_string *, double v, void *context);
        typedef srt_bool (*srt_map_it_ss)(const srt_string *, const srt_string *, void *context);
        typedef srt_bool (*srt_map_it_sp)(const srt_string *, const void *, void *context);

 sm_alloc  sm_capacity  sm_delete_u32  sm_insert_ff  sm_it_ff_v  sm_itr_dp 
 sm_alloca  sm_capacity_left  sm_dup  sm_insert_ii  sm_it_i32_k  sm_itr_ds 
 sm_at_dd  sm_clear  sm_empty  sm_insert_ii32  sm_it_i_k  sm_itr_ff 
 sm_at_dp  sm_count_d  sm_free  sm_insert_ip  sm_it_ii32_v  sm_itr_ii 
 sm_at_ds  sm_count_f  sm_grow  sm_insert_is  sm_it_ii_v  sm_itr_ii32 
 sm_at_ff  sm_count_i  sm_inc_dd  sm_insert_sd  sm_it_ip_v  sm_itr_ip 
 sm_at_ii  sm_count_i32  sm_inc_ff  sm_insert_si  sm_it_is_v  sm_itr_is 
 sm_at_ii32  sm_count_s  sm_inc_ii  sm_insert_sp  sm_it_s_k  sm_itr_sd 
 sm_at_ip  sm_count_u32  sm_inc_ii32  sm_insert_ss  sm_it_sd_v  sm_itr_si 
 sm_at_is  sm_cpy  sm_inc_sd  sm_insert_uu32  sm_it_si_v  sm_itr_sp 
 sm_at_sd  sm_delete_d  sm_inc_si  sm_it_d_k  sm_it_sp_v  sm_itr_ss 
 sm_at_si  sm_delete_f  sm_inc_uu32  sm_it_dd_v  sm_it_ss_v  sm_itr_uu32 
 sm_at_sp  sm_delete_i  sm_insert_dd  sm_it_dp_v  sm_it_u32_k  sm_reserve 
 sm_at_ss  sm_delete_i32  sm_insert_dp  sm_it_ds_v  sm_it_uu32_v  sm_shrink 
 sm_at_uu32  sm_delete_s  sm_insert_ds  sm_it_f_k  sm_itr_dd  sm_size 


srt_map *sm_alloc(enum eSM_Type t, size_t initial_num_elems_reserve)



srt_map *sm_alloca(enum eSM_Type t, size_t n)



double sm_at_dd(const srt_map *m, double k)



const void *sm_at_dp(const srt_map *m, double k)



const srt_string *sm_at_ds(const srt_map *m, double k)



float sm_at_ff(const srt_map *m, float k)



int64_t sm_at_ii(const srt_map *m, int64_t k)



int32_t sm_at_ii32(const srt_map *m, int32_t k)



const void *sm_at_ip(const srt_map *m, int64_t k)



const srt_string *sm_at_is(const srt_map *m, int64_t k)



double sm_at_sd(const srt_map *m, const srt_string *k)



int64_t sm_at_si(const srt_map *m, const srt_string *k)



const void *sm_at_sp(const srt_map *m, const srt_string *k)



const srt_string *sm_at_ss(const srt_map *m, const srt_string *k)



uint32_t sm_at_uu32(const srt_map *m, uint32_t k)



size_t sm_capacity(const srt_map *m)



size_t sm_capacity_left(const srt_map *m)



void sm_clear(srt_map *m)



size_t sm_count_d(const srt_map *m, double k)



size_t sm_count_f(const srt_map *m, float k)



size_t sm_count_i(const srt_map *m, int64_t k)



size_t sm_count_i32(const srt_map *m, int32_t k)



size_t sm_count_s(const srt_map *m, const srt_string *k)



size_t sm_count_u32(const srt_map *m, uint32_t k)



srt_map *sm_cpy(srt_map **m, const srt_map *src)



srt_bool sm_delete_d(srt_map *m, double k)



srt_bool sm_delete_f(srt_map *m, float k)



srt_bool sm_delete_i(srt_map *m, int64_t k)



srt_bool sm_delete_i32(srt_map *m, int32_t k)



srt_bool sm_delete_s(srt_map *m, const srt_string *k)



srt_bool sm_delete_u32(srt_map *m, uint32_t k)



srt_map *sm_dup(const srt_map *src)



srt_bool sm_empty(const srt_map *m)



void sm_free(srt_map **m, ...)



size_t sm_grow(srt_map **m, size_t extra_elems)



srt_bool sm_inc_dd(srt_map **m, double k, double v)



srt_bool sm_inc_ff(srt_map **m, float k, float v)



srt_bool sm_inc_ii(srt_map **m, int64_t k, int64_t v)



srt_bool sm_inc_ii32(srt_map **m, int32_t k, int32_t v)



srt_bool sm_inc_sd(srt_map **m, const srt_string *k, double v)



srt_bool sm_inc_si(srt_map **m, const srt_string *k, int64_t v)



srt_bool sm_inc_uu32(srt_map **m, uint32_t k, uint32_t v)



srt_bool sm_insert_dd(srt_map **m, double k, double v)



srt_bool sm_insert_dp(srt_map **m, double k, const void *v)



srt_bool sm_insert_ds(srt_map **m, double k, const srt_string *v)



srt_bool sm_insert_ff(srt_map **m, float k, float v)



srt_bool sm_insert_ii(srt_map **m, int64_t k, int64_t v)



srt_bool sm_insert_ii32(srt_map **m, int32_t k, int32_t v)



srt_bool sm_insert_ip(srt_map **m, int64_t k, const void *v)



srt_bool sm_insert_is(srt_map **m, int64_t k, const srt_string *v)



srt_bool sm_insert_sd(srt_map **m, const srt_string *k, double v)



srt_bool sm_insert_si(srt_map **m, const srt_string *k, int64_t v)



srt_bool sm_insert_sp(srt_map **m, const srt_string *k, const void *v)



srt_bool sm_insert_ss(srt_map **m, const srt_string *k, const srt_string *v)



srt_bool sm_insert_uu32(srt_map **m, uint32_t k, uint32_t v)



double sm_it_d_k(const srt_map *m, srt_tndx i)



double sm_it_dd_v(const srt_map *m, srt_tndx i)



const void *sm_it_dp_v(const srt_map *m, srt_tndx i)



const srt_string *sm_it_ds_v(const srt_map *m, srt_tndx i)



float sm_it_f_k(const srt_map *m, srt_tndx i)



float sm_it_ff_v(const srt_map *m, srt_tndx i)



int32_t sm_it_i32_k(const srt_map *m, srt_tndx i)



int64_t sm_it_i_k(const srt_map *m, srt_tndx i)



int32_t sm_it_ii32_v(const srt_map *m, srt_tndx i)



int64_t sm_it_ii_v(const srt_map *m, srt_tndx i)



const void *sm_it_ip_v(const srt_map *m, srt_tndx i)



const srt_string *sm_it_is_v(const srt_map *m, srt_tndx i)



const srt_string *sm_it_s_k(const srt_map *m, srt_tndx i)



double sm_it_sd_v(const srt_map *m, srt_tndx i)



int64_t sm_it_si_v(const srt_map *m, srt_tndx i)



const void *sm_it_sp_v(const srt_map *m, srt_tndx i)



const srt_string *sm_it_ss_v(const srt_map *m, srt_tndx i)



uint32_t sm_it_u32_k(const srt_map *m, srt_tndx i)



uint32_t sm_it_uu32_v(const srt_map *m, srt_tndx i)



size_t sm_itr_dd(const srt_map *m, double key_min, double key_max, srt_map_it_dd f, void *context)



size_t sm_itr_dp(const srt_map *m, double key_min, double key_max, srt_map_it_dp f, void *context)



size_t sm_itr_ds(const srt_map *m, double key_min, double key_max, srt_map_it_ds f, void *context)



size_t sm_itr_ff(const srt_map *m, float key_min, float key_max, srt_map_it_ff f, void *context)



size_t sm_itr_ii(const srt_map *m, int64_t key_min, int64_t key_max, srt_map_it_ii f, void *context)



size_t sm_itr_ii32(const srt_map *m, int32_t key_min, int32_t key_max, srt_map_it_ii32 f, void *context)



size_t sm_itr_ip(const srt_map *m, int64_t key_min, int64_t key_max, srt_map_it_ip f, void *context)



size_t sm_itr_is(const srt_map *m, int64_t key_min, int64_t key_max, srt_map_it_is f, void *context)



size_t sm_itr_sd(const srt_map *m, const srt_string *key_min, const srt_string *key_max, srt_map_it_sd f, void *context)



size_t sm_itr_si(const srt_map *m, const srt_string *key_min, const srt_string *key_max, srt_map_it_si f, void *context)



size_t sm_itr_sp(const srt_map *m, const srt_string *key_min, const srt_string *key_max, srt_map_it_sp f, void *context)



size_t sm_itr_ss(const srt_map *m, const srt_string *key_min, const srt_string *key_max, srt_map_it_ss f, void *context)



size_t sm_itr_uu32(const srt_map *m, uint32_t key_min, uint32_t key_max, srt_map_it_uu32 f, void *context)



size_t sm_reserve(srt_map **m, size_t max_elems)



srt_map *sm_shrink(srt_map **m)



size_t sm_size(const srt_map *m)