3 #ifndef CDSUNIT_SET_TYPE_SKIP_LIST_H
4 #define CDSUNIT_SET_TYPE_SKIP_LIST_H
6 #include "set2/set_type.h"
8 #include <cds/container/skip_list_set_hp.h>
9 #include <cds/container/skip_list_set_dhp.h>
10 #include <cds/container/skip_list_set_rcu.h>
12 #include "print_skip_list_stat.h"
16 template <typename GC, typename T, typename Traits = cc::skip_list::traits >
17 class SkipListSet : public cc::SkipListSet<GC, T, Traits>
19 typedef cc::SkipListSet<GC, T, Traits> base_class;
21 template <typename Config>
22 SkipListSet( Config const& /*cfg*/ )
26 static CDS_CONSTEXPR bool const c_bExtractSupported = true;
27 static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
28 static CDS_CONSTEXPR bool const c_bEraseExactKey = false;
31 struct tag_SkipListSet;
33 template <typename Key, typename Val>
34 struct set_type< tag_SkipListSet, Key, Val >: public set_type_base< Key, Val >
36 typedef set_type_base< Key, Val > base_class;
37 typedef typename base_class::key_val key_val;
38 typedef typename base_class::compare compare;
39 typedef typename base_class::less less;
40 typedef typename base_class::hash hash;
42 class traits_SkipListSet_less_pascal: public cc::skip_list::make_traits <
44 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
45 ,co::item_counter< cds::atomicity::item_counter >
48 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_pascal > SkipListSet_hp_less_pascal;
49 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_pascal > SkipListSet_dhp_less_pascal;
50 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_gpi_less_pascal;
51 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_gpb_less_pascal;
52 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_gpt_less_pascal;
53 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
54 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_shb_less_pascal;
55 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_sht_less_pascal;
58 class traits_SkipListSet_less_pascal_seqcst: public cc::skip_list::make_traits <
60 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
61 ,co::memory_model< co::v::sequential_consistent >
62 ,co::item_counter< cds::atomicity::item_counter >
65 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_hp_less_pascal_seqcst;
66 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_dhp_less_pascal_seqcst;
67 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_gpi_less_pascal_seqcst;
68 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_gpb_less_pascal_seqcst;
69 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_gpt_less_pascal_seqcst;
70 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
71 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_shb_less_pascal_seqcst;
72 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_sht_less_pascal_seqcst;
75 class traits_SkipListSet_less_pascal_stat: public cc::skip_list::make_traits <
77 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
78 ,co::stat< cc::skip_list::stat<> >
79 ,co::item_counter< cds::atomicity::item_counter >
82 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_hp_less_pascal_stat;
83 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_dhp_less_pascal_stat;
84 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_gpi_less_pascal_stat;
85 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_gpb_less_pascal_stat;
86 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_gpt_less_pascal_stat;
87 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
88 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_shb_less_pascal_stat;
89 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_sht_less_pascal_stat;
92 class traits_SkipListSet_cmp_pascal: public cc::skip_list::make_traits <
93 co::compare< compare >
94 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
95 ,co::item_counter< cds::atomicity::item_counter >
98 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_hp_cmp_pascal;
99 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_dhp_cmp_pascal;
100 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_gpi_cmp_pascal;
101 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_gpb_cmp_pascal;
102 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_gpt_cmp_pascal;
103 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
104 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_shb_cmp_pascal;
105 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_sht_cmp_pascal;
108 class traits_SkipListSet_cmp_pascal_stat: public cc::skip_list::make_traits <
109 co::compare< compare >
110 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
111 ,co::stat< cc::skip_list::stat<> >
112 ,co::item_counter< cds::atomicity::item_counter >
115 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_hp_cmp_pascal_stat;
116 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_dhp_cmp_pascal_stat;
117 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_gpi_cmp_pascal_stat;
118 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_gpb_cmp_pascal_stat;
119 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_gpt_cmp_pascal_stat;
120 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
121 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_shb_cmp_pascal_stat;
122 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_sht_cmp_pascal_stat;
125 class traits_SkipListSet_less_xorshift: public cc::skip_list::make_traits <
127 ,cc::skip_list::random_level_generator< cc::skip_list::xorshift >
128 ,co::item_counter< cds::atomicity::item_counter >
131 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_xorshift > SkipListSet_hp_less_xorshift;
132 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_xorshift > SkipListSet_dhp_less_xorshift;
133 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_gpi_less_xorshift;
134 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_gpb_less_xorshift;
135 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_gpt_less_xorshift;
136 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
137 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_shb_less_xorshift;
138 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_sht_less_xorshift;
141 class traits_SkipListSet_less_xorshift_stat: public cc::skip_list::make_traits <
143 ,cc::skip_list::random_level_generator< cc::skip_list::xorshift >
144 ,co::stat< cc::skip_list::stat<> >
145 ,co::item_counter< cds::atomicity::item_counter >
148 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_hp_less_xorshift_stat;
149 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_dhp_less_xorshift_stat;
150 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_gpi_less_xorshift_stat;
151 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_gpb_less_xorshift_stat;
152 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_gpt_less_xorshift_stat;
153 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
154 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_shb_less_xorshift_stat;
155 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_sht_less_xorshift_stat;
158 class traits_SkipListSet_cmp_xorshift: public cc::skip_list::make_traits <
159 co::compare< compare >
160 ,cc::skip_list::random_level_generator< cc::skip_list::xorshift >
161 ,co::item_counter< cds::atomicity::item_counter >
164 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_hp_cmp_xorshift;
165 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_dhp_cmp_xorshift;
166 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_gpi_cmp_xorshift;
167 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_gpb_cmp_xorshift;
168 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_gpt_cmp_xorshift;
169 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
170 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_shb_cmp_xorshift;
171 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_sht_cmp_xorshift;
174 class traits_SkipListSet_cmp_xorshift_stat: public cc::skip_list::make_traits <
175 co::compare< compare >
176 ,cc::skip_list::random_level_generator< cc::skip_list::xorshift >
177 ,co::stat< cc::skip_list::stat<> >
178 ,co::item_counter< cds::atomicity::item_counter >
181 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_hp_cmp_xorshift_stat;
182 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_dhp_cmp_xorshift_stat;
183 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_gpi_cmp_xorshift_stat;
184 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_gpb_cmp_xorshift_stat;
185 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_gpt_cmp_xorshift_stat;
186 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
187 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_shb_cmp_xorshift_stat;
188 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_sht_cmp_xorshift_stat;
192 template <typename GC, typename T, typename Traits>
193 static inline void print_stat( SkipListSet<GC, T, Traits> const& s )
195 CPPUNIT_MSG( s.statistics() );
200 #endif // #ifndef CDSUNIT_SET_TYPE_SKIP_LIST_H