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