Excluded IterableList-based MichaelMap/Set from "erase by iterator" stress-test
[libcds.git] / test / stress / map / map_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-2017
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_MAP_TYPE_LAZY_LIST_H
32 #define CDSUNIT_MAP_TYPE_LAZY_LIST_H
33
34 #include "map_type.h"
35
36 #include <cds/container/lazy_kvlist_hp.h>
37 #include <cds/container/lazy_kvlist_dhp.h>
38 #include <cds/container/lazy_kvlist_rcu.h>
39 #include <cds/container/lazy_kvlist_nogc.h>
40
41 #include <cds_test/stat_lazy_list_out.h>
42
43 namespace map {
44
45     template <typename Key, typename Value>
46     struct lazy_list_type
47     {
48         typedef typename map_type_base<Key, Value>::key_compare compare;
49         typedef typename map_type_base<Key, Value>::key_less    less;
50         typedef typename map_type_base<Key, Value>::equal_to    equal_to;
51
52         struct traits_LazyList_cmp:
53             public cc::lazy_list::make_traits<
54                 co::compare< compare >
55             >::type
56         {};
57         typedef cc::LazyKVList< cds::gc::HP, Key, Value, traits_LazyList_cmp > LazyList_HP_cmp;
58         typedef cc::LazyKVList< cds::gc::DHP, Key, Value, traits_LazyList_cmp > LazyList_DHP_cmp;
59         typedef cc::LazyKVList< cds::gc::nogc, Key, Value, traits_LazyList_cmp > LazyList_NOGC_cmp;
60         typedef cc::LazyKVList< rcu_gpi, Key, Value, traits_LazyList_cmp > LazyList_RCU_GPI_cmp;
61         typedef cc::LazyKVList< rcu_gpb, Key, Value, traits_LazyList_cmp > LazyList_RCU_GPB_cmp;
62         typedef cc::LazyKVList< rcu_gpt, Key, Value, traits_LazyList_cmp > LazyList_RCU_GPT_cmp;
63 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
64         typedef cc::LazyKVList< rcu_shb, Key, Value, traits_LazyList_cmp > LazyList_RCU_SHB_cmp;
65         typedef cc::LazyKVList< rcu_sht, Key, Value, traits_LazyList_cmp > LazyList_RCU_SHT_cmp;
66 #endif
67
68         struct traits_LazyList_cmp_stat: public traits_LazyList_cmp
69         {
70             typedef cc::lazy_list::stat<> stat;
71         };
72         typedef cc::LazyKVList< cds::gc::HP, Key, Value, traits_LazyList_cmp_stat > LazyList_HP_cmp_stat;
73         typedef cc::LazyKVList< cds::gc::DHP, Key, Value, traits_LazyList_cmp_stat > LazyList_DHP_cmp_stat;
74         typedef cc::LazyKVList< cds::gc::nogc, Key, Value, traits_LazyList_cmp_stat > LazyList_NOGC_cmp_stat;
75         typedef cc::LazyKVList< rcu_gpi, Key, Value, traits_LazyList_cmp_stat > LazyList_RCU_GPI_cmp_stat;
76         typedef cc::LazyKVList< rcu_gpb, Key, Value, traits_LazyList_cmp_stat > LazyList_RCU_GPB_cmp_stat;
77         typedef cc::LazyKVList< rcu_gpt, Key, Value, traits_LazyList_cmp_stat > LazyList_RCU_GPT_cmp_stat;
78 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
79         typedef cc::LazyKVList< rcu_shb, Key, Value, traits_LazyList_cmp_stat > LazyList_RCU_SHB_cmp_stat;
80         typedef cc::LazyKVList< rcu_sht, Key, Value, traits_LazyList_cmp_stat > LazyList_RCU_SHT_cmp_stat;
81 #endif
82
83         struct traits_LazyList_unord :
84             public cc::lazy_list::make_traits<
85                 co::equal_to< equal_to >
86                 ,co::sort< false >
87             >::type
88         {};
89         typedef cc::LazyKVList< cds::gc::nogc, Key, Value, traits_LazyList_unord > LazyList_NOGC_unord;
90
91         struct traits_LazyList_cmp_seqcst :
92             public cc::lazy_list::make_traits<
93                 co::compare< compare >
94                 ,co::memory_model< co::v::sequential_consistent >
95             >::type
96         {};
97         typedef cc::LazyKVList< cds::gc::HP, Key, Value, traits_LazyList_cmp_seqcst > LazyList_HP_cmp_seqcst;
98         typedef cc::LazyKVList< cds::gc::DHP, Key, Value, traits_LazyList_cmp_seqcst > LazyList_DHP_cmp_seqcst;
99         typedef cc::LazyKVList< cds::gc::nogc, Key, Value, traits_LazyList_cmp_seqcst > LazyList_NOGC_cmp_seqcst;
100         typedef cc::LazyKVList< rcu_gpi, Key, Value, traits_LazyList_cmp_seqcst > LazyList_RCU_GPI_cmp_seqcst;
101         typedef cc::LazyKVList< rcu_gpb, Key, Value, traits_LazyList_cmp_seqcst > LazyList_RCU_GPB_cmp_seqcst;
102         typedef cc::LazyKVList< rcu_gpt, Key, Value, traits_LazyList_cmp_seqcst > LazyList_RCU_GPT_cmp_seqcst;
103 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
104         typedef cc::LazyKVList< rcu_shb, Key, Value, traits_LazyList_cmp_seqcst > LazyList_RCU_SHB_cmp_seqcst;
105         typedef cc::LazyKVList< rcu_sht, Key, Value, traits_LazyList_cmp_seqcst > LazyList_RCU_SHT_cmp_seqcst;
106 #endif
107
108         struct traits_LazyList_less :
109             public cc::lazy_list::make_traits<
110                 co::less< less >
111             >::type
112         {};
113         typedef cc::LazyKVList< cds::gc::HP, Key, Value, traits_LazyList_less > LazyList_HP_less;
114         typedef cc::LazyKVList< cds::gc::DHP, Key, Value, traits_LazyList_less > LazyList_DHP_less;
115         typedef cc::LazyKVList< cds::gc::nogc, Key, Value, traits_LazyList_less > LazyList_NOGC_less;
116         typedef cc::LazyKVList< rcu_gpi, Key, Value, traits_LazyList_less > LazyList_RCU_GPI_less;
117         typedef cc::LazyKVList< rcu_gpb, Key, Value, traits_LazyList_less > LazyList_RCU_GPB_less;
118         typedef cc::LazyKVList< rcu_gpt, Key, Value, traits_LazyList_less > LazyList_RCU_GPT_less;
119 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
120         typedef cc::LazyKVList< rcu_shb, Key, Value, traits_LazyList_less > LazyList_RCU_SHB_less;
121         typedef cc::LazyKVList< rcu_sht, Key, Value, traits_LazyList_less > LazyList_RCU_SHT_less;
122 #endif
123
124         struct traits_LazyList_less_stat: public traits_LazyList_less
125         {
126             typedef cc::lazy_list::stat<> stat;
127         };
128         typedef cc::LazyKVList< cds::gc::HP, Key, Value, traits_LazyList_less_stat > LazyList_HP_less_stat;
129         typedef cc::LazyKVList< cds::gc::DHP, Key, Value, traits_LazyList_less_stat > LazyList_DHP_less_stat;
130         typedef cc::LazyKVList< cds::gc::nogc, Key, Value, traits_LazyList_less_stat > LazyList_NOGC_less_stat;
131         typedef cc::LazyKVList< rcu_gpi, Key, Value, traits_LazyList_less_stat > LazyList_RCU_GPI_less_stat;
132         typedef cc::LazyKVList< rcu_gpb, Key, Value, traits_LazyList_less_stat > LazyList_RCU_GPB_less_stat;
133         typedef cc::LazyKVList< rcu_gpt, Key, Value, traits_LazyList_less_stat > LazyList_RCU_GPT_less_stat;
134 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
135         typedef cc::LazyKVList< rcu_shb, Key, Value, traits_LazyList_less_stat > LazyList_RCU_SHB_less_stat;
136         typedef cc::LazyKVList< rcu_sht, Key, Value, traits_LazyList_less_stat > LazyList_RCU_SHT_less_stat;
137 #endif
138
139         struct traits_LazyList_less_seqcst :
140             public cc::lazy_list::make_traits<
141                 co::less< less >
142                 ,co::memory_model< co::v::sequential_consistent >
143             >::type
144         {};
145         typedef cc::LazyKVList< cds::gc::HP, Key, Value, traits_LazyList_less_seqcst > LazyList_HP_less_seqcst;
146         typedef cc::LazyKVList< cds::gc::DHP, Key, Value, traits_LazyList_less_seqcst > LazyList_DHP_less_seqcst;
147         typedef cc::LazyKVList< cds::gc::nogc, Key, Value, traits_LazyList_less_seqcst > LazyList_NOGC_less_seqcst;
148         typedef cc::LazyKVList< rcu_gpi, Key, Value, traits_LazyList_less_seqcst > LazyList_RCU_GPI_less_seqcst;
149         typedef cc::LazyKVList< rcu_gpb, Key, Value, traits_LazyList_less_seqcst > LazyList_RCU_GPB_less_seqcst;
150         typedef cc::LazyKVList< rcu_gpt, Key, Value, traits_LazyList_less_seqcst > LazyList_RCU_GPT_less_seqcst;
151 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
152         typedef cc::LazyKVList< rcu_shb, Key, Value, traits_LazyList_less_seqcst > LazyList_RCU_SHB_less_seqcst;
153         typedef cc::LazyKVList< rcu_sht, Key, Value, traits_LazyList_less_seqcst > LazyList_RCU_SHT_less_seqcst;
154 #endif
155
156     };
157
158 } // namespace map
159
160 #endif // ifndef CDSUNIT_MAP_TYPE_LAZY_LIST_H