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 level statistics
33 typedef cds::intrusive::feldman_hashset::level_statistics level_statistics;
35 /// \p FeldmanHashSet traits
38 /// Mandatory functor to get hash value from data node
40 @copydetails cds::intrusive::feldman_hashset::traits::hash_accessor
42 typedef cds::opt::none hash_accessor;
44 /// Hash comparing functor
46 @copydetails cds::intrusive::feldman_hashset::traits::compare
48 typedef cds::opt::none compare;
50 /// Specifies binary predicate used for hash compare.
52 @copydetails cds::intrusive::feldman_hashset::traits::less
54 typedef cds::opt::none less;
58 @copydetails cds::intrusive::feldman_hashset::traits::item_counter
60 typedef cds::atomicity::item_counter item_counter;
64 Default is \ref CDS_DEFAULT_ALLOCATOR
66 typedef CDS_DEFAULT_ALLOCATOR allocator;
68 /// Array node allocator
70 @copydetails cds::intrusive::feldman_hashset::traits::node_allocator
72 typedef CDS_DEFAULT_ALLOCATOR node_allocator;
74 /// C++ memory ordering model
76 @copydetails cds::intrusive::feldman_hashset::traits::memory_model
78 typedef cds::opt::v::relaxed_ordering memory_model;
81 typedef cds::backoff::Default back_off;
83 /// Internal statistics
85 @copydetails cds::intrusive::feldman_hashset::traits::stat
87 typedef empty_stat stat;
89 /// RCU deadlock checking policy (only for \ref cds_container_FeldmanHashSet_rcu "RCU-based FeldmanHashSet")
91 @copydetails cds::intrusive::feldman_hashset::traits::rcu_check_deadlock
93 typedef cds::opt::v::rcu_throw_deadlock rcu_check_deadlock;
96 /// Metafunction converting option list to \p feldman_hashset::traits
98 Supported \p Options are:
99 - \p feldman_hashset::hash_accessor - mandatory option, hash accessor functor.
100 @copydetails traits::hash_accessor
101 - \p opt::allocator - item allocator
102 @copydetails traits::allocator
103 - \p opt::node_allocator - array node allocator.
104 @copydetails traits::node_allocator
105 - \p opt::compare - hash comparison functor. No default functor is provided.
106 If the option is not specified, the \p opt::less is used.
107 - \p opt::less - specifies binary predicate used for hash comparison.
108 @copydetails cds::container::feldman_hashset::traits::less
109 - \p opt::back_off - back-off strategy used. If the option is not specified, the \p cds::backoff::Default is used.
110 - \p opt::item_counter - the type of item counting feature.
111 @copydetails cds::intrusive::feldman_hashset::traits::item_counter
112 - \p opt::memory_model - C++ memory ordering model. Can be \p opt::v::relaxed_ordering (relaxed memory model, the default)
113 or \p opt::v::sequential_consistent (sequentially consisnent memory model).
114 - \p opt::stat - internal statistics. By default, it is disabled (\p feldman_hashset::empty_stat).
115 To enable it use \p feldman_hashset::stat
116 - \p opt::rcu_check_deadlock - a deadlock checking policy for \ref cds_intrusive_FeldmanHashSet_rcu "RCU-based FeldmanHashSet"
117 Default is \p opt::v::rcu_throw_deadlock
119 template <typename... Options>
122 # ifdef CDS_DOXYGEN_INVOKED
123 typedef implementation_defined type ; ///< Metafunction result
125 typedef typename cds::opt::make_options<
126 typename cds::opt::find_type_traits< traits, Options... >::type
131 } // namespace feldman_hashset
134 // Forward declaration
135 template < class GC, typename T, class Traits = cds::container::feldman_hashset::traits >
136 class FeldmanHashSet;
142 template <typename GC, typename T, typename Traits>
143 struct make_feldman_hashset
146 typedef T value_type;
147 typedef Traits original_traits;
149 typedef cds::details::Allocator< value_type, typename original_traits::allocator > cxx_node_allocator;
153 void operator()( value_type * p ) const
155 cxx_node_allocator().Delete( p );
159 struct intrusive_traits: public original_traits
161 typedef node_disposer disposer;
164 // Metafunction result
165 typedef cds::intrusive::FeldmanHashSet< GC, T, intrusive_traits > type;
167 } // namespace details
170 }} // namespace cds::container
172 #endif // #ifndef CDSLIB_CONTAINER_DETAILS_FELDMAN_HASHSET_BASE_H