3 #ifndef CDSLIB_CONTAINER_DETAILS_FELDMAN_HASHSET_BASE_H
4 #define CDSLIB_CONTAINER_DETAILS_FELDMAN_HASHSET_BASE_H
6 #include <cds/intrusive/details/feldman_hashset_base.h>
7 #include <cds/container/details/base.h>
9 namespace cds { namespace container {
10 /// \p FeldmanHashSet related definitions
11 /** @ingroup cds_nonintrusive_helper
13 namespace feldman_hashset {
14 /// Hash accessor option
16 @copydetails cds::intrusive::feldman_hashset::traits::hash_accessor
18 template <typename Accessor>
19 using hash_accessor = cds::intrusive::feldman_hashset::hash_accessor< Accessor >;
21 /// \p FeldmanHashSet internal statistics, see cds::intrusive::feldman_hashset::stat
22 template <typename EventCounter = cds::atomicity::event_counter>
23 using stat = cds::intrusive::feldman_hashset::stat< EventCounter >;
25 /// \p FeldmanHashSet empty internal statistics
26 typedef cds::intrusive::feldman_hashset::empty_stat empty_stat;
28 /// Bit-wise memcmp-based comparator for hash value \p T
30 using bitwise_compare = cds::intrusive::feldman_hashset::bitwise_compare< T >;
32 /// \p FeldmanHashSet traits
35 /// Mandatory functor to get hash value from data node
37 @copydetails cds::intrusive::feldman_hashset::traits::hash_accessor
39 typedef cds::opt::none hash_accessor;
41 /// Hash comparing functor
43 @copydetails cds::intrusive::feldman_hashset::traits::compare
45 typedef cds::opt::none compare;
47 /// Specifies binary predicate used for hash compare.
49 @copydetails cds::intrusive::feldman_hashset::traits::less
51 typedef cds::opt::none less;
55 @copydetails cds::intrusive::feldman_hashset::traits::item_counter
57 typedef cds::atomicity::item_counter item_counter;
61 Default is \ref CDS_DEFAULT_ALLOCATOR
63 typedef CDS_DEFAULT_ALLOCATOR allocator;
65 /// Array node allocator
67 @copydetails cds::intrusive::feldman_hashset::traits::node_allocator
69 typedef CDS_DEFAULT_ALLOCATOR node_allocator;
71 /// C++ memory ordering model
73 @copydetails cds::intrusive::feldman_hashset::traits::memory_model
75 typedef cds::opt::v::relaxed_ordering memory_model;
78 typedef cds::backoff::Default back_off;
80 /// Internal statistics
82 @copydetails cds::intrusive::feldman_hashset::traits::stat
84 typedef empty_stat stat;
86 /// RCU deadlock checking policy (only for \ref cds_container_FeldmanHashSet_rcu "RCU-based FeldmanHashSet")
88 @copydetails cds::intrusive::feldman_hashset::traits::rcu_check_deadlock
90 typedef cds::opt::v::rcu_throw_deadlock rcu_check_deadlock;
93 /// Metafunction converting option list to \p feldman_hashset::traits
95 Supported \p Options are:
96 - \p feldman_hashset::hash_accessor - mandatory option, hash accessor functor.
97 @copydetails traits::hash_accessor
98 - \p opt::allocator - item allocator
99 @copydetails traits::allocator
100 - \p opt::node_allocator - array node allocator.
101 @copydetails traits::node_allocator
102 - \p opt::compare - hash comparison functor. No default functor is provided.
103 If the option is not specified, the \p opt::less is used.
104 - \p opt::less - specifies binary predicate used for hash comparison.
105 @copydetails cds::container::feldman_hashset::traits::less
106 - \p opt::back_off - back-off strategy used. If the option is not specified, the \p cds::backoff::Default is used.
107 - \p opt::item_counter - the type of item counting feature.
108 @copydetails cds::intrusive::feldman_hashset::traits::item_counter
109 - \p opt::memory_model - C++ memory ordering model. Can be \p opt::v::relaxed_ordering (relaxed memory model, the default)
110 or \p opt::v::sequential_consistent (sequentially consisnent memory model).
111 - \p opt::stat - internal statistics. By default, it is disabled (\p feldman_hashset::empty_stat).
112 To enable it use \p feldman_hashset::stat
113 - \p opt::rcu_check_deadlock - a deadlock checking policy for \ref cds_intrusive_FeldmanHashSet_rcu "RCU-based FeldmanHashSet"
114 Default is \p opt::v::rcu_throw_deadlock
116 template <typename... Options>
119 # ifdef CDS_DOXYGEN_INVOKED
120 typedef implementation_defined type ; ///< Metafunction result
122 typedef typename cds::opt::make_options<
123 typename cds::opt::find_type_traits< traits, Options... >::type
128 } // namespace feldman_hashset
131 // Forward declaration
132 template < class GC, typename T, class Traits = cds::container::feldman_hashset::traits >
133 class FeldmanHashSet;
139 template <typename GC, typename T, typename Traits>
140 struct make_feldman_hashset
143 typedef T value_type;
144 typedef Traits original_traits;
146 typedef cds::details::Allocator< value_type, typename original_traits::allocator > cxx_node_allocator;
150 void operator()( value_type * p ) const
152 cxx_node_allocator().Delete( p );
156 struct intrusive_traits: public original_traits
158 typedef node_disposer disposer;
161 // Metafunction result
162 typedef cds::intrusive::FeldmanHashSet< GC, T, intrusive_traits > type;
164 } // namespace details
167 }} // namespace cds::container
169 #endif // #ifndef CDSLIB_CONTAINER_DETAILS_FELDMAN_HASHSET_BASE_H