intrusive::SplitListSet refactoring
[libcds.git] / tests / test-hdr / set / hdr_intrusive_splitlist_set_rcu_gpb_lazy.cpp
1 //$$CDS-header$$
2
3 #include "set/hdr_intrusive_set.h"
4 #include <cds/urcu/general_buffered.h>
5 #include <cds/intrusive/lazy_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_lazy()
14     {
15         typedef base_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
16         typedef ci::LazyList< rcu_type
17             ,item
18             ,ci::lazy_list::make_traits<
19                 ci::opt::hook< ci::lazy_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_lazy()
38     {
39         typedef base_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
40         typedef ci::LazyList< rcu_type
41             ,item
42             ,ci::lazy_list::make_traits<
43                 ci::opt::hook< ci::lazy_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_lazy()
61     {
62         typedef base_int_item< ci::split_list::node<ci::lazy_list::node<rcu_type> > > item;
63         typedef ci::LazyList< rcu_type
64             ,item
65             ,ci::lazy_list::make_traits<
66                 ci::opt::hook< ci::lazy_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_lazy()
86     {
87         typedef base_int_item< ci::split_list::node<ci::lazy_list::node<rcu_type> > > item;
88         struct list_traits : public ci::lazy_list::traits
89         {
90             typedef ci::lazy_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::LazyList< 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         static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
105
106         test_rcu_int<set>();
107     }
108
109     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_cmp_lazy()
110     {
111         typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
112         typedef ci::LazyList< rcu_type
113             ,item
114             ,ci::lazy_list::make_traits<
115                 ci::opt::hook< ci::lazy_list::member_hook<
116                     offsetof( item, hMember ),
117                     co::gc<rcu_type>
118                 > >
119                 ,co::compare< cmp<item> >
120                 ,ci::opt::disposer< faked_disposer >
121             >::type
122         >    ord_list;
123
124         typedef ci::SplitListSet< rcu_type, ord_list,
125             ci::split_list::make_traits<
126                 co::hash< hash_int >
127                 ,co::memory_model<co::v::relaxed_ordering>
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_lazy()
136     {
137         typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
138         typedef ci::LazyList< rcu_type
139             ,item
140             ,ci::lazy_list::make_traits<
141                 ci::opt::hook< ci::lazy_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::sequential_consistent>
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_lazy()
162     {
163         typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
164         typedef ci::LazyList< rcu_type
165             ,item
166             ,ci::lazy_list::make_traits<
167                 ci::opt::hook< ci::lazy_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             >::type
182         > set;
183         static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
184
185         test_rcu_int<set>();
186     }
187
188     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_cmpmix_stat_lazy()
189     {
190         typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
191         struct list_traits :
192             public ci::lazy_list::make_traits<
193                 ci::opt::hook< ci::lazy_list::member_hook<
194                     offsetof( item, hMember ),
195                     co::gc<rcu_type>
196                 > >
197                 ,co::compare< cmp<item> >
198                 ,co::less< less<item> >
199                 ,ci::opt::disposer< faked_disposer >
200             >::type
201         {};
202         typedef ci::LazyList< rcu_type, item, list_traits > ord_list;
203
204         struct set_traits :
205             public ci::split_list::make_traits<
206                 co::hash< hash_int >
207                 ,co::item_counter< simple_item_counter >
208                 ,co::stat< ci::split_list::stat<> >
209             >::type
210         {};
211         typedef ci::SplitListSet< rcu_type, ord_list, set_traits > set;
212         static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
213
214         test_rcu_int<set>();
215     }
216
217     // Static bucket table
218     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_cmp_lazy()
219     {
220         typedef base_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
221         typedef ci::LazyList< rcu_type
222             ,item
223             ,ci::lazy_list::make_traits<
224                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<rcu_type> > >
225                 ,co::compare< cmp<item> >
226                 ,ci::opt::disposer< faked_disposer >
227             >::type
228         >    ord_list;
229
230         typedef ci::SplitListSet< rcu_type, ord_list,
231             ci::split_list::make_traits<
232                 co::hash< hash_int >
233                 ,ci::split_list::dynamic_bucket_table<false>
234                 ,co::memory_model<co::v::relaxed_ordering>
235             >::type
236         > set;
237         static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
238
239         test_rcu_int<set>();
240     }
241
242     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_less_lazy()
243     {
244         typedef base_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
245         typedef ci::LazyList< rcu_type
246             ,item
247             ,ci::lazy_list::make_traits<
248                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<rcu_type> > >
249                 ,co::less< less<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::sequential_consistent>
259             >::type
260         > set;
261         static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
262
263         test_rcu_int<set>();
264     }
265
266     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_cmpmix_lazy()
267     {
268         typedef base_int_item< ci::split_list::node<ci::lazy_list::node<rcu_type> > > item;
269         typedef ci::LazyList< rcu_type
270             ,item
271             ,ci::lazy_list::make_traits<
272                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<rcu_type> > >
273                 ,co::less< less<item> >
274                 ,co::compare< cmp<item> >
275                 ,ci::opt::disposer< faked_disposer >
276             >::type
277         >    ord_list;
278
279         typedef ci::SplitListSet< rcu_type, ord_list,
280             ci::split_list::make_traits<
281                 co::hash< hash_int >
282                 ,co::item_counter< simple_item_counter >
283                 ,ci::split_list::dynamic_bucket_table<false>
284             >::type
285         > set;
286         static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
287
288         test_rcu_int<set>();
289     }
290
291     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_cmpmix_stat_lazy()
292     {
293         typedef base_int_item< ci::split_list::node<ci::lazy_list::node<rcu_type> > > item;
294         typedef ci::LazyList< rcu_type
295             ,item
296             ,ci::lazy_list::make_traits<
297                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<rcu_type> > >
298                 ,co::less< less<item> >
299                 ,co::compare< cmp<item> >
300                 ,ci::opt::disposer< faked_disposer >
301             >::type
302         >    ord_list;
303
304         typedef ci::SplitListSet< rcu_type, ord_list,
305             ci::split_list::make_traits<
306                 co::hash< hash_int >
307                 ,co::item_counter< simple_item_counter >
308                 ,ci::split_list::dynamic_bucket_table<false>
309                 ,co::stat< ci::split_list::stat<>>
310             >::type
311         > set;
312         static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
313
314         test_rcu_int<set>();
315     }
316
317     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_cmp_lazy()
318     {
319         typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
320         typedef ci::LazyList< rcu_type
321             ,item
322             ,ci::lazy_list::make_traits<
323                 ci::opt::hook< ci::lazy_list::member_hook<
324                     offsetof( item, hMember ),
325                     co::gc<rcu_type>
326                 > >
327                 ,co::compare< cmp<item> >
328                 ,ci::opt::disposer< faked_disposer >
329             >::type
330         >    ord_list;
331
332         typedef ci::SplitListSet< rcu_type, ord_list,
333             ci::split_list::make_traits<
334                 co::hash< hash_int >
335                 ,ci::split_list::dynamic_bucket_table<false>
336                 ,co::memory_model<co::v::relaxed_ordering>
337             >::type
338         > set;
339         static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
340
341         test_rcu_int<set>();
342     }
343
344     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_less_lazy()
345     {
346         typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
347         typedef ci::LazyList< rcu_type
348             ,item
349             ,ci::lazy_list::make_traits<
350                 ci::opt::hook< ci::lazy_list::member_hook<
351                     offsetof( item, hMember ),
352                     co::gc<rcu_type>
353                 > >
354                 ,co::less< less<item> >
355                 ,ci::opt::disposer< faked_disposer >
356             >::type
357         >    ord_list;
358
359         typedef ci::SplitListSet< rcu_type, ord_list,
360             ci::split_list::make_traits<
361                 ci::split_list::dynamic_bucket_table<false>
362                 ,co::hash< hash_int >
363                 ,co::memory_model<co::v::sequential_consistent>
364             >::type
365         > set;
366         static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
367
368         test_rcu_int<set>();
369     }
370
371     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_cmpmix_lazy()
372     {
373         typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
374         typedef ci::LazyList< rcu_type
375             ,item
376             ,ci::lazy_list::make_traits<
377                 ci::opt::hook< ci::lazy_list::member_hook<
378                     offsetof( item, hMember ),
379                     co::gc<rcu_type>
380                 > >
381                 ,co::compare< cmp<item> >
382                 ,co::less< less<item> >
383                 ,ci::opt::disposer< faked_disposer >
384             >::type
385         >    ord_list;
386
387         typedef ci::SplitListSet< rcu_type, ord_list,
388             ci::split_list::make_traits<
389                 co::hash< hash_int >
390                 ,co::item_counter< simple_item_counter >
391                 ,ci::split_list::dynamic_bucket_table<false>
392             >::type
393         > set;
394         static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
395
396         test_rcu_int<set>();
397     }
398
399     void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_cmpmix_stat_lazy()
400     {
401         typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
402         typedef ci::LazyList< rcu_type
403             ,item
404             ,ci::lazy_list::make_traits<
405                 ci::opt::hook< ci::lazy_list::member_hook<
406                     offsetof( item, hMember ),
407                     co::gc<rcu_type>
408                 > >
409                 ,co::compare< cmp<item> >
410                 ,co::less< less<item> >
411                 ,ci::opt::disposer< faked_disposer >
412             >::type
413         >    ord_list;
414
415         typedef ci::SplitListSet< rcu_type, ord_list,
416             ci::split_list::make_traits<
417                 co::hash< hash_int >
418                 ,co::item_counter< simple_item_counter >
419                 ,ci::split_list::dynamic_bucket_table<false>
420                 ,co::stat< ci::split_list::stat<>>
421             >::type
422         > set;
423         static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
424
425         test_rcu_int<set>();
426     }
427
428 } // namespace set