2 This file is a part of libcds - Concurrent Data Structures library
4 (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
6 Source code repo: http://github.com/khizmax/libcds/
7 Download: http://sourceforge.net/projects/libcds/files/
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met:
12 * Redistributions of source code must retain the above copyright notice, this
13 list of conditions and the following disclaimer.
15 * Redistributions in binary form must reproduce the above copyright notice,
16 this list of conditions and the following disclaimer in the documentation
17 and/or other materials provided with the distribution.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef CDSLIB_CONTAINER_DETAILS_MICHAEL_LIST_BASE_H
32 #define CDSLIB_CONTAINER_DETAILS_MICHAEL_LIST_BASE_H
34 #include <cds/container/details/base.h>
35 #include <cds/intrusive/details/michael_list_base.h>
36 #include <cds/urcu/options.h>
38 namespace cds { namespace container {
40 /// MichaelList ordered list related definitions
41 /** @ingroup cds_nonintrusive_helper
43 namespace michael_list {
44 /// MichaelList traits
47 typedef CDS_DEFAULT_ALLOCATOR allocator ; ///< allocator used to allocate new node
49 /// Key comparison functor
51 No default functor is provided. If the option is not specified, the \p less is used.
53 typedef opt::none compare;
55 /// Specifies binary predicate used for key comparison.
57 Default is \p std::less<T>.
59 typedef opt::none less;
62 typedef cds::backoff::empty back_off;
64 /// Item counting feature; by default, disabled. Use \p cds::atomicity::item_counter to enable item counting
65 typedef atomicity::empty_item_counter item_counter;
67 /// C++ memory ordering model
69 Can be \p opt::v::relaxed_ordering (relaxed memory model, the default)
70 or \p opt::v::sequential_consistent (sequentially consisnent memory model).
72 typedef opt::v::relaxed_ordering memory_model;
74 /// RCU deadlock checking policy (only for \ref cds_intrusive_MichaelList_rcu "RCU-based MichaelList")
76 List of available options see opt::rcu_check_deadlock
78 typedef opt::v::rcu_throw_deadlock rcu_check_deadlock;
81 // MichaelKVList: supporting for split-ordered list
82 // key accessor (opt::none = internal key type is equal to user key type)
83 typedef opt::none key_accessor;
87 /// Metafunction converting option list to \p michael_list::traits
90 template <typename... Options>
92 # ifdef CDS_DOXYGEN_INVOKED
93 typedef implementation_defined type ; ///< Metafunction result
95 typedef typename cds::opt::make_options<
96 typename cds::opt::find_type_traits< traits, Options... >::type
103 } // namespace michael_list
105 // Forward declarations
106 template <typename GC, typename T, typename Traits=michael_list::traits>
109 template <typename GC, typename Key, typename Value, typename Traits=michael_list::traits>
112 // Tag for selecting Michael's list implementation
114 This struct is empty and it is used only as a tag for selecting MichaelList
115 as ordered list implementation in declaration of some classes.
117 See split_list::traits::ordered_list as an example.
119 struct michael_list_tag
122 }} // namespace cds::container
125 #endif // #ifndef CDSLIB_CONTAINER_DETAILS_MICHAEL_LIST_BASE_H