Fix compile and readme
[c11tester.git] / libcdsTest / ms-queue / test_intrusive_msqueue.h
1 // Copyright (c) 2006-2018 Maxim Khizhinsky
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #ifndef CDSUNIT_QUEUE_TEST_INTRUSIVE_MSQUEUE_H
7 #define CDSUNIT_QUEUE_TEST_INTRUSIVE_MSQUEUE_H
8
9 namespace cds_test {
10
11     class intrusive_msqueue
12     {
13     public:
14         template <typename Base>
15         struct base_hook_item : public Base
16         {
17             int nVal;
18             int nDisposeCount;
19
20             base_hook_item()
21                 : nDisposeCount( 0 )
22             {}
23
24             base_hook_item( base_hook_item const& s)
25                 : nVal( s.nVal )
26                 , nDisposeCount( s.nDisposeCount )
27             {}
28         };
29
30         template <typename Member>
31         struct member_hook_item
32         {
33             int nVal;
34             int nDisposeCount;
35             Member hMember;
36
37             member_hook_item()
38                 : nDisposeCount( 0 )
39             {}
40
41             member_hook_item( member_hook_item const& s )
42                 : nVal( s.nVal )
43                 , nDisposeCount( s.nDisposeCount )
44             {}
45         };
46
47         struct mock_disposer
48         {
49             template <typename T>
50             void operator ()( T * p )
51             {
52                 ++p->nDisposeCount;
53             }
54         };
55
56     };
57
58 } // namespace cds_test
59
60 #endif // CDSUNIT_QUEUE_TEST_INTRUSIVE_MSQUEUE_H