On dev: MIchaelList
[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         /// MichaelList traits
17         struct 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
34             typedef cds::backoff::empty             back_off;
35
36             /// Item counting feature; by default, disabled. Use \p cds::atomicity::item_counter to enable item counting
37             typedef atomicity::empty_item_counter     item_counter;
38
39             /// C++ memory ordering model
40             /** 
41                 Can be \p opt::v::relaxed_ordering (relaxed memory model, the default)
42                 or \p opt::v::sequential_consistent (sequentially consisnent memory model).
43             */
44             typedef opt::v::relaxed_ordering        memory_model;
45
46             /// RCU deadlock checking policy (only for \ref cds_intrusive_MichaelList_rcu "RCU-based MichaelList")
47             /**
48                 List of available options see opt::rcu_check_deadlock
49             */
50             typedef opt::v::rcu_throw_deadlock      rcu_check_deadlock;
51
52             //@cond
53             // MichaelKVList: supporting for split-ordered list
54             // key accessor (opt::none = internal key type is equal to user key type)
55             typedef opt::none                       key_accessor;
56             //@endcond
57         };
58
59         /// Metafunction converting option list to \p michael_list::traits
60         /**
61         */
62         template <typename... Options>
63         struct make_traits {
64 #   ifdef CDS_DOXYGEN_INVOKED
65             typedef implementation_defined type ;   ///< Metafunction result
66 #   else
67             typedef typename cds::opt::make_options<
68                 typename cds::opt::find_type_traits< traits, Options... >::type
69                 ,Options...
70             >::type   type;
71 #endif
72         };
73
74
75     } // namespace michael_list
76
77     // Forward declarations
78     template <typename GC, typename T, typename Traits=michael_list::traits>
79     class MichaelList;
80
81     template <typename GC, typename Key, typename Value, typename Traits=michael_list::traits>
82     class MichaelKVList;
83
84     // Tag for selecting Michael's list implementation
85     /**
86         This struct is empty and it is used only as a tag for selecting MichaelList
87         as ordered list implementation in declaration of some classes.
88
89         See split_list::type_traits::ordered_list as an example.
90     */
91     struct michael_list_tag
92     {};
93
94 }}  // namespace cds::container
95
96
97 #endif  // #ifndef __CDS_CONTAINER_DETAILS_MICHAEL_LIST_BASE_H