25a46ea5e119d7c84e09130362465ebc0acdb20a
[libcds.git] / tests / test-hdr / set / hdr_intrusive_splitlist_set_rcu_gpb.cpp
1 //$$CDS-header$$
2
3 #include "set/hdr_intrusive_set.h"
4 #include <cds/urcu/general_buffered.h>
5 #include <cds/intrusive/michael_list_rcu.h>
6 #include <cds/intrusive/split_list_rcu.h>
7
8 namespace set {
9     namespace {
10         typedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_type;
11     }
12
13     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_base_cmp()
14     {
15         typedef base_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
16         typedef ci::MichaelList< rcu_type
17             ,item
18             ,ci::michael_list::make_traits<
19                 ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
20                 ,co::compare< cmp<item> >
21                 ,ci::opt::disposer< faked_disposer >
22             >::type
23         >    ord_list;
24
25         typedef ci::SplitListSet< rcu_type, ord_list,
26             ci::split_list::make_traits<
27                 co::hash< hash_int >
28                 ,ci::split_list::dynamic_bucket_table<true>
29                 ,co::memory_model<co::v::relaxed_ordering>
30             >::type
31         > set;
32         static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
33
34         test_rcu_int<set>();
35     }
36
37     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_base_less()
38     {
39         typedef base_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
40         typedef ci::MichaelList< rcu_type
41             ,item
42             ,ci::michael_list::make_traits<
43                 ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
44                 ,co::less< less<item> >
45                 ,ci::opt::disposer< faked_disposer >
46             >::type
47         >    ord_list;
48
49         typedef ci::SplitListSet< rcu_type, ord_list,
50             ci::split_list::make_traits<
51                 co::hash< hash_int >
52                 ,co::memory_model<co::v::sequential_consistent>
53             >::type
54         > set;
55         static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
56
57         test_rcu_int<set>();
58     }
59
60     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_base_cmpmix()
61     {
62         typedef base_int_item< ci::split_list::node<ci::michael_list::node<rcu_type> > > item;
63         typedef ci::MichaelList< rcu_type
64             ,item
65             ,ci::michael_list::make_traits<
66                 ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
67                 ,co::less< less<item> >
68                 ,co::compare< cmp<item> >
69                 ,ci::opt::disposer< faked_disposer >
70             >::type
71         >    ord_list;
72
73         typedef ci::SplitListSet< rcu_type, ord_list,
74             ci::split_list::make_traits<
75                 co::hash< hash_int >
76                 ,co::item_counter< simple_item_counter >
77                 ,ci::split_list::dynamic_bucket_table<true>
78             >::type
79         > set;
80         static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
81
82         test_rcu_int<set>();
83     }
84
85     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_cmp()
86     {
87         typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
88         typedef ci::MichaelList< rcu_type
89             ,item
90             ,ci::michael_list::make_traits<
91                 ci::opt::hook< ci::michael_list::member_hook<
92                     offsetof( item, hMember ),
93                     co::gc<rcu_type>
94                 > >
95                 ,co::compare< cmp<item> >
96                 ,ci::opt::disposer< faked_disposer >
97             >::type
98         >    ord_list;
99
100         typedef ci::SplitListSet< rcu_type, ord_list,
101             ci::split_list::make_traits<
102                 co::hash< hash_int >
103             >::type
104         > set;
105         static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
106
107         test_rcu_int<set>();
108     }
109
110     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_less()
111     {
112         typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
113         typedef ci::MichaelList< rcu_type
114             ,item
115             ,ci::michael_list::make_traits<
116                 ci::opt::hook< ci::michael_list::member_hook<
117                     offsetof( item, hMember ),
118                     co::gc<rcu_type>
119                 > >
120                 ,co::less< less<item> >
121                 ,ci::opt::disposer< faked_disposer >
122             >::type
123         >    ord_list;
124
125         typedef ci::SplitListSet< rcu_type, ord_list,
126             ci::split_list::make_traits<
127                 co::hash< hash_int >
128                 ,co::memory_model<co::v::relaxed_ordering>
129             >::type
130         > set;
131         static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
132
133         test_rcu_int<set>();
134     }
135
136     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_cmpmix()
137     {
138         typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
139         typedef ci::MichaelList< rcu_type
140             ,item
141             ,ci::michael_list::make_traits<
142                 ci::opt::hook< ci::michael_list::member_hook<
143                     offsetof( item, hMember ),
144                     co::gc<rcu_type>
145                 > >
146                 ,co::compare< cmp<item> >
147                 ,co::less< less<item> >
148                 ,ci::opt::disposer< faked_disposer >
149             >::type
150         >    ord_list;
151
152         typedef ci::SplitListSet< rcu_type, ord_list,
153             ci::split_list::make_traits<
154                 co::hash< hash_int >
155                 ,co::item_counter< simple_item_counter >
156                 ,co::memory_model<co::v::sequential_consistent>
157             >::type
158         > set;
159         static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
160
161         test_rcu_int<set>();
162     }
163
164
165     // Static bucket table
166     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_cmp()
167     {
168         typedef base_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
169         typedef ci::MichaelList< rcu_type
170             ,item
171             ,ci::michael_list::make_traits<
172                 ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
173                 ,co::compare< cmp<item> >
174                 ,ci::opt::disposer< faked_disposer >
175             >::type
176         >    ord_list;
177
178         typedef ci::SplitListSet< rcu_type, ord_list,
179             ci::split_list::make_traits<
180                 co::hash< hash_int >
181                 ,ci::split_list::dynamic_bucket_table<false>
182                 ,co::memory_model<co::v::relaxed_ordering>
183             >::type
184         > set;
185         static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
186
187         test_rcu_int<set>();
188     }
189
190     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_less()
191     {
192         typedef base_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
193         typedef ci::MichaelList< rcu_type
194             ,item
195             ,ci::michael_list::make_traits<
196                 ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
197                 ,co::less< less<item> >
198                 ,ci::opt::disposer< faked_disposer >
199             >::type
200         >    ord_list;
201
202         typedef ci::SplitListSet< rcu_type, ord_list,
203             ci::split_list::make_traits<
204                 co::hash< hash_int >
205                 ,ci::split_list::dynamic_bucket_table<false>
206                 ,co::memory_model<co::v::sequential_consistent>
207             >::type
208         > set;
209         static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
210
211         test_rcu_int<set>();
212     }
213
214     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_cmpmix()
215     {
216         typedef base_int_item< ci::split_list::node<ci::michael_list::node<rcu_type> > > item;
217         typedef ci::MichaelList< rcu_type
218             ,item
219             ,ci::michael_list::make_traits<
220                 ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
221                 ,co::less< less<item> >
222                 ,co::compare< cmp<item> >
223                 ,ci::opt::disposer< faked_disposer >
224             >::type
225         >    ord_list;
226
227         typedef ci::SplitListSet< rcu_type, ord_list,
228             ci::split_list::make_traits<
229                 co::hash< hash_int >
230                 ,co::item_counter< simple_item_counter >
231                 ,ci::split_list::dynamic_bucket_table<false>
232             >::type
233         > set;
234         static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
235
236         test_rcu_int<set>();
237     }
238
239     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_cmp()
240     {
241         typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
242         typedef ci::MichaelList< rcu_type
243             ,item
244             ,ci::michael_list::make_traits<
245                 ci::opt::hook< ci::michael_list::member_hook<
246                     offsetof( item, hMember ),
247                     co::gc<rcu_type>
248                 > >
249                 ,co::compare< cmp<item> >
250                 ,ci::opt::disposer< faked_disposer >
251             >::type
252         >    ord_list;
253
254         typedef ci::SplitListSet< rcu_type, ord_list,
255             ci::split_list::make_traits<
256                 co::hash< hash_int >
257                 ,ci::split_list::dynamic_bucket_table<false>
258                 ,co::memory_model<co::v::relaxed_ordering>
259             >::type
260         > set;
261         static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
262
263         test_rcu_int<set>();
264     }
265
266     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_less()
267     {
268         typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
269         typedef ci::MichaelList< rcu_type
270             ,item
271             ,ci::michael_list::make_traits<
272                 ci::opt::hook< ci::michael_list::member_hook<
273                     offsetof( item, hMember ),
274                     co::gc<rcu_type>
275                 > >
276                 ,co::less< less<item> >
277                 ,ci::opt::disposer< faked_disposer >
278             >::type
279         >    ord_list;
280
281         typedef ci::SplitListSet< rcu_type, ord_list,
282             ci::split_list::make_traits<
283                 ci::split_list::dynamic_bucket_table<false>
284                 ,co::hash< hash_int >
285                 ,co::memory_model<co::v::sequential_consistent>
286             >::type
287         > set;
288         static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
289
290         test_rcu_int<set>();
291     }
292
293     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_cmpmix()
294     {
295         typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
296         typedef ci::MichaelList< rcu_type
297             ,item
298             ,ci::michael_list::make_traits<
299                 ci::opt::hook< ci::michael_list::member_hook<
300                     offsetof( item, hMember ),
301                     co::gc<rcu_type>
302                 > >
303                 ,co::compare< cmp<item> >
304                 ,co::less< less<item> >
305                 ,ci::opt::disposer< faked_disposer >
306             >::type
307         >    ord_list;
308
309         typedef ci::SplitListSet< rcu_type, ord_list,
310             ci::split_list::make_traits<
311                 co::hash< hash_int >
312                 ,co::item_counter< simple_item_counter >
313                 ,ci::split_list::dynamic_bucket_table<false>
314             >::type
315         > set;
316         static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
317
318         test_rcu_int<set>();
319     }
320
321
322 } // namespace set