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 "set/hdr_set.h"
32 #include <cds/container/lazy_list_hp.h>
33 #include <cds/container/split_list_set.h>
38 struct HP_cmp_traits: public cc::split_list::traits
40 typedef cc::lazy_list_tag ordered_list;
41 typedef HashSetHdrTest::hash_int hash;
42 typedef HashSetHdrTest::simple_item_counter item_counter;
43 typedef cc::opt::v::relaxed_ordering memory_model;
44 enum { dynamic_bucket_table = false };
46 struct ordered_list_traits: public cc::lazy_list::traits
48 typedef HashSetHdrTest::cmp<HashSetHdrTest::item> compare;
52 struct HP_less_traits: public cc::split_list::traits
54 typedef cc::lazy_list_tag ordered_list;
55 typedef HashSetHdrTest::hash_int hash;
56 typedef HashSetHdrTest::simple_item_counter item_counter;
57 typedef cc::opt::v::sequential_consistent memory_model;
58 enum { dynamic_bucket_table = false };
60 struct ordered_list_traits: public cc::lazy_list::traits
62 typedef HashSetHdrTest::less<HashSetHdrTest::item> less;
66 struct HP_cmpmix_traits: public cc::split_list::traits
68 typedef cc::lazy_list_tag ordered_list;
69 typedef HashSetHdrTest::hash_int hash;
70 typedef HashSetHdrTest::simple_item_counter item_counter;
72 struct ordered_list_traits: public cc::lazy_list::traits
74 typedef HashSetHdrTest::cmp<HashSetHdrTest::item> compare;
75 typedef HashSetHdrTest::less<HashSetHdrTest::item> less;
79 struct HP_cmpmix_stat_traits : public HP_cmpmix_traits
81 typedef cc::split_list::stat<> stat;
85 void HashSetHdrTest::Split_Lazy_HP_cmp()
87 // traits-based version
88 typedef cc::SplitListSet< cds::gc::HP, item, HP_cmp_traits > set;
92 // option-based version
93 typedef cc::SplitListSet< cds::gc::HP, item,
94 cc::split_list::make_traits<
95 cc::split_list::ordered_list<cc::lazy_list_tag>
96 ,cc::opt::hash< hash_int >
97 ,cc::opt::item_counter< simple_item_counter >
98 ,cc::opt::memory_model< cc::opt::v::relaxed_ordering >
99 ,cc::split_list::dynamic_bucket_table< true >
100 ,cc::split_list::ordered_list_traits<
101 cc::lazy_list::make_traits<
102 cc::opt::compare< cmp<item> >
107 test_int< opt_set >();
110 void HashSetHdrTest::Split_Lazy_HP_less()
112 // traits-based version
113 typedef cc::SplitListSet< cds::gc::HP, item, HP_less_traits > set;
117 // option-based version
118 typedef cc::SplitListSet< cds::gc::HP, item,
119 cc::split_list::make_traits<
120 cc::split_list::ordered_list<cc::lazy_list_tag>
121 ,cc::opt::hash< hash_int >
122 ,cc::opt::item_counter< simple_item_counter >
123 ,cc::opt::memory_model< cc::opt::v::sequential_consistent >
124 ,cc::split_list::dynamic_bucket_table< false >
125 ,cc::split_list::ordered_list_traits<
126 cc::lazy_list::make_traits<
127 cc::opt::less< less<item> >
132 test_int< opt_set >();
135 void HashSetHdrTest::Split_Lazy_HP_cmpmix()
137 // traits-based version
138 typedef cc::SplitListSet< cds::gc::HP, item, HP_cmpmix_traits > set;
141 // option-based version
142 typedef cc::SplitListSet< cds::gc::HP, item,
143 cc::split_list::make_traits<
144 cc::split_list::ordered_list<cc::lazy_list_tag>
145 ,cc::opt::hash< hash_int >
146 ,cc::opt::item_counter< simple_item_counter >
147 ,cc::split_list::ordered_list_traits<
148 cc::lazy_list::make_traits<
149 cc::opt::less< less<item> >
150 ,cc::opt::compare< cmp<item> >
155 test_int< opt_set >();
158 void HashSetHdrTest::Split_Lazy_HP_cmpmix_stat()
160 // traits-based version
161 typedef cc::SplitListSet< cds::gc::HP, item, HP_cmpmix_stat_traits > set;
164 // option-based version
165 typedef cc::SplitListSet< cds::gc::HP, item,
166 cc::split_list::make_traits<
167 cc::split_list::ordered_list<cc::lazy_list_tag>
168 ,cc::opt::hash< hash_int >
169 ,cc::opt::item_counter< simple_item_counter >
170 ,cds::opt::stat< cc::split_list::stat<> >
171 ,cc::split_list::ordered_list_traits<
172 cc::lazy_list::make_traits<
173 cc::opt::less< less<item> >
174 ,cc::opt::compare< cmp<item> >
179 test_int< opt_set >();