d3641a246d157e8c832ae0d9e0d8a51b6b986186
[libcds.git] / tests / test-hdr / set / hdr_intrusive_splitlist_set_rcu_gpi_lazy.cpp
1 //$$CDS-header$$
2
3 #include "set/hdr_intrusive_set.h"
4 #include <cds/urcu/general_instant.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_instant<> > rcu_type;
11     }
12
13     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPI_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::options::dynamic_bucket_table, "Set has static bucket table" );
33
34         test_rcu_int<set>();
35     }
36
37     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPI_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::options::dynamic_bucket_table, "Set has static bucket table" );
56
57         test_rcu_int<set>();
58     }
59
60     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPI_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::options::dynamic_bucket_table, "Set has static bucket table" );
81
82         test_rcu_int<set>();
83     }
84
85     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPI_member_cmp_lazy()
86     {
87         typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
88         typedef ci::LazyList< rcu_type
89             ,item
90             ,ci::lazy_list::make_traits<
91                 ci::opt::hook< ci::lazy_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                 ,co::memory_model<co::v::relaxed_ordering>
104             >::type
105         > set;
106         static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
107
108         test_rcu_int<set>();
109     }
110
111     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPI_member_less_lazy()
112     {
113         typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
114         typedef ci::LazyList< rcu_type
115             ,item
116             ,ci::lazy_list::make_traits<
117                 ci::opt::hook< ci::lazy_list::member_hook<
118                     offsetof( item, hMember ),
119                     co::gc<rcu_type>
120                 > >
121                 ,co::less< less<item> >
122                 ,ci::opt::disposer< faked_disposer >
123             >::type
124         >    ord_list;
125
126         typedef ci::SplitListSet< rcu_type, ord_list,
127             ci::split_list::make_traits<
128                 co::hash< hash_int >
129                 ,co::memory_model<co::v::sequential_consistent>
130             >::type
131         > set;
132         static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
133
134         test_rcu_int<set>();
135     }
136
137     void IntrusiveHashSetHdrTest::split_dyn_RCU_GPI_member_cmpmix_lazy()
138     {
139         typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
140         typedef ci::LazyList< rcu_type
141             ,item
142             ,ci::lazy_list::make_traits<
143                 ci::opt::hook< ci::lazy_list::member_hook<
144                     offsetof( item, hMember ),
145                     co::gc<rcu_type>
146                 > >
147                 ,co::compare< cmp<item> >
148                 ,co::less< less<item> >
149                 ,ci::opt::disposer< faked_disposer >
150             >::type
151         >    ord_list;
152
153         typedef ci::SplitListSet< rcu_type, ord_list,
154             ci::split_list::make_traits<
155                 co::hash< hash_int >
156                 ,co::item_counter< simple_item_counter >
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_GPI_base_cmp_lazy()
167     {
168         typedef base_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
169         typedef ci::LazyList< rcu_type
170             ,item
171             ,ci::lazy_list::make_traits<
172                 ci::opt::hook< ci::lazy_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_GPI_base_less_lazy()
191     {
192         typedef base_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
193         typedef ci::LazyList< rcu_type
194             ,item
195             ,ci::lazy_list::make_traits<
196                 ci::opt::hook< ci::lazy_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_GPI_base_cmpmix_lazy()
215     {
216         typedef base_int_item< ci::split_list::node<ci::lazy_list::node<rcu_type> > > item;
217         typedef ci::LazyList< rcu_type
218             ,item
219             ,ci::lazy_list::make_traits<
220                 ci::opt::hook< ci::lazy_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_GPI_member_cmp_lazy()
240     {
241         typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
242         typedef ci::LazyList< rcu_type
243             ,item
244             ,ci::lazy_list::make_traits<
245                 ci::opt::hook< ci::lazy_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_GPI_member_less_lazy()
267     {
268         typedef member_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::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_GPI_member_cmpmix_lazy()
294     {
295         typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
296         typedef ci::LazyList< rcu_type
297             ,item
298             ,ci::lazy_list::make_traits<
299                 ci::opt::hook< ci::lazy_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