Move libcds 1.6.0 from SVN
[libcds.git] / tests / test-hdr / tree / hdr_ellenbintree_map_rcu_shb.cpp
1 //$$CDS-header$$
2
3 #include "tree/hdr_ellenbintree_map.h"
4 #include <cds/urcu/signal_buffered.h>
5 #include <cds/container/ellen_bintree_map_rcu.h>
6
7 #include "tree/hdr_intrusive_ellen_bintree_pool_rcu.h"
8 #include "unit/print_ellenbintree_stat.h"
9
10 namespace tree {
11 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
12     namespace cc = cds::container;
13     namespace co = cds::opt;
14     namespace {
15         typedef cds::urcu::gc< cds::urcu::signal_buffered<> > rcu_type;
16
17         typedef cc::ellen_bintree::map_node<rcu_type, EllenBinTreeMapHdrTest::key_type, EllenBinTreeMapHdrTest::value_type> tree_leaf_node;
18         typedef cc::ellen_bintree::internal_node< EllenBinTreeMapHdrTest::key_type, tree_leaf_node >                        tree_internal_node;
19         typedef cc::ellen_bintree::update_desc<tree_leaf_node, tree_internal_node>                                          tree_update_desc;
20
21         struct print_stat {
22             template <typename Tree>
23             void operator()( Tree const& t)
24             {
25                 std::cout << t.statistics();
26             }
27         };
28     }
29 #endif
30
31     void EllenBinTreeMapHdrTest::EllenBinTree_rcu_shb_less()
32     {
33 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
34         typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
35             cc::ellen_bintree::make_map_traits<
36                 co::less< less >
37             >::type
38         > set_type;
39
40         test_rcu<set_type, print_stat>();
41 #endif
42     }
43
44     void EllenBinTreeMapHdrTest::EllenBinTree_rcu_shb_cmp()
45     {
46 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
47         typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
48             cc::ellen_bintree::make_map_traits<
49                 co::compare< compare >
50             >::type
51         > set_type;
52
53         test_rcu<set_type, print_stat>();
54 #endif
55     }
56
57     void EllenBinTreeMapHdrTest::EllenBinTree_rcu_shb_cmpless()
58     {
59 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
60         typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
61             cc::ellen_bintree::make_map_traits<
62                 co::compare< compare >
63                 ,co::less< less >
64             >::type
65         > set_type;
66
67         test_rcu<set_type, print_stat>();
68 #endif
69     }
70
71     void EllenBinTreeMapHdrTest::EllenBinTree_rcu_shb_less_ic()
72     {
73 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
74         typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
75             cc::ellen_bintree::make_map_traits<
76                 co::less< less >
77                 ,co::item_counter< cds::atomicity::item_counter >
78             >::type
79         > set_type;
80
81         test_rcu<set_type, print_stat>();
82 #endif
83     }
84
85     void EllenBinTreeMapHdrTest::EllenBinTree_rcu_shb_cmp_ic()
86     {
87 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
88         typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
89             cc::ellen_bintree::make_map_traits<
90                 co::item_counter< cds::atomicity::item_counter >
91                 ,co::compare< compare >
92             >::type
93         > set_type;
94
95         test_rcu<set_type, print_stat>();
96 #endif
97     }
98
99     void EllenBinTreeMapHdrTest::EllenBinTree_rcu_shb_less_stat()
100     {
101 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
102         typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
103             cc::ellen_bintree::make_map_traits<
104                 co::less< less >
105                 ,co::stat< cc::ellen_bintree::stat<> >
106             >::type
107         > set_type;
108
109         test_rcu<set_type, print_stat>();
110 #endif
111     }
112
113     void EllenBinTreeMapHdrTest::EllenBinTree_rcu_shb_cmp_ic_stat()
114     {
115 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
116         typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
117             cc::ellen_bintree::make_map_traits<
118                 co::item_counter< cds::atomicity::item_counter >
119                 ,co::stat< cc::ellen_bintree::stat<> >
120                 ,co::compare< compare >
121             >::type
122         > set_type;
123
124         test_rcu<set_type, print_stat>();
125 #endif
126     }
127
128     void EllenBinTreeMapHdrTest::EllenBinTree_rcu_shb_less_pool()
129     {
130 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
131         typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
132             cc::ellen_bintree::make_map_traits<
133                 co::less< less >
134                 ,co::node_allocator< cds::memory::pool_allocator< tree_internal_node, ellen_bintree_rcu::internal_node_pool_accessor > >
135                 ,cc::ellen_bintree::update_desc_allocator< cds::memory::pool_allocator< tree_update_desc, ellen_bintree_rcu::update_desc_pool_accessor > >
136             >::type
137         > set_type;
138
139         test_rcu<set_type, print_stat>();
140 #endif
141     }
142
143     void EllenBinTreeMapHdrTest::EllenBinTree_rcu_shb_less_pool_ic_stat()
144     {
145 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
146         typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
147             cc::ellen_bintree::make_map_traits<
148                 co::less< less >
149                 ,co::node_allocator< cds::memory::pool_allocator< tree_internal_node, ellen_bintree_rcu::internal_node_pool_accessor > >
150                 ,cc::ellen_bintree::update_desc_allocator< cds::memory::pool_allocator< tree_update_desc, ellen_bintree_rcu::update_desc_pool_accessor > >
151                 ,co::item_counter< cds::atomicity::item_counter >
152                 ,co::stat< cc::ellen_bintree::stat<> >
153             >::type
154         > set_type;
155
156         test_rcu<set_type, print_stat>();
157 #endif
158     }
159
160 } // namespace tree