a35e5e644dcd8eac4b6d207348e6f11db2d3642a
[libcds.git] / test / stress / map / map_type_iterable_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_MAP_TYPE_ITERABLE_LIST_H
32 #define CDSUNIT_MAP_TYPE_ITERABLE_LIST_H
33
34 #include "map_type.h"
35
36 #include <cds/container/iterable_kvlist_hp.h>
37 #include <cds/container/iterable_kvlist_dhp.h>
38
39 namespace map {
40
41     template <typename Key, typename Value>
42     struct iterable_list_type
43     {
44         typedef typename map_type_base<Key, Value>::key_compare compare;
45         typedef typename map_type_base<Key, Value>::key_less    less;
46
47         struct traits_IterableList_cmp_stdAlloc :
48             public cc::iterable_list::make_traits<
49                 co::compare< compare >
50             >::type
51         {};
52         typedef cc::IterableKVList< cds::gc::HP,  Key, Value, traits_IterableList_cmp_stdAlloc > IterableList_HP_cmp_stdAlloc;
53         typedef cc::IterableKVList< cds::gc::DHP, Key, Value, traits_IterableList_cmp_stdAlloc > IterableList_DHP_cmp_stdAlloc;
54 //        typedef cc::IterableKVList< rcu_gpi, Key, Value, traits_IterableList_cmp_stdAlloc > IterableList_RCU_GPI_cmp_stdAlloc;
55 //        typedef cc::IterableKVList< rcu_gpb, Key, Value, traits_IterableList_cmp_stdAlloc > IterableList_RCU_GPB_cmp_stdAlloc;
56 //        typedef cc::IterableKVList< rcu_gpt, Key, Value, traits_IterableList_cmp_stdAlloc > IterableList_RCU_GPT_cmp_stdAlloc;
57 //#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
58 //        typedef cc::IterableKVList< rcu_shb, Key, Value, traits_IterableList_cmp_stdAlloc > IterableList_RCU_SHB_cmp_stdAlloc;
59 //        typedef cc::IterableKVList< rcu_sht, Key, Value, traits_IterableList_cmp_stdAlloc > IterableList_RCU_SHT_cmp_stdAlloc;
60 //#endif
61
62         struct traits_IterableList_cmp_stdAlloc_stat: public traits_IterableList_cmp_stdAlloc
63         {
64             typedef cc::iterable_list::stat<> stat;
65         };
66         typedef cc::IterableKVList< cds::gc::HP, Key, Value, traits_IterableList_cmp_stdAlloc_stat > IterableList_HP_cmp_stdAlloc_stat;
67         typedef cc::IterableKVList< cds::gc::DHP, Key, Value, traits_IterableList_cmp_stdAlloc_stat > IterableList_DHP_cmp_stdAlloc_stat;
68         //        typedef cc::IterableKVList< rcu_gpi, Key, Value, traits_IterableList_cmp_stdAlloc_stat > IterableList_RCU_GPI_cmp_stdAlloc_stat;
69         //        typedef cc::IterableKVList< rcu_gpb, Key, Value, traits_IterableList_cmp_stdAlloc_stat > IterableList_RCU_GPB_cmp_stdAlloc_stat;
70         //        typedef cc::IterableKVList< rcu_gpt, Key, Value, traits_IterableList_cmp_stdAlloc_stat > IterableList_RCU_GPT_cmp_stdAlloc_stat;
71         //#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
72         //        typedef cc::IterableKVList< rcu_shb, Key, Value, traits_IterableList_cmp_stdAlloc_stat > IterableList_RCU_SHB_cmp_stdAlloc_stat;
73         //        typedef cc::IterableKVList< rcu_sht, Key, Value, traits_IterableList_cmp_stdAlloc_stat > IterableList_RCU_SHT_cmp_stdAlloc_stat;
74         //#endif
75
76         struct traits_IterableList_cmp_stdAlloc_seqcst :
77             public cc::iterable_list::make_traits<
78                 co::compare< compare >
79                 ,co::memory_model< co::v::sequential_consistent >
80             >::type
81         {};
82         typedef cc::IterableKVList< cds::gc::HP,  Key, Value, traits_IterableList_cmp_stdAlloc_seqcst > IterableList_HP_cmp_stdAlloc_seqcst;
83         typedef cc::IterableKVList< cds::gc::DHP, Key, Value, traits_IterableList_cmp_stdAlloc_seqcst > IterableList_DHP_cmp_stdAlloc_seqcst;
84 //        typedef cc::IterableKVList< rcu_gpi, Key, Value, traits_IterableList_cmp_stdAlloc_seqcst > IterableList_RCU_GPI_cmp_stdAlloc_seqcst;
85 //        typedef cc::IterableKVList< rcu_gpb, Key, Value, traits_IterableList_cmp_stdAlloc_seqcst > IterableList_RCU_GPB_cmp_stdAlloc_seqcst;
86 //        typedef cc::IterableKVList< rcu_gpt, Key, Value, traits_IterableList_cmp_stdAlloc_seqcst > IterableList_RCU_GPT_cmp_stdAlloc_seqcst;
87 //#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
88 //        typedef cc::IterableKVList< rcu_shb, Key, Value, traits_IterableList_cmp_stdAlloc_seqcst > IterableList_RCU_SHB_cmp_stdAlloc_seqcst;
89 //        typedef cc::IterableKVList< rcu_sht, Key, Value, traits_IterableList_cmp_stdAlloc_seqcst > IterableList_RCU_SHT_cmp_stdAlloc_seqcst;
90 //#endif
91
92         struct traits_IterableList_cmp_michaelAlloc :
93             public cc::iterable_list::make_traits<
94                 co::compare< compare >,
95                 co::allocator< memory::MichaelAllocator<int> >
96             >::type
97         {};
98         typedef cc::IterableKVList< cds::gc::HP,  Key, Value, traits_IterableList_cmp_michaelAlloc > IterableList_HP_cmp_michaelAlloc;
99         typedef cc::IterableKVList< cds::gc::DHP, Key, Value, traits_IterableList_cmp_michaelAlloc > IterableList_DHP_cmp_michaelAlloc;
100 //        typedef cc::IterableKVList< rcu_gpi, Key, Value, traits_IterableList_cmp_michaelAlloc > IterableList_RCU_GPI_cmp_michaelAlloc;
101 //        typedef cc::IterableKVList< rcu_gpb, Key, Value, traits_IterableList_cmp_michaelAlloc > IterableList_RCU_GPB_cmp_michaelAlloc;
102 //        typedef cc::IterableKVList< rcu_gpt, Key, Value, traits_IterableList_cmp_michaelAlloc > IterableList_RCU_GPT_cmp_michaelAlloc;
103 //#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
104 //        typedef cc::IterableKVList< rcu_shb, Key, Value, traits_IterableList_cmp_michaelAlloc > IterableList_RCU_SHB_cmp_michaelAlloc;
105 //        typedef cc::IterableKVList< rcu_sht, Key, Value, traits_IterableList_cmp_michaelAlloc > IterableList_RCU_SHT_cmp_michaelAlloc;
106 //#endif
107
108         struct traits_IterableList_less_stdAlloc :
109             public cc::iterable_list::make_traits<
110                 co::less< less >
111             >::type
112         {};
113         typedef cc::IterableKVList< cds::gc::HP,  Key, Value, traits_IterableList_less_stdAlloc > IterableList_HP_less_stdAlloc;
114         typedef cc::IterableKVList< cds::gc::DHP, Key, Value, traits_IterableList_less_stdAlloc > IterableList_DHP_less_stdAlloc;
115 //        typedef cc::IterableKVList< rcu_gpi, Key, Value, traits_IterableList_less_stdAlloc > IterableList_RCU_GPI_less_stdAlloc;
116 //        typedef cc::IterableKVList< rcu_gpb, Key, Value, traits_IterableList_less_stdAlloc > IterableList_RCU_GPB_less_stdAlloc;
117 //        typedef cc::IterableKVList< rcu_gpt, Key, Value, traits_IterableList_less_stdAlloc > IterableList_RCU_GPT_less_stdAlloc;
118 //#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
119 //        typedef cc::IterableKVList< rcu_shb, Key, Value, traits_IterableList_less_stdAlloc > IterableList_RCU_SHB_less_stdAlloc;
120 //        typedef cc::IterableKVList< rcu_sht, Key, Value, traits_IterableList_less_stdAlloc > IterableList_RCU_SHT_less_stdAlloc;
121 //#endif
122
123         struct traits_IterableList_less_stdAlloc_stat: public traits_IterableList_less_stdAlloc
124         {
125             typedef cc::iterable_list::stat<> stat;
126         };
127         typedef cc::IterableKVList< cds::gc::HP, Key, Value, traits_IterableList_less_stdAlloc_stat > IterableList_HP_less_stdAlloc_stat;
128         typedef cc::IterableKVList< cds::gc::DHP, Key, Value, traits_IterableList_less_stdAlloc_stat > IterableList_DHP_less_stdAlloc_stat;
129 //        typedef cc::IterableKVList< rcu_gpi, Key, Value, traits_IterableList_less_stdAlloc_stat > IterableList_RCU_GPI_less_stdAlloc_stat;
130 //        typedef cc::IterableKVList< rcu_gpb, Key, Value, traits_IterableList_less_stdAlloc_stat > IterableList_RCU_GPB_less_stdAlloc_stat;
131 //        typedef cc::IterableKVList< rcu_gpt, Key, Value, traits_IterableList_less_stdAlloc_stat > IterableList_RCU_GPT_less_stdAlloc_stat;
132 //#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
133 //        typedef cc::IterableKVList< rcu_shb, Key, Value, traits_IterableList_less_stdAlloc_stat > IterableList_RCU_SHB_less_stdAlloc_stat;
134 //        typedef cc::IterableKVList< rcu_sht, Key, Value, traits_IterableList_less_stdAlloc_stat > IterableList_RCU_SHT_less_stdAlloc_stat;
135 //#endif
136
137         struct traits_IterableList_less_stdAlloc_seqcst :
138             public cc::iterable_list::make_traits<
139                 co::less< less >
140                 ,co::memory_model< co::v::sequential_consistent >
141             >::type
142         {};
143         typedef cc::IterableKVList< cds::gc::HP,  Key, Value, traits_IterableList_less_stdAlloc_seqcst > IterableList_HP_less_stdAlloc_seqcst;
144         typedef cc::IterableKVList< cds::gc::DHP, Key, Value, traits_IterableList_less_stdAlloc_seqcst > IterableList_DHP_less_stdAlloc_seqcst;
145 //        typedef cc::IterableKVList< rcu_gpi, Key, Value, traits_IterableList_less_stdAlloc_seqcst > IterableList_RCU_GPI_less_stdAlloc_seqcst;
146 //        typedef cc::IterableKVList< rcu_gpb, Key, Value, traits_IterableList_less_stdAlloc_seqcst > IterableList_RCU_GPB_less_stdAlloc_seqcst;
147 //        typedef cc::IterableKVList< rcu_gpt, Key, Value, traits_IterableList_less_stdAlloc_seqcst > IterableList_RCU_GPT_less_stdAlloc_seqcst;
148 //#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
149 //        typedef cc::IterableKVList< rcu_shb, Key, Value, traits_IterableList_less_stdAlloc_seqcst > IterableList_RCU_SHB_less_stdAlloc_seqcst;
150 //        typedef cc::IterableKVList< rcu_sht, Key, Value, traits_IterableList_less_stdAlloc_seqcst > IterableList_RCU_SHT_less_stdAlloc_seqcst;
151 //#endif
152
153         struct traits_IterableList_less_michaelAlloc :
154             public cc::iterable_list::make_traits<
155                 co::less< less >,
156                 co::allocator< memory::MichaelAllocator<int> >
157             >::type
158         {};
159         typedef cc::IterableKVList< cds::gc::HP,  Key, Value, traits_IterableList_less_michaelAlloc > IterableList_HP_less_michaelAlloc;
160         typedef cc::IterableKVList< cds::gc::DHP, Key, Value, traits_IterableList_less_michaelAlloc > IterableList_DHP_less_michaelAlloc;
161 //        typedef cc::IterableKVList< rcu_gpi, Key, Value, traits_IterableList_less_michaelAlloc > IterableList_RCU_GPI_less_michaelAlloc;
162 //        typedef cc::IterableKVList< rcu_gpb, Key, Value, traits_IterableList_less_michaelAlloc > IterableList_RCU_GPB_less_michaelAlloc;
163 //        typedef cc::IterableKVList< rcu_gpt, Key, Value, traits_IterableList_less_michaelAlloc > IterableList_RCU_GPT_less_michaelAlloc;
164 //#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
165 //        typedef cc::IterableKVList< rcu_shb, Key, Value, traits_IterableList_less_michaelAlloc > IterableList_RCU_SHB_less_michaelAlloc;
166 //        typedef cc::IterableKVList< rcu_sht, Key, Value, traits_IterableList_less_michaelAlloc > IterableList_RCU_SHT_less_michaelAlloc;
167 //#endif
168     };
169
170 } // namespace map
171
172 #endif // ifndef CDSUNIT_MAP_TYPE_ITERABLE_LIST_H