00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CUCON_HZSET_H
00019 #define CUCON_HZSET_H
00020
00021 #include <cucon/hzmap.h>
00022
00023 CU_BEGIN_DECLARATIONS
00024
00025
00026
00027
00028
00029
00030
00031
00032 struct cucon_hzset_node
00033 {
00034 struct cucon_hzmap_node impl;
00035 };
00036
00037
00038 struct cucon_hzset
00039 {
00040 struct cucon_hzmap impl;
00041 };
00042
00043
00044 CU_SINLINE size_t cucon_hzset_size(cucon_hzset_t set)
00045 { return cucon_hzmap_size(&set->impl); }
00046
00047
00048 CU_SINLINE size_t cucon_hzset_capacity(cucon_hzset_t set)
00049 { return cucon_hzmap_capacity(&set->impl); }
00050
00051
00052 CU_SINLINE void cucon_hzset_init(cucon_hzset_t set, cu_shortsize_t key_size_w)
00053 { cucon_hzmap_init(&set->impl, key_size_w); }
00054
00055
00056 CU_SINLINE cucon_hzset_t cucon_hzset_new(cu_shortsize_t key_size_w)
00057 { return (cucon_hzset_t)cucon_hzmap_new(key_size_w); }
00058
00059
00060
00061
00062
00063 CU_SINLINE cu_bool_t
00064 cucon_hzset_insert_node(cucon_hzset_t set, cucon_hzset_node_t node)
00065 { return cucon_hzmap_insert_node(&set->impl, &node->impl); }
00066
00067
00068
00069 CU_SINLINE cu_bool_t cucon_hzset_insert(cucon_hzset_t set, void const *key)
00070 { return cucon_hzmap_insert_void(&set->impl, key); }
00071
00072
00073
00074 CU_SINLINE cu_bool_t cucon_hzset_erase(cucon_hzset_t set, void const *key)
00075 { return cucon_hzmap_erase(&set->impl, key); }
00076
00077
00078
00079
00080 CU_SINLINE cu_bool_t cucon_hzset_step_erase(cucon_hzset_t set, void const *key)
00081 { return cucon_hzmap_step_erase(&set->impl, key); }
00082
00083
00084 CU_SINLINE void cucon_hzset_finish_erase(cucon_hzset_t set)
00085 { cucon_hzmap_finish_erase(&set->impl); }
00086
00087
00088 CU_SINLINE cu_bool_t cucon_hzset_contains(cucon_hzset_t set, void const *key)
00089 { return cucon_hzmap_find(&set->impl, key) != NULL; }
00090
00091
00092
00093 CU_SINLINE cu_bool_t
00094 cucon_hzset_1w_contains(cucon_hzset_t set, void const *key)
00095 { return cucon_hzmap_1w_find(&set->impl, key) != NULL; }
00096
00097
00098
00099 CU_SINLINE cu_bool_t
00100 cucon_hzset_2w_contains(cucon_hzset_t set, void const *key)
00101 { return cucon_hzmap_2w_find(&set->impl, key) != NULL; }
00102
00103
00104
00105 CU_SINLINE cu_bool_t
00106 cucon_hzset_forall(cu_clop(f, cu_bool_t, void const *key), cucon_hzset_t set)
00107 { return cucon_hzmap_forall_keys(f, &set->impl); }
00108
00109
00110 CU_SINLINE void
00111 cucon_hzset_filter(cu_clop(f, cu_bool_t, void const *key), cucon_hzset_t set)
00112 { cucon_hzmap_filter_keys(f, &set->impl); }
00113
00114
00115 struct cucon_hzset_itr
00116 {
00117 struct cucon_hzmap_itr impl;
00118 };
00119
00120
00121 CU_SINLINE void cucon_hzset_itr_init(cucon_hzset_itr_t itr, cucon_hzset_t set)
00122 { cucon_hzmap_itr_init(&itr->impl, &set->impl); }
00123
00124
00125
00126 CU_SINLINE void const *cucon_hzset_itr_get(cucon_hzset_itr_t itr)
00127 { return cucon_hzmap_itr_get_key(&itr->impl); }
00128
00129
00130 CU_END_DECLARATIONS
00131
00132 #endif