Move libcds 1.6.0 from SVN
[libcds.git] / tests / test-hdr / set / hdr_michael_set_lazy_rcu_gpi.cpp
1 //$$CDS-header$$
2
3 #include "set/hdr_set.h"
4 #include <cds/urcu/general_instant.h>
5 #include <cds/container/lazy_list_rcu.h>
6 #include <cds/container/michael_set_rcu.h>
7
8 namespace set {
9
10     namespace {
11         typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_type;
12
13         struct set_traits: public cc::michael_set::type_traits
14         {
15             typedef HashSetHdrTest::hash_int            hash;
16             typedef HashSetHdrTest::simple_item_counter item_counter;
17         };
18
19         struct RCU_GPI_cmp_traits: public cc::lazy_list::type_traits
20         {
21             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
22         };
23
24         struct RCU_GPI_less_traits: public cc::lazy_list::type_traits
25         {
26             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
27         };
28
29         struct RCU_GPI_cmpmix_traits: public cc::lazy_list::type_traits
30         {
31             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
32             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
33         };
34     }
35
36     void HashSetHdrTest::Lazy_RCU_GPI_cmp()
37     {
38         typedef cc::LazyList< rcu_type, item, RCU_GPI_cmp_traits > list;
39
40         // traits-based version
41         typedef cc::MichaelHashSet< rcu_type, list, set_traits > set;
42         test_int_rcu< set >();
43
44         // option-based version
45         typedef cc::MichaelHashSet< rcu_type, list,
46             cc::michael_set::make_traits<
47                 cc::opt::hash< hash_int >
48                 ,cc::opt::item_counter< simple_item_counter >
49             >::type
50         > opt_set;
51         test_int_rcu< opt_set >();
52     }
53
54     void HashSetHdrTest::Lazy_RCU_GPI_less()
55     {
56         typedef cc::LazyList< rcu_type, item, RCU_GPI_less_traits > list;
57
58         // traits-based version
59         typedef cc::MichaelHashSet< rcu_type, list, set_traits > set;
60         test_int_rcu< set >();
61
62         // option-based version
63         typedef cc::MichaelHashSet< rcu_type, list,
64             cc::michael_set::make_traits<
65                 cc::opt::hash< hash_int >
66                 ,cc::opt::item_counter< simple_item_counter >
67             >::type
68         > opt_set;
69         test_int_rcu< opt_set >();
70     }
71
72     void HashSetHdrTest::Lazy_RCU_GPI_cmpmix()
73     {
74         typedef cc::LazyList< rcu_type, item, RCU_GPI_cmpmix_traits > list;
75
76         // traits-based version
77         typedef cc::MichaelHashSet< rcu_type, list, set_traits > set;
78         test_int_rcu< set >();
79
80         // option-based version
81         typedef cc::MichaelHashSet< rcu_type, list,
82             cc::michael_set::make_traits<
83                 cc::opt::hash< hash_int >
84                 ,cc::opt::item_counter< simple_item_counter >
85             >::type
86         > opt_set;
87         test_int_rcu< opt_set >();
88     }
89
90
91 } // namespace set