Move michael_list_base.h from cds/container to cds/container/details
[libcds.git] / cds / container / details / michael_list_base.h
1 //$$CDS-header$$
2
3 #ifndef __CDS_CONTAINER_DETAILS_MICHAEL_LIST_BASE_H
4 #define __CDS_CONTAINER_DETAILS_MICHAEL_LIST_BASE_H
5
6 #include <cds/container/details/base.h>
7 #include <cds/intrusive/details/michael_list_base.h>
8 #include <cds/urcu/options.h>
9
10 namespace cds { namespace container {
11
12     /// MichaelList ordered list related definitions
13     /** @ingroup cds_nonintrusive_helper
14     */
15     namespace michael_list {
16         /// Michael list default type traits
17         struct type_traits
18         {
19             typedef CDS_DEFAULT_ALLOCATOR   allocator       ;   ///< allocator used to allocate new node
20
21             /// Key comparison functor
22             /**
23                 No default functor is provided. If the option is not specified, the \p less is used.
24             */
25             typedef opt::none                       compare;
26
27             /// specifies binary predicate used for key comparison.
28             /**
29                 Default is \p std::less<T>.
30             */
31             typedef opt::none                       less;
32
33             /// back-off strategy used
34             /**
35                 If the option is not specified, the cds::backoff::empty is used.
36             */
37             typedef cds::backoff::empty             back_off;
38
39             /// Item counter
40             /**
41                 The type for item counting feature.
42                 Default is no item counter (\ref atomicity::empty_item_counter)
43             */
44             typedef atomicity::empty_item_counter     item_counter;
45
46             /// Link fields checking feature
47             /**
48                 Default is \ref intrusive::opt::debug_check_link
49             */
50             static const opt::link_check_type link_checker = opt::debug_check_link;
51
52             /// C++ memory ordering model
53             /**
54                 List of available memory ordering see opt::memory_model
55             */
56             typedef opt::v::relaxed_ordering        memory_model;
57
58             /// RCU deadlock checking policy (only for \ref cds_intrusive_MichaelList_rcu "RCU-based MichaelList")
59             /**
60                 List of available options see opt::rcu_check_deadlock
61             */
62             typedef opt::v::rcu_throw_deadlock      rcu_check_deadlock;
63
64             //@cond
65             // MichaelKVList: supporting for split-ordered list
66             // key accessor (opt::none = internal key type is equal to user key type)
67             typedef opt::none                       key_accessor;
68             //@endcond
69         };
70
71         /// Metafunction converting option list to MichaelList traits
72         /**
73             This is a wrapper for <tt> cds::opt::make_options< type_traits, Options...> </tt>
74
75             See \ref MichaelList, \ref type_traits, \ref cds::opt::make_options.
76         */
77         template <typename... Options>
78         struct make_traits {
79 #   ifdef CDS_DOXYGEN_INVOKED
80             typedef implementation_defined type ;   ///< Metafunction result
81 #   else
82             typedef typename cds::opt::make_options<
83                 typename cds::opt::find_type_traits< type_traits, Options... >::type
84                 ,Options...
85             >::type   type;
86 #endif
87         };
88
89
90     } // namespace michael_list
91
92     // Forward declarations
93     template <typename GC, typename T, typename Traits=michael_list::type_traits>
94     class MichaelList;
95
96     template <typename GC, typename Key, typename Value, typename Traits=michael_list::type_traits>
97     class MichaelKVList;
98
99     // Tag for selecting Michael's list implementation
100     /**
101         This struct is empty and it is used only as a tag for selecting MichaelList
102         as ordered list implementation in declaration of some classes.
103
104         See split_list::type_traits::ordered_list as an example.
105     */
106     struct michael_list_tag
107     {};
108
109 }}  // namespace cds::container
110
111
112 #endif  // #ifndef __CDS_CONTAINER_DETAILS_MICHAEL_LIST_BASE_H