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