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;
30 struct tag_SkipListSet;
32 template <typename Key, typename Val>
33 struct set_type< tag_SkipListSet, Key, Val >: public set_type_base< Key, Val >
35 typedef set_type_base< Key, Val > base_class;
36 typedef typename base_class::key_val key_val;
37 typedef typename base_class::compare compare;
38 typedef typename base_class::less less;
39 typedef typename base_class::hash hash;
41 class traits_SkipListSet_less_pascal: public cc::skip_list::make_traits <
43 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
44 ,co::item_counter< cds::atomicity::item_counter >
47 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_pascal > SkipListSet_hp_less_pascal;
48 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_pascal > SkipListSet_dhp_less_pascal;
49 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_gpi_less_pascal;
50 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_gpb_less_pascal;
51 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_gpt_less_pascal;
52 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
53 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_shb_less_pascal;
54 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_sht_less_pascal;
57 class traits_SkipListSet_less_pascal_seqcst: public cc::skip_list::make_traits <
59 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
60 ,co::memory_model< co::v::sequential_consistent >
61 ,co::item_counter< cds::atomicity::item_counter >
64 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_hp_less_pascal_seqcst;
65 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_dhp_less_pascal_seqcst;
66 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_gpi_less_pascal_seqcst;
67 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_gpb_less_pascal_seqcst;
68 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_gpt_less_pascal_seqcst;
69 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
70 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_shb_less_pascal_seqcst;
71 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_sht_less_pascal_seqcst;
74 class traits_SkipListSet_less_pascal_stat: public cc::skip_list::make_traits <
76 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
77 ,co::stat< cc::skip_list::stat<> >
78 ,co::item_counter< cds::atomicity::item_counter >
81 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_hp_less_pascal_stat;
82 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_dhp_less_pascal_stat;
83 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_gpi_less_pascal_stat;
84 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_gpb_less_pascal_stat;
85 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_gpt_less_pascal_stat;
86 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
87 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_shb_less_pascal_stat;
88 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_sht_less_pascal_stat;
91 class traits_SkipListSet_cmp_pascal: public cc::skip_list::make_traits <
92 co::compare< compare >
93 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
94 ,co::item_counter< cds::atomicity::item_counter >
97 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_hp_cmp_pascal;
98 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_dhp_cmp_pascal;
99 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_gpi_cmp_pascal;
100 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_gpb_cmp_pascal;
101 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_gpt_cmp_pascal;
102 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
103 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_shb_cmp_pascal;
104 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_sht_cmp_pascal;
107 class traits_SkipListSet_cmp_pascal_stat: public cc::skip_list::make_traits <
108 co::compare< compare >
109 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
110 ,co::stat< cc::skip_list::stat<> >
111 ,co::item_counter< cds::atomicity::item_counter >
114 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_hp_cmp_pascal_stat;
115 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_dhp_cmp_pascal_stat;
116 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_gpi_cmp_pascal_stat;
117 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_gpb_cmp_pascal_stat;
118 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_gpt_cmp_pascal_stat;
119 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
120 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_shb_cmp_pascal_stat;
121 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_sht_cmp_pascal_stat;
124 class traits_SkipListSet_less_xorshift: public cc::skip_list::make_traits <
126 ,cc::skip_list::random_level_generator< cc::skip_list::xorshift >
127 ,co::item_counter< cds::atomicity::item_counter >
130 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_xorshift > SkipListSet_hp_less_xorshift;
131 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_xorshift > SkipListSet_dhp_less_xorshift;
132 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_gpi_less_xorshift;
133 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_gpb_less_xorshift;
134 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_gpt_less_xorshift;
135 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
136 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_shb_less_xorshift;
137 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_sht_less_xorshift;
140 class traits_SkipListSet_less_xorshift_stat: public cc::skip_list::make_traits <
142 ,cc::skip_list::random_level_generator< cc::skip_list::xorshift >
143 ,co::stat< cc::skip_list::stat<> >
144 ,co::item_counter< cds::atomicity::item_counter >
147 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_hp_less_xorshift_stat;
148 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_dhp_less_xorshift_stat;
149 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_gpi_less_xorshift_stat;
150 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_gpb_less_xorshift_stat;
151 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_gpt_less_xorshift_stat;
152 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
153 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_shb_less_xorshift_stat;
154 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_sht_less_xorshift_stat;
157 class traits_SkipListSet_cmp_xorshift: public cc::skip_list::make_traits <
158 co::compare< compare >
159 ,cc::skip_list::random_level_generator< cc::skip_list::xorshift >
160 ,co::item_counter< cds::atomicity::item_counter >
163 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_hp_cmp_xorshift;
164 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_dhp_cmp_xorshift;
165 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_gpi_cmp_xorshift;
166 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_gpb_cmp_xorshift;
167 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_gpt_cmp_xorshift;
168 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
169 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_shb_cmp_xorshift;
170 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_sht_cmp_xorshift;
173 class traits_SkipListSet_cmp_xorshift_stat: public cc::skip_list::make_traits <
174 co::compare< compare >
175 ,cc::skip_list::random_level_generator< cc::skip_list::xorshift >
176 ,co::stat< cc::skip_list::stat<> >
177 ,co::item_counter< cds::atomicity::item_counter >
180 typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_hp_cmp_xorshift_stat;
181 typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_dhp_cmp_xorshift_stat;
182 typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_gpi_cmp_xorshift_stat;
183 typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_gpb_cmp_xorshift_stat;
184 typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_gpt_cmp_xorshift_stat;
185 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
186 typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_shb_cmp_xorshift_stat;
187 typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_sht_cmp_xorshift_stat;
191 template <typename GC, typename T, typename Traits>
192 static inline void print_stat( SkipListSet<GC, T, Traits> const& s )
194 CPPUNIT_MSG( s.statistics() );
199 #endif // #ifndef CDSUNIT_SET_TYPE_SKIP_LIST_H