Modifies more sequential test cases for sets
[libcds.git] / test / stress / sequential / sequential-set / set_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-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_ITRERABLE_LIST_H
32 #define CDSUNIT_SET_TYPE_ITRERABLE_LIST_H
33
34 #include "set_type.h"
35
36 #include <cds/container/iterable_list_hp.h>
37 #include <cds/container/iterable_list_dhp.h>
38 //#include <cds/container/michael_list_rcu.h>
39
40 namespace set {
41
42     template <typename Key, typename Val>
43     struct iterable_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_IterableList_cmp:
50             public cc::iterable_list::make_traits<
51                 co::compare< compare >
52             >::type
53         {};
54         typedef cc::IterableList< cds::gc::HP,  key_val, traits_IterableList_cmp > IterableList_HP_cmp;
55         typedef cc::IterableList< cds::gc::DHP, key_val, traits_IterableList_cmp > IterableList_DHP_cmp;
56
57         struct traits_IterableList_cmp_stat: public traits_IterableList_cmp
58         {
59             typedef cc::iterable_list::stat<> stat;
60         };
61         typedef cc::IterableList< cds::gc::HP,  key_val, traits_IterableList_cmp_stat > IterableList_HP_cmp_stat;
62         typedef cc::IterableList< cds::gc::DHP, key_val, traits_IterableList_cmp_stat > IterableList_DHP_cmp_stat;
63
64         struct traits_IterableList_cmp_seqcst : public traits_IterableList_cmp
65         {
66             typedef co::v::sequential_consistent memory_model;
67         };
68         typedef cc::IterableList< cds::gc::HP,  key_val, traits_IterableList_cmp_seqcst > IterableList_HP_cmp_seqcst;
69         typedef cc::IterableList< cds::gc::DHP, key_val, traits_IterableList_cmp_seqcst > IterableList_DHP_cmp_seqcst;
70
71         struct traits_IterableList_less :
72             public cc::iterable_list::make_traits<
73                 co::less< less >
74             >::type
75         {};
76         typedef cc::IterableList< cds::gc::HP,  key_val, traits_IterableList_less > IterableList_HP_less;
77         typedef cc::IterableList< cds::gc::DHP, key_val, traits_IterableList_less > IterableList_DHP_less;
78
79         struct traits_IterableList_less_stat : public traits_IterableList_less
80         {
81             typedef cc::iterable_list::stat<> stat;
82         };
83         typedef cc::IterableList< cds::gc::HP,  key_val, traits_IterableList_less_stat > IterableList_HP_less_stat;
84         typedef cc::IterableList< cds::gc::DHP, key_val, traits_IterableList_less_stat > IterableList_DHP_less_stat;
85
86         struct traits_IterableList_less_seqcst :
87             public cc::iterable_list::make_traits<
88                 co::less< less >
89                 ,co::memory_model< co::v::sequential_consistent >
90             >::type
91         {};
92         typedef cc::IterableList< cds::gc::HP,  key_val, traits_IterableList_less_seqcst > IterableList_HP_less_seqcst;
93         typedef cc::IterableList< cds::gc::DHP, key_val, traits_IterableList_less_seqcst > IterableList_DHP_less_seqcst;
94
95     };
96
97 } // namespace set
98
99 #endif // #ifndef CDSUNIT_SET_TYPE_ITRERABLE_LIST_H