Fixed: set_DelOdd and map_DelOdd tests for FeldmanHashSet/Map now use correct compare...
[libcds.git] / test / stress / set / set_type_lazy_list.h
1 /*
2     This file is a part of libcds - Concurrent Data Structures library
3
4     (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
5
6     Source code repo: http://github.com/khizmax/libcds/
7     Download: http://sourceforge.net/projects/libcds/files/
8
9     Redistribution and use in source and binary forms, with or without
10     modification, are permitted provided that the following conditions are met:
11
12     * Redistributions of source code must retain the above copyright notice, this
13       list of conditions and the following disclaimer.
14
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.
18
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.
29 */
30
31 #ifndef CDSUNIT_SET_TYPE_LAZY_LIST_H
32 #define CDSUNIT_SET_TYPE_LAZY_LIST_H
33
34 #include "set_type.h"
35
36 #include <cds/container/lazy_list_hp.h>
37 #include <cds/container/lazy_list_dhp.h>
38 #include <cds/container/lazy_list_rcu.h>
39
40 namespace set {
41
42     template <typename Key, typename Val>
43     struct lazy_list_type
44     {
45         typedef typename set_type_base< Key, Val >::key_val key_val;
46         typedef typename set_type_base< Key, Val >::compare compare;
47         typedef typename set_type_base< Key, Val >::less    less;
48
49         struct traits_LazyList_cmp_stdAlloc :
50             public cc::lazy_list::make_traits<
51                 co::compare< compare >
52             >::type
53         {};
54         typedef cc::LazyList< cds::gc::HP,  key_val, traits_LazyList_cmp_stdAlloc > LazyList_HP_cmp_stdAlloc;
55         typedef cc::LazyList< cds::gc::DHP, key_val, traits_LazyList_cmp_stdAlloc > LazyList_DHP_cmp_stdAlloc;
56         typedef cc::LazyList< rcu_gpi, key_val, traits_LazyList_cmp_stdAlloc > LazyList_RCU_GPI_cmp_stdAlloc;
57         typedef cc::LazyList< rcu_gpb, key_val, traits_LazyList_cmp_stdAlloc > LazyList_RCU_GPB_cmp_stdAlloc;
58         typedef cc::LazyList< rcu_gpt, key_val, traits_LazyList_cmp_stdAlloc > LazyList_RCU_GPT_cmp_stdAlloc;
59 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
60         typedef cc::LazyList< rcu_shb, key_val, traits_LazyList_cmp_stdAlloc > LazyList_RCU_SHB_cmp_stdAlloc;
61         typedef cc::LazyList< rcu_sht, key_val, traits_LazyList_cmp_stdAlloc > LazyList_RCU_SHT_cmp_stdAlloc;
62 #endif
63
64         struct traits_LazyList_cmp_stdAlloc_stat : public traits_LazyList_cmp_stdAlloc
65         {
66             typedef cc::lazy_list::stat<> stat;
67         };
68         typedef cc::LazyList< cds::gc::HP,  key_val, traits_LazyList_cmp_stdAlloc_stat > LazyList_HP_cmp_stdAlloc_stat;
69         typedef cc::LazyList< cds::gc::DHP, key_val, traits_LazyList_cmp_stdAlloc_stat > LazyList_DHP_cmp_stdAlloc_stat;
70         typedef cc::LazyList< rcu_gpi, key_val, traits_LazyList_cmp_stdAlloc_stat > LazyList_RCU_GPI_cmp_stdAlloc_stat;
71         typedef cc::LazyList< rcu_gpb, key_val, traits_LazyList_cmp_stdAlloc_stat > LazyList_RCU_GPB_cmp_stdAlloc_stat;
72         typedef cc::LazyList< rcu_gpt, key_val, traits_LazyList_cmp_stdAlloc_stat > LazyList_RCU_GPT_cmp_stdAlloc_stat;
73 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
74         typedef cc::LazyList< rcu_shb, key_val, traits_LazyList_cmp_stdAlloc_stat > LazyList_RCU_SHB_cmp_stdAlloc_stat;
75         typedef cc::LazyList< rcu_sht, key_val, traits_LazyList_cmp_stdAlloc_stat > LazyList_RCU_SHT_cmp_stdAlloc_stat;
76 #endif
77
78         struct traits_LazyList_cmp_stdAlloc_seqcst :
79             public cc::lazy_list::make_traits<
80                 co::compare< compare >
81                 ,co::memory_model< co::v::sequential_consistent >
82             >::type
83         {};
84         typedef cc::LazyList< cds::gc::HP, key_val,  traits_LazyList_cmp_stdAlloc_seqcst > LazyList_HP_cmp_stdAlloc_seqcst;
85         typedef cc::LazyList< cds::gc::DHP, key_val, traits_LazyList_cmp_stdAlloc_seqcst > LazyList_DHP_cmp_stdAlloc_seqcst;
86         typedef cc::LazyList< rcu_gpi, key_val, traits_LazyList_cmp_stdAlloc_seqcst > LazyList_RCU_GPI_cmp_stdAlloc_seqcst;
87         typedef cc::LazyList< rcu_gpb, key_val, traits_LazyList_cmp_stdAlloc_seqcst > LazyList_RCU_GPB_cmp_stdAlloc_seqcst;
88         typedef cc::LazyList< rcu_gpt, key_val, traits_LazyList_cmp_stdAlloc_seqcst > LazyList_RCU_GPT_cmp_stdAlloc_seqcst;
89 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
90         typedef cc::LazyList< rcu_shb, key_val, traits_LazyList_cmp_stdAlloc_seqcst > LazyList_RCU_SHB_cmp_stdAlloc_seqcst;
91         typedef cc::LazyList< rcu_sht, key_val, traits_LazyList_cmp_stdAlloc_seqcst > LazyList_RCU_SHT_cmp_stdAlloc_seqcst;
92 #endif
93         struct traits_LazyList_cmp_michaelAlloc :
94             public cc::lazy_list::make_traits<
95                 co::compare< compare >,
96                 co::allocator< memory::MichaelAllocator<int> >
97             >::type
98         {};
99         typedef cc::LazyList< cds::gc::HP,  key_val, traits_LazyList_cmp_michaelAlloc > LazyList_HP_cmp_michaelAlloc;
100         typedef cc::LazyList< cds::gc::DHP, key_val, traits_LazyList_cmp_michaelAlloc > LazyList_DHP_cmp_michaelAlloc;
101         typedef cc::LazyList< rcu_gpi, key_val, traits_LazyList_cmp_michaelAlloc > LazyList_RCU_GPI_cmp_michaelAlloc;
102         typedef cc::LazyList< rcu_gpb, key_val, traits_LazyList_cmp_michaelAlloc > LazyList_RCU_GPB_cmp_michaelAlloc;
103         typedef cc::LazyList< rcu_gpt, key_val, traits_LazyList_cmp_michaelAlloc > LazyList_RCU_GPT_cmp_michaelAlloc;
104 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
105         typedef cc::LazyList< rcu_shb, key_val, traits_LazyList_cmp_michaelAlloc > LazyList_RCU_SHB_cmp_michaelAlloc;
106         typedef cc::LazyList< rcu_sht, key_val, traits_LazyList_cmp_michaelAlloc > LazyList_RCU_SHT_cmp_michaelAlloc;
107 #endif
108
109         struct traits_LazyList_less_stdAlloc:
110             public cc::lazy_list::make_traits<
111                 co::less< less >
112             >::type
113         {};
114         typedef cc::LazyList< cds::gc::HP,  key_val, traits_LazyList_less_stdAlloc > LazyList_HP_less_stdAlloc;
115         typedef cc::LazyList< cds::gc::DHP, key_val, traits_LazyList_less_stdAlloc > LazyList_DHP_less_stdAlloc;
116         typedef cc::LazyList< rcu_gpi, key_val, traits_LazyList_less_stdAlloc > LazyList_RCU_GPI_less_stdAlloc;
117         typedef cc::LazyList< rcu_gpb, key_val, traits_LazyList_less_stdAlloc > LazyList_RCU_GPB_less_stdAlloc;
118         typedef cc::LazyList< rcu_gpt, key_val, traits_LazyList_less_stdAlloc > LazyList_RCU_GPT_less_stdAlloc;
119 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
120         typedef cc::LazyList< rcu_shb, key_val, traits_LazyList_less_stdAlloc > LazyList_RCU_SHB_less_stdAlloc;
121         typedef cc::LazyList< rcu_sht, key_val, traits_LazyList_less_stdAlloc > LazyList_RCU_SHT_less_stdAlloc;
122 #endif
123
124         struct traits_LazyList_less_stdAlloc_stat: public traits_LazyList_less_stdAlloc
125         {
126             typedef cc::lazy_list::stat<> stat;
127         };
128         typedef cc::LazyList< cds::gc::HP, key_val, traits_LazyList_less_stdAlloc_stat > LazyList_HP_less_stdAlloc_stat;
129         typedef cc::LazyList< cds::gc::DHP, key_val, traits_LazyList_less_stdAlloc_stat > LazyList_DHP_less_stdAlloc_stat;
130         typedef cc::LazyList< rcu_gpi, key_val, traits_LazyList_less_stdAlloc_stat > LazyList_RCU_GPI_less_stdAlloc_stat;
131         typedef cc::LazyList< rcu_gpb, key_val, traits_LazyList_less_stdAlloc_stat > LazyList_RCU_GPB_less_stdAlloc_stat;
132         typedef cc::LazyList< rcu_gpt, key_val, traits_LazyList_less_stdAlloc_stat > LazyList_RCU_GPT_less_stdAlloc_stat;
133 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
134         typedef cc::LazyList< rcu_shb, key_val, traits_LazyList_less_stdAlloc_stat > LazyList_RCU_SHB_less_stdAlloc_stat;
135         typedef cc::LazyList< rcu_sht, key_val, traits_LazyList_less_stdAlloc_stat > LazyList_RCU_SHT_less_stdAlloc_stat;
136 #endif
137
138         struct traits_LazyList_less_stdAlloc_seqcst :
139             public cc::lazy_list::make_traits<
140                 co::less< less >
141                 ,co::memory_model< co::v::sequential_consistent >
142             >::type
143         {};
144         typedef cc::LazyList< cds::gc::HP, key_val,  traits_LazyList_less_stdAlloc_seqcst > LazyList_HP_less_stdAlloc_seqcst;
145         typedef cc::LazyList< cds::gc::DHP, key_val, traits_LazyList_less_stdAlloc_seqcst > LazyList_DHP_less_stdAlloc_seqcst;
146         typedef cc::LazyList< rcu_gpi, key_val, traits_LazyList_less_stdAlloc_seqcst > LazyList_RCU_GPI_less_stdAlloc_seqcst;
147         typedef cc::LazyList< rcu_gpb, key_val, traits_LazyList_less_stdAlloc_seqcst > LazyList_RCU_GPB_less_stdAlloc_seqcst;
148         typedef cc::LazyList< rcu_gpt, key_val, traits_LazyList_less_stdAlloc_seqcst > LazyList_RCU_GPT_less_stdAlloc_seqcst;
149 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
150         typedef cc::LazyList< rcu_shb, key_val, traits_LazyList_less_stdAlloc_seqcst > LazyList_RCU_SHB_less_stdAlloc_seqcst;
151         typedef cc::LazyList< rcu_sht, key_val, traits_LazyList_less_stdAlloc_seqcst > LazyList_RCU_SHT_less_stdAlloc_seqcst;
152 #endif
153
154         struct traits_LazyList_less_michaelAlloc :
155             public cc::lazy_list::make_traits<
156                 co::less< less >,
157                 co::allocator< memory::MichaelAllocator<int> >
158             >::type
159         {};
160         typedef cc::LazyList< cds::gc::HP,  key_val, traits_LazyList_less_michaelAlloc > LazyList_HP_less_michaelAlloc;
161         typedef cc::LazyList< cds::gc::DHP, key_val, traits_LazyList_less_michaelAlloc > LazyList_DHP_less_michaelAlloc;
162         typedef cc::LazyList< rcu_gpi, key_val, traits_LazyList_less_michaelAlloc > LazyList_RCU_GPI_less_michaelAlloc;
163         typedef cc::LazyList< rcu_gpb, key_val, traits_LazyList_less_michaelAlloc > LazyList_RCU_GPB_less_michaelAlloc;
164         typedef cc::LazyList< rcu_gpt, key_val, traits_LazyList_less_michaelAlloc > LazyList_RCU_GPT_less_michaelAlloc;
165 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
166         typedef cc::LazyList< rcu_shb, key_val, traits_LazyList_less_michaelAlloc > LazyList_RCU_SHB_less_michaelAlloc;
167         typedef cc::LazyList< rcu_sht, key_val, traits_LazyList_less_michaelAlloc > LazyList_RCU_SHT_less_michaelAlloc;
168 #endif
169     };
170
171 } // namespace set
172
173 #endif // #ifndef CDSUNIT_SET_TYPE_LAZY_LIST_H