2 This file is a part of libcds - Concurrent Data Structures library
4 (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
6 Source code repo: http://github.com/khizmax/libcds/
7 Download: http://sourceforge.net/projects/libcds/files/
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met:
12 * Redistributions of source code must retain the above copyright notice, this
13 list of conditions and the following disclaimer.
15 * Redistributions in binary form must reproduce the above copyright notice,
16 this list of conditions and the following disclaimer in the documentation
17 and/or other materials provided with the distribution.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "tree/hdr_ellenbintree_map.h"
32 #include <cds/container/ellen_bintree_map_dhp.h>
34 #include "tree/hdr_intrusive_ellen_bintree_pool_dhp.h"
35 #include "unit/print_ellenbintree_stat.h"
38 namespace cc = cds::container;
39 namespace co = cds::opt;
41 typedef cds::gc::DHP gc_type;
43 typedef cc::ellen_bintree::map_node<gc_type, EllenBinTreeMapHdrTest::key_type, EllenBinTreeMapHdrTest::value_type> tree_leaf_node;
44 typedef cc::ellen_bintree::internal_node< EllenBinTreeMapHdrTest::key_type, tree_leaf_node > tree_internal_node;
45 typedef cc::ellen_bintree::update_desc<tree_leaf_node, tree_internal_node> tree_update_desc;
48 template <typename Tree>
49 void operator()( Tree const& t)
51 std::cout << t.statistics();
57 void EllenBinTreeMapHdrTest::EllenBinTree_dhp_less()
59 struct map_traits : public cc::ellen_bintree::traits
61 typedef EllenBinTreeMapHdrTest::less less;
63 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type, map_traits > set_type;
65 test<set_type, print_stat>();
68 void EllenBinTreeMapHdrTest::EllenBinTree_dhp_cmp()
70 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type,
71 cc::ellen_bintree::make_map_traits<
72 co::compare< compare >
76 test<set_type, print_stat>();
79 void EllenBinTreeMapHdrTest::EllenBinTree_dhp_cmpless()
81 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type,
82 cc::ellen_bintree::make_map_traits<
83 co::compare< compare >
88 test<set_type, print_stat>();
91 void EllenBinTreeMapHdrTest::EllenBinTree_dhp_less_ic()
93 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type,
94 cc::ellen_bintree::make_map_traits<
96 ,co::item_counter< cds::atomicity::item_counter >
100 test<set_type, print_stat>();
103 void EllenBinTreeMapHdrTest::EllenBinTree_dhp_cmp_ic()
105 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type,
106 cc::ellen_bintree::make_map_traits<
107 co::item_counter< cds::atomicity::item_counter >
108 ,co::compare< compare >
112 test<set_type, print_stat>();
115 void EllenBinTreeMapHdrTest::EllenBinTree_dhp_less_stat()
117 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type,
118 cc::ellen_bintree::make_map_traits<
120 ,co::stat< cc::ellen_bintree::stat<> >
124 test<set_type, print_stat>();
127 void EllenBinTreeMapHdrTest::EllenBinTree_dhp_cmp_ic_stat()
129 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type,
130 cc::ellen_bintree::make_map_traits<
131 co::item_counter< cds::atomicity::item_counter >
132 ,co::stat< cc::ellen_bintree::stat<> >
133 ,co::compare< compare >
137 test<set_type, print_stat>();
140 void EllenBinTreeMapHdrTest::EllenBinTree_dhp_cmp_ic_stat_yield()
142 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type,
143 cc::ellen_bintree::make_map_traits<
144 co::item_counter< cds::atomicity::item_counter >
145 ,co::stat< cc::ellen_bintree::stat<> >
146 ,co::compare< compare >
147 , co::back_off< cds::backoff::yield >
151 test<set_type, print_stat>();
154 void EllenBinTreeMapHdrTest::EllenBinTree_dhp_less_pool()
156 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type,
157 cc::ellen_bintree::make_map_traits<
159 ,co::node_allocator< cds::memory::pool_allocator< tree_internal_node, ellen_bintree_dhp::internal_node_pool_accessor > >
160 ,cc::ellen_bintree::update_desc_allocator< cds::memory::pool_allocator< tree_update_desc, ellen_bintree_dhp::update_desc_pool_accessor > >
164 test<set_type, print_stat>();
167 void EllenBinTreeMapHdrTest::EllenBinTree_dhp_less_pool_ic_stat()
169 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type,
170 cc::ellen_bintree::make_map_traits<
172 ,co::node_allocator< cds::memory::pool_allocator< tree_internal_node, ellen_bintree_dhp::internal_node_pool_accessor > >
173 ,cc::ellen_bintree::update_desc_allocator< cds::memory::pool_allocator< tree_update_desc, ellen_bintree_dhp::update_desc_pool_accessor > >
174 ,co::item_counter< cds::atomicity::item_counter >
175 ,co::stat< cc::ellen_bintree::stat<> >
179 test<set_type, print_stat>();