Modifies more sequential test cases for sets
[libcds.git] / test / stress / sequential / sequential-set / set_type_michael_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_SET_TYPE_MICHAEL_LIST_H
32 #define CDSUNIT_SET_TYPE_MICHAEL_LIST_H
33
34 #include "set_type.h"
35
36 #include <cds/container/michael_list_hp.h>
37 #include <cds/container/michael_list_dhp.h>
38 #include <cds/container/michael_list_rcu.h>
39
40 namespace set {
41
42     template <typename Key, typename Val>
43     struct michael_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_MichaelList_cmp:
50             public cc::michael_list::make_traits<
51                 co::compare< compare >
52             >::type
53         {};
54         typedef cc::MichaelList< cds::gc::HP,  key_val, traits_MichaelList_cmp > MichaelList_HP_cmp;
55         typedef cc::MichaelList< cds::gc::DHP, key_val, traits_MichaelList_cmp > MichaelList_DHP_cmp;
56         typedef cc::MichaelList< rcu_gpi, key_val, traits_MichaelList_cmp > MichaelList_RCU_GPI_cmp;
57         typedef cc::MichaelList< rcu_gpb, key_val, traits_MichaelList_cmp > MichaelList_RCU_GPB_cmp;
58         typedef cc::MichaelList< rcu_gpt, key_val, traits_MichaelList_cmp > MichaelList_RCU_GPT_cmp;
59 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
60         typedef cc::MichaelList< rcu_shb, key_val, traits_MichaelList_cmp > MichaelList_RCU_SHB_cmp;
61 #endif
62
63         struct traits_MichaelList_cmp_stat: public traits_MichaelList_cmp
64         {
65             typedef cc::michael_list::stat<> stat;
66         };
67         typedef cc::MichaelList< cds::gc::HP,  key_val, traits_MichaelList_cmp_stat > MichaelList_HP_cmp_stat;
68         typedef cc::MichaelList< cds::gc::DHP, key_val, traits_MichaelList_cmp_stat > MichaelList_DHP_cmp_stat;
69         typedef cc::MichaelList< rcu_gpi, key_val, traits_MichaelList_cmp_stat > MichaelList_RCU_GPI_cmp_stat;
70         typedef cc::MichaelList< rcu_gpb, key_val, traits_MichaelList_cmp_stat > MichaelList_RCU_GPB_cmp_stat;
71         typedef cc::MichaelList< rcu_gpt, key_val, traits_MichaelList_cmp_stat > MichaelList_RCU_GPT_cmp_stat;
72 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
73         typedef cc::MichaelList< rcu_shb, key_val, traits_MichaelList_cmp_stat > MichaelList_RCU_SHB_cmp_stat;
74 #endif
75
76         struct traits_MichaelList_cmp_seqcst : public traits_MichaelList_cmp
77         {
78             typedef co::v::sequential_consistent memory_model;
79         };
80         typedef cc::MichaelList< cds::gc::HP,  key_val, traits_MichaelList_cmp_seqcst > MichaelList_HP_cmp_seqcst;
81         typedef cc::MichaelList< cds::gc::DHP, key_val, traits_MichaelList_cmp_seqcst > MichaelList_DHP_cmp_seqcst;
82         typedef cc::MichaelList< rcu_gpi, key_val, traits_MichaelList_cmp_seqcst > MichaelList_RCU_GPI_cmp_seqcst;
83         typedef cc::MichaelList< rcu_gpb, key_val, traits_MichaelList_cmp_seqcst > MichaelList_RCU_GPB_cmp_seqcst;
84         typedef cc::MichaelList< rcu_gpt, key_val, traits_MichaelList_cmp_seqcst > MichaelList_RCU_GPT_cmp_seqcst;
85 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
86         typedef cc::MichaelList< rcu_shb, key_val, traits_MichaelList_cmp_seqcst > MichaelList_RCU_SHB_cmp_seqcst;
87 #endif
88
89         struct traits_MichaelList_less :
90             public cc::michael_list::make_traits<
91                 co::less< less >
92             >::type
93         {};
94         typedef cc::MichaelList< cds::gc::HP,  key_val, traits_MichaelList_less > MichaelList_HP_less;
95         typedef cc::MichaelList< cds::gc::DHP, key_val, traits_MichaelList_less > MichaelList_DHP_less;
96         typedef cc::MichaelList< rcu_gpi, key_val, traits_MichaelList_less > MichaelList_RCU_GPI_less;
97         typedef cc::MichaelList< rcu_gpb, key_val, traits_MichaelList_less > MichaelList_RCU_GPB_less;
98         typedef cc::MichaelList< rcu_gpt, key_val, traits_MichaelList_less > MichaelList_RCU_GPT_less;
99 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
100         typedef cc::MichaelList< rcu_shb, key_val, traits_MichaelList_less > MichaelList_RCU_SHB_less;
101 #endif
102
103         struct traits_MichaelList_less_stat : public traits_MichaelList_less
104         {
105             typedef cc::michael_list::stat<> stat;
106         };
107         typedef cc::MichaelList< cds::gc::HP,  key_val, traits_MichaelList_less_stat > MichaelList_HP_less_stat;
108         typedef cc::MichaelList< cds::gc::DHP, key_val, traits_MichaelList_less_stat > MichaelList_DHP_less_stat;
109         typedef cc::MichaelList< rcu_gpi, key_val, traits_MichaelList_less_stat > MichaelList_RCU_GPI_less_stat;
110         typedef cc::MichaelList< rcu_gpb, key_val, traits_MichaelList_less_stat > MichaelList_RCU_GPB_less_stat;
111         typedef cc::MichaelList< rcu_gpt, key_val, traits_MichaelList_less_stat > MichaelList_RCU_GPT_less_stat;
112 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
113         typedef cc::MichaelList< rcu_shb, key_val, traits_MichaelList_less_stat > MichaelList_RCU_SHB_less_stat;
114 #endif
115
116         struct traits_MichaelList_less_seqcst :
117             public cc::michael_list::make_traits<
118                 co::less< less >
119                 ,co::memory_model< co::v::sequential_consistent >
120             >::type
121         {};
122         typedef cc::MichaelList< cds::gc::HP,  key_val, traits_MichaelList_less_seqcst > MichaelList_HP_less_seqcst;
123         typedef cc::MichaelList< cds::gc::DHP, key_val, traits_MichaelList_less_seqcst > MichaelList_DHP_less_seqcst;
124         typedef cc::MichaelList< rcu_gpi, key_val, traits_MichaelList_less_seqcst > MichaelList_RCU_GPI_less_seqcst;
125         typedef cc::MichaelList< rcu_gpb, key_val, traits_MichaelList_less_seqcst > MichaelList_RCU_GPB_less_seqcst;
126         typedef cc::MichaelList< rcu_gpt, key_val, traits_MichaelList_less_seqcst > MichaelList_RCU_GPT_less_seqcst;
127 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
128         typedef cc::MichaelList< rcu_shb, key_val, traits_MichaelList_less_seqcst > MichaelList_RCU_SHB_less_seqcst;
129 #endif
130
131     };
132
133 } // namespace set
134
135 #endif // #ifndef CDSUNIT_SET_TYPE_MICHAEL_LIST_H