3 #ifndef CDSLIB_CONTAINER_DETAILS_LAZY_LIST_BASE_H
4 #define CDSLIB_CONTAINER_DETAILS_LAZY_LIST_BASE_H
6 #include <cds/container/details/base.h>
7 #include <cds/intrusive/details/lazy_list_base.h>
8 #include <cds/urcu/options.h>
10 namespace cds { namespace container {
12 /// LazyList ordered list related definitions
13 /** @ingroup cds_nonintrusive_helper
18 Either \p compare or \p less or both must be specified.
22 /// allocator used to allocate new node
23 typedef CDS_DEFAULT_ALLOCATOR allocator;
25 /// Key comparing functor
27 No default functor is provided. If the option is not specified, the \p less is used.
29 typedef opt::none compare;
31 /// Specifies binary predicate used for key comparing
33 Default is \p std::less<T>.
35 typedef opt::none less;
37 /// Specifies binary functor used for comparing keys for equality
39 No default functor is provided. If \p equal_to option is not spcified, \p compare is used, if \p compare is not
40 specified, \p less is used.
42 typedef opt::none equal_to;
44 /// Specifies list ordering policy.
46 If \p sort is \p true, than list maintains items in sorted order, otherwise items are unordered. Default is \p true.
47 Note that if \p sort is \p false then lookup operations scan entire list.
49 static const bool sort = true;
51 /// Lock type used to lock modifying items
53 Default is cds::sync::spin
55 typedef cds::sync::spin lock_type;
57 /// back-off strategy used
58 typedef cds::backoff::Default back_off;
60 /// Item counting feature; by default, disabled. Use \p cds::atomicity::item_counter to enable item counting
61 typedef atomicity::empty_item_counter item_counter;
63 /// C++ memory ordering model
65 Can be \p opt::v::relaxed_ordering (relaxed memory model, the default)
66 or \p opt::v::sequential_consistent (sequentially consisnent memory model).
68 typedef opt::v::relaxed_ordering memory_model;
70 /// RCU deadlock checking policy (only for \ref cds_intrusive_LazyList_rcu "RCU-based LazyList")
72 List of available options see \p opt::rcu_check_deadlock
74 typedef opt::v::rcu_throw_deadlock rcu_check_deadlock;
77 // LazyKVList: supporting for split-ordered list
78 // key accessor (opt::none = internal key type is equal to user key type)
79 typedef opt::none key_accessor;
84 /// Metafunction converting option list to \p lazy_list::traits
87 - \p opt::lock_type - lock type for node-level locking. Default \p is cds::sync::spin. Note that <b>each</b> node
88 of the list has member of type \p lock_type, therefore, heavy-weighted locking primitive is not
89 acceptable as candidate for \p lock_type.
90 - \p opt::compare - key compare functor. No default functor is provided.
91 If the option is not specified, the \p opt::less is used.
92 - \p opt::less - specifies binary predicate used for key compare. Default is \p std::less<T>.
93 - \p opt::equal_to - specifies binary functor for comparing keys for equality. No default is provided. If \p equal_to is
94 not specified, \p compare is used, if \p compare is not specified, \p less is used.
95 - \p opt::sort - specifies ordering policy. Default value is \p true.
96 - \p opt::back_off - back-off strategy used. If the option is not specified, \p cds::backoff::Default is used.
97 - \p opt::item_counter - the type of item counting feature. Default is disabled (\p atomicity::empty_item_counter).
98 To enable item counting use \p atomicity::item_counter.
99 - \p opt::allocator - the allocator used for creating and freeing list's item. Default is \ref CDS_DEFAULT_ALLOCATOR macro.
100 - \p opt::memory_model - C++ memory ordering model. Can be \p opt::v::relaxed_ordering (relaxed memory model, the default)
101 or \p opt::v::sequential_consistent (sequentially consisnent memory model).
103 template <typename... Options>
105 # ifdef CDS_DOXYGEN_INVOKED
106 typedef implementation_defined type ; ///< Metafunction result
108 typedef typename cds::opt::make_options<
109 typename cds::opt::find_type_traits< traits, Options... >::type
116 } // namespace lazy_list
118 // Forward declarations
119 template <typename GC, typename T, typename Traits=lazy_list::traits>
122 template <typename GC, typename Key, typename Value, typename Traits=lazy_list::traits>
125 // Tag for selecting lazy list implementation
127 This struct is empty and it is used only as a tag for selecting LazyList
128 as ordered list implementation in declaration of some classes.
130 See \p split_list::traits::ordered_list as an example.
135 }} // namespace cds::container
138 #endif // #ifndef CDSLIB_CONTAINER_DETAILS_LAZY_LIST_BASE_H