movable exempt_ptr: MichaelSet/Map
[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::traits::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::traits::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::traits::dynamic_bucket_table, "Set has static bucket table");
81
82         test_rcu_int<set>();
83     }
84
85     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_base_cmpmix_stat()
86     {
87         typedef base_int_item< ci::split_list::node<ci::michael_list::node<rcu_type> > > item;
88         struct list_traits : public ci::michael_list::traits
89         {
90             typedef ci::michael_list::base_hook< co::gc<rcu_type> > hook;
91             typedef IntrusiveHashSetHdrTest::less<item> less;
92             typedef cmp<item> compare;
93             typedef faked_disposer disposer;
94         };
95         typedef ci::MichaelList< rcu_type, item, list_traits > ord_list;
96
97         struct set_traits : public ci::split_list::make_traits<ci::split_list::dynamic_bucket_table<true> >::type
98         {
99             typedef hash_int hash;
100             typedef simple_item_counter item_counter;
101             typedef ci::split_list::stat<> stat;
102         };
103         typedef ci::SplitListSet< rcu_type, ord_list, set_traits > set;
104
105         static_assert(set::traits::dynamic_bucket_table, "Set has static bucket table");
106
107         test_rcu_int<set>();
108     }
109
110     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_cmp()
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::compare< cmp<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             > ::type
129         > set;
130         static_assert(set::traits::dynamic_bucket_table, "Set has static bucket table");
131
132         test_rcu_int<set>();
133     }
134
135     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_less()
136     {
137         typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
138         typedef ci::MichaelList < rcu_type
139             , item
140             , ci::michael_list::make_traits <
141             ci::opt::hook< ci::michael_list::member_hook <
142             offsetof( item, hMember ),
143             co::gc<rcu_type>
144             > >
145             , co::less< less<item> >
146             , ci::opt::disposer < faked_disposer >
147             > ::type
148         > ord_list;
149
150         typedef ci::SplitListSet < rcu_type, ord_list,
151             ci::split_list::make_traits <
152             co::hash< hash_int >
153             , co::memory_model < co::v::relaxed_ordering >
154             > ::type
155         > set;
156         static_assert(set::traits::dynamic_bucket_table, "Set has static bucket table");
157
158         test_rcu_int<set>();
159     }
160
161     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_cmpmix()
162     {
163         typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
164         typedef ci::MichaelList < rcu_type
165             , item
166             , ci::michael_list::make_traits <
167             ci::opt::hook< ci::michael_list::member_hook <
168             offsetof( item, hMember ),
169             co::gc<rcu_type>
170             > >
171             , co::compare< cmp<item> >
172             , co::less< less<item> >
173             , ci::opt::disposer < faked_disposer >
174             > ::type
175         > ord_list;
176
177         typedef ci::SplitListSet < rcu_type, ord_list,
178             ci::split_list::make_traits <
179             co::hash< hash_int >
180             , co::item_counter< simple_item_counter >
181             , co::memory_model < co::v::sequential_consistent >
182             > ::type
183         > set;
184         static_assert(set::traits::dynamic_bucket_table, "Set has static bucket table");
185
186         test_rcu_int<set>();
187     }
188
189     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_cmpmix_stat()
190     {
191         typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
192         struct list_traits :
193             public ci::michael_list::make_traits <
194             ci::opt::hook< ci::michael_list::member_hook <
195             offsetof( item, hMember ),
196             co::gc<rcu_type>
197             > >
198             , co::compare< cmp<item> >
199             , co::less< less<item> >
200             , ci::opt::disposer < faked_disposer >
201             > ::type
202         {};
203         typedef ci::MichaelList< rcu_type, item, list_traits > ord_list;
204
205         struct set_traits :
206             public ci::split_list::make_traits <
207             co::hash< hash_int >
208             , co::item_counter< simple_item_counter >
209             , co::memory_model<co::v::sequential_consistent>
210             , co::stat < ci::split_list::stat<> >
211             > ::type
212         {};
213         typedef ci::SplitListSet< rcu_type, ord_list, set_traits > set;
214         static_assert(set::traits::dynamic_bucket_table, "Set has static bucket table");
215
216         test_rcu_int<set>();
217     }
218
219     // Static bucket table
220     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_cmp()
221     {
222         typedef base_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
223         typedef ci::MichaelList < rcu_type
224             , item
225             , ci::michael_list::make_traits <
226             ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
227             , co::compare< cmp<item> >
228             , ci::opt::disposer < faked_disposer >
229             > ::type
230         > ord_list;
231
232         typedef ci::SplitListSet < rcu_type, ord_list,
233             ci::split_list::make_traits <
234             co::hash< hash_int >
235             , ci::split_list::dynamic_bucket_table<false>
236             , co::memory_model < co::v::relaxed_ordering >
237             > ::type
238         > set;
239         static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
240
241         test_rcu_int<set>();
242     }
243
244     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_less()
245     {
246         typedef base_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
247         typedef ci::MichaelList < rcu_type
248             , item
249             , ci::michael_list::make_traits <
250             ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
251             , co::less< less<item> >
252             , ci::opt::disposer < faked_disposer >
253             > ::type
254         > ord_list;
255
256         typedef ci::SplitListSet < rcu_type, ord_list,
257             ci::split_list::make_traits <
258             co::hash< hash_int >
259             , ci::split_list::dynamic_bucket_table<false>
260             , co::memory_model < co::v::sequential_consistent >
261             > ::type
262         > set;
263         static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
264
265         test_rcu_int<set>();
266     }
267
268     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_cmpmix()
269     {
270         typedef base_int_item< ci::split_list::node<ci::michael_list::node<rcu_type> > > item;
271         typedef ci::MichaelList < rcu_type
272             , item
273             , ci::michael_list::make_traits <
274             ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
275             , co::less< less<item> >
276             , co::compare< cmp<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             co::hash< hash_int >
284             , co::item_counter< simple_item_counter >
285             , ci::split_list::dynamic_bucket_table < false >
286             > ::type
287         > set;
288         static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
289
290         test_rcu_int<set>();
291     }
292
293     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_cmpmix_stat()
294     {
295         typedef base_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::base_hook< co::gc<rcu_type> > >
300             , co::less< less<item> >
301             , co::compare< cmp<item> >
302             , ci::opt::disposer < faked_disposer >
303             > ::type
304         > ord_list;
305
306         typedef ci::SplitListSet < rcu_type, ord_list,
307             ci::split_list::make_traits <
308             co::hash< hash_int >
309             , co::item_counter< simple_item_counter >
310             , ci::split_list::dynamic_bucket_table<false>
311             , co::stat < ci::split_list::stat<> >
312             > ::type
313         > set;
314         static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
315
316         test_rcu_int<set>();
317     }
318
319     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_cmp()
320     {
321         typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
322         typedef ci::MichaelList < rcu_type
323             , item
324             , ci::michael_list::make_traits <
325             ci::opt::hook< ci::michael_list::member_hook <
326             offsetof( item, hMember ),
327             co::gc<rcu_type>
328             > >
329             , co::compare< cmp<item> >
330             , ci::opt::disposer < faked_disposer >
331             > ::type
332         > ord_list;
333
334         typedef ci::SplitListSet < rcu_type, ord_list,
335             ci::split_list::make_traits <
336             co::hash< hash_int >
337             , ci::split_list::dynamic_bucket_table<false>
338             , co::memory_model < co::v::relaxed_ordering >
339             > ::type
340         > set;
341         static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
342
343         test_rcu_int<set>();
344     }
345
346     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_less()
347     {
348         typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
349         typedef ci::MichaelList < rcu_type
350             , item
351             , ci::michael_list::make_traits <
352             ci::opt::hook< ci::michael_list::member_hook <
353             offsetof( item, hMember ),
354             co::gc<rcu_type>
355             > >
356             , co::less< less<item> >
357             , ci::opt::disposer < faked_disposer >
358             > ::type
359         > ord_list;
360
361         typedef ci::SplitListSet < rcu_type, ord_list,
362             ci::split_list::make_traits <
363             ci::split_list::dynamic_bucket_table<false>
364             , co::hash< hash_int >
365             , co::memory_model < co::v::sequential_consistent >
366             > ::type
367         > set;
368         static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
369
370         test_rcu_int<set>();
371     }
372
373     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_cmpmix()
374     {
375         typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
376         typedef ci::MichaelList < rcu_type
377             , item
378             , ci::michael_list::make_traits <
379             ci::opt::hook< ci::michael_list::member_hook <
380             offsetof( item, hMember ),
381             co::gc<rcu_type>
382             > >
383             , co::compare< cmp<item> >
384             , co::less< less<item> >
385             , ci::opt::disposer < faked_disposer >
386             > ::type
387         > ord_list;
388
389         typedef ci::SplitListSet < rcu_type, ord_list,
390             ci::split_list::make_traits <
391             co::hash< hash_int >
392             , co::item_counter< simple_item_counter >
393             , ci::split_list::dynamic_bucket_table < false >
394             > ::type
395         > set;
396         static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
397
398         test_rcu_int<set>();
399     }
400
401     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_cmpmix_stat()
402     {
403         typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
404         typedef ci::MichaelList < rcu_type
405             , item
406             , ci::michael_list::make_traits <
407             ci::opt::hook< ci::michael_list::member_hook <
408             offsetof( item, hMember ),
409             co::gc<rcu_type>
410             > >
411             , co::compare< cmp<item> >
412             , co::less< less<item> >
413             , ci::opt::disposer < faked_disposer >
414             > ::type
415         > ord_list;
416
417         typedef ci::SplitListSet < rcu_type, ord_list,
418             ci::split_list::make_traits <
419             co::hash< hash_int >
420             , co::item_counter< simple_item_counter >
421             , ci::split_list::dynamic_bucket_table<false>
422             , co::stat < ci::split_list::stat<> >
423             > ::type
424         > set;
425         static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
426
427         test_rcu_int<set>();
428     }
429 } // namespace set