Move libcds 1.6.0 from SVN
[libcds.git] / tests / test-hdr / ordered_list / hdr_lazy_kv_rcu_shb.cpp
1 //$$CDS-header$$
2
3 #include "ordered_list/hdr_lazy_kv.h"
4 #include <cds/urcu/signal_buffered.h>
5 #include <cds/container/lazy_kvlist_rcu.h>
6
7 namespace ordlist {
8 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
9     namespace {
10         typedef cds::urcu::gc< cds::urcu::signal_buffered<> > rcu_type;
11
12         struct RCU_SHB_cmp_traits: public cc::lazy_list::type_traits
13         {
14             typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type>   compare;
15         };
16     }
17 #endif
18
19     void LazyKVListTestHeader::RCU_SHB_cmp()
20     {
21 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
22         // traits-based version
23         typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHB_cmp_traits > list;
24         test_rcu< list >();
25
26         // option-based version
27
28         typedef cc::LazyKVList< rcu_type, key_type, value_type,
29             cc::lazy_list::make_traits<
30                 cc::opt::compare< cmp<key_type> >
31             >::type
32         > opt_list;
33         test_rcu< opt_list >();
34 #endif
35     }
36
37 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
38     namespace {
39         struct RCU_SHB_less_traits: public cc::lazy_list::type_traits
40         {
41             typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type>   less;
42         };
43     }
44 #endif
45
46     void LazyKVListTestHeader::RCU_SHB_less()
47     {
48 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
49         // traits-based version
50         typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHB_less_traits > list;
51         test_rcu< list >();
52
53         // option-based version
54
55         typedef cc::LazyKVList< rcu_type, key_type, value_type,
56             cc::lazy_list::make_traits<
57                 cc::opt::less< lt<key_type> >
58             >::type
59         > opt_list;
60         test_rcu< opt_list >();
61 #endif
62     }
63
64 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
65     namespace {
66         struct RCU_SHB_cmpmix_traits: public cc::lazy_list::type_traits
67         {
68             typedef LazyKVListTestHeader::cmp<LazyKVListTestHeader::key_type>   compare;
69             typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type>  less;
70         };
71     }
72 #endif
73
74     void LazyKVListTestHeader::RCU_SHB_cmpmix()
75     {
76 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
77         // traits-based version
78         typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHB_cmpmix_traits > list;
79         test_rcu< list >();
80
81         // option-based version
82
83         typedef cc::LazyKVList< rcu_type, key_type, value_type,
84             cc::lazy_list::make_traits<
85                 cc::opt::compare< cmp<key_type> >
86                 ,cc::opt::less< lt<key_type> >
87             >::type
88         > opt_list;
89         test_rcu< opt_list >();
90 #endif
91     }
92
93 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
94     namespace {
95         struct RCU_SHB_ic_traits: public cc::lazy_list::type_traits
96         {
97             typedef LazyKVListTestHeader::lt<LazyKVListTestHeader::key_type>   less;
98             typedef cds::atomicity::item_counter item_counter;
99         };
100     }
101 #endif
102
103     void LazyKVListTestHeader::RCU_SHB_ic()
104     {
105 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
106         // traits-based version
107         typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHB_ic_traits > list;
108         test_rcu< list >();
109
110         // option-based version
111
112         typedef cc::LazyKVList< rcu_type, key_type, value_type,
113             cc::lazy_list::make_traits<
114                 cc::opt::less< lt<key_type> >
115                 ,cc::opt::item_counter< cds::atomicity::item_counter >
116             >::type
117         > opt_list;
118         test_rcu< opt_list >();
119 #endif
120     }
121
122 }   // namespace ordlist