Added copyright and license
[libcds.git] / tests / test-hdr / list / hdr_intrusive_michael_list_rcu_gpb.cpp
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 #include "list/hdr_intrusive_michael.h"
32 #include <cds/urcu/general_buffered.h>
33 #include <cds/intrusive/michael_list_rcu.h>
34
35 namespace ordlist {
36     namespace {
37         typedef cds::urcu::gc< cds::urcu::general_buffered<> >    RCU;
38     }
39
40     void IntrusiveMichaelListHeaderTest::RCU_GPB_base_cmp()
41     {
42         typedef base_int_item< RCU > item;
43         struct traits : public ci::michael_list::traits
44         {
45             typedef ci::michael_list::base_hook< co::gc<RCU> > hook;
46             typedef cmp<item> compare;
47             typedef faked_disposer disposer;
48         };
49         typedef ci::MichaelList< RCU, item, traits > list;
50         test_rcu_int<list>();
51     }
52     void IntrusiveMichaelListHeaderTest::RCU_GPB_base_less()
53     {
54         typedef base_int_item< RCU > item;
55         struct traits : public ci::michael_list::traits
56         {
57             typedef ci::michael_list::base_hook< co::gc<RCU> > hook;
58             typedef IntrusiveMichaelListHeaderTest::less<item> less;
59             typedef faked_disposer disposer;
60         };
61         typedef ci::MichaelList< RCU, item, traits > list;
62         test_rcu_int<list>();
63     }
64     void IntrusiveMichaelListHeaderTest::RCU_GPB_base_cmpmix()
65     {
66         typedef base_int_item< RCU > item;
67         typedef ci::MichaelList< RCU
68             ,item
69             ,ci::michael_list::make_traits<
70                 ci::opt::hook< ci::michael_list::base_hook< co::gc<RCU> > >
71                 ,co::less< less<item> >
72                 ,co::compare< cmp<item> >
73                 ,ci::opt::disposer< faked_disposer >
74             >::type
75         >    list;
76         test_rcu_int<list>();
77     }
78     void IntrusiveMichaelListHeaderTest::RCU_GPB_base_ic()
79     {
80         typedef base_int_item< RCU > item;
81         typedef ci::MichaelList< RCU
82             ,item
83             ,ci::michael_list::make_traits<
84                 ci::opt::hook< ci::michael_list::base_hook< co::gc<RCU> > >
85                 ,co::less< less<item> >
86                 ,co::compare< cmp<item> >
87                 ,ci::opt::disposer< faked_disposer >
88                 ,co::item_counter< cds::atomicity::item_counter >
89             >::type
90         >    list;
91         test_rcu_int<list>();
92     }
93     void IntrusiveMichaelListHeaderTest::RCU_GPB_member_cmp()
94     {
95         typedef member_int_item< RCU > item;
96         typedef ci::MichaelList< RCU
97             ,item
98             ,ci::michael_list::make_traits<
99                 ci::opt::hook< ci::michael_list::member_hook<
100                     offsetof( item, hMember ),
101                     co::gc<RCU>
102                 > >
103                 ,co::compare< cmp<item> >
104                 ,ci::opt::disposer< faked_disposer >
105             >::type
106         >    list;
107         test_rcu_int<list>();
108     }
109     void IntrusiveMichaelListHeaderTest::RCU_GPB_member_less()
110     {
111         typedef member_int_item< RCU > item;
112         typedef ci::MichaelList< RCU
113             ,item
114             ,ci::michael_list::make_traits<
115                 ci::opt::hook< ci::michael_list::member_hook<
116                     offsetof( item, hMember ),
117                     co::gc<RCU>
118                 > >
119                 ,co::less< less<item> >
120                 ,ci::opt::disposer< faked_disposer >
121             >::type
122         >    list;
123         test_rcu_int<list>();
124     }
125     void IntrusiveMichaelListHeaderTest::RCU_GPB_member_cmpmix()
126     {
127         typedef member_int_item< RCU > item;
128         typedef ci::MichaelList< RCU
129             ,item
130             ,ci::michael_list::make_traits<
131                 ci::opt::hook< ci::michael_list::member_hook<
132                     offsetof( item, hMember ),
133                     co::gc<RCU>
134                 > >
135                 ,co::less< less<item> >
136                 ,co::compare< cmp<item> >
137                 ,ci::opt::disposer< faked_disposer >
138             >::type
139         >    list;
140         test_rcu_int<list>();
141     }
142     void IntrusiveMichaelListHeaderTest::RCU_GPB_member_ic()
143     {
144         typedef member_int_item< RCU > item;
145         typedef ci::MichaelList< RCU
146             ,item
147             ,ci::michael_list::make_traits<
148                 ci::opt::hook< ci::michael_list::member_hook<
149                     offsetof( item, hMember ),
150                     co::gc<RCU>
151                 > >
152                 ,co::compare< cmp<item> >
153                 ,ci::opt::disposer< faked_disposer >
154                 ,co::item_counter< cds::atomicity::item_counter >
155             >::type
156         >    list;
157         test_rcu_int<list>();
158     }
159
160 }