MichaelSet refactoring
authorkhizmax <libcds.dev@gmail.com>
Sun, 26 Oct 2014 07:49:36 +0000 (10:49 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sun, 26 Oct 2014 07:49:36 +0000 (10:49 +0300)
25 files changed:
cds/container/details/michael_set_base.h
cds/container/michael_set.h
cds/container/michael_set_nogc.h
cds/container/michael_set_rcu.h
projects/Win/vc12/hdr-test-set.vcxproj
projects/Win/vc12/hdr-test-set.vcxproj.filters
tests/test-hdr/set/hdr_michael_set_dhp.cpp [new file with mode: 0644]
tests/test-hdr/set/hdr_michael_set_hp.cpp
tests/test-hdr/set/hdr_michael_set_lazy_dhp.cpp [new file with mode: 0644]
tests/test-hdr/set/hdr_michael_set_lazy_hp.cpp
tests/test-hdr/set/hdr_michael_set_lazy_nogc.cpp
tests/test-hdr/set/hdr_michael_set_lazy_ptb.cpp [deleted file]
tests/test-hdr/set/hdr_michael_set_lazy_rcu_gpb.cpp
tests/test-hdr/set/hdr_michael_set_lazy_rcu_gpi.cpp
tests/test-hdr/set/hdr_michael_set_lazy_rcu_gpt.cpp
tests/test-hdr/set/hdr_michael_set_lazy_rcu_shb.cpp
tests/test-hdr/set/hdr_michael_set_lazy_rcu_sht.cpp
tests/test-hdr/set/hdr_michael_set_nogc.cpp
tests/test-hdr/set/hdr_michael_set_ptb.cpp [deleted file]
tests/test-hdr/set/hdr_michael_set_rcu_gpb.cpp
tests/test-hdr/set/hdr_michael_set_rcu_gpi.cpp
tests/test-hdr/set/hdr_michael_set_rcu_gpt.cpp
tests/test-hdr/set/hdr_michael_set_rcu_shb.cpp
tests/test-hdr/set/hdr_michael_set_rcu_sht.cpp
tests/test-hdr/set/hdr_set.h

index 8eb808ba19fe8bf759d9379eb26052721cd2a333..662dc9784c87c3cfaaa47dac5e4bab549d6ac845 100644 (file)
@@ -12,30 +12,25 @@ namespace cds { namespace container {
     */
     namespace michael_set {
 
-        /// Type traits for MichaelHashSet class (typedef for cds::intrusive::michael_set::type_traits)
-        typedef intrusive::michael_set::type_traits  type_traits;
+        /// MichaelHashSet traits
+        typedef cds::intrusive::michael_set::traits  traits;
 
-        /// Metafunction converting option list to traits struct
-        /**
-            This is a synonym for intrusive::michael_set::make_traits
-        */
+        /// Metafunction converting option list to \p MichaelHashSet traits
         template <typename... Options>
-        struct make_traits {
-            typedef typename intrusive::michael_set::make_traits<Options...>::type type  ;   ///< Result of metafunction
-        };
+        using make_traits = cds::intrusive::michael_set::make_traits< Options... >;
 
         //@cond
         namespace details {
-            using intrusive::michael_set::details::init_hash_bitmask;
-            using intrusive::michael_set::details::list_iterator_selector;
-            using intrusive::michael_set::details::iterator;
+            using cds::intrusive::michael_set::details::init_hash_bitmask;
+            using cds::intrusive::michael_set::details::list_iterator_selector;
+            using cds::intrusive::michael_set::details::iterator;
         }
         //@endcond
     }
 
     //@cond
     // Forward declarations
-    template <class GC, class OrderedList, class Traits = michael_set::type_traits>
+    template <class GC, class OrderedList, class Traits = michael_set::traits>
     class MichaelHashSet;
     //@endcond
 
index 0fe47dca61b46d27acdc5df0a1f5e881101c7184..76e801e9465e6b2991469b23c1b5f6a25ea6dcc3 100644 (file)
@@ -23,18 +23,12 @@ namespace cds { namespace container {
         Template parameters are:
         - \p GC - Garbage collector used. You may use any \ref cds_garbage_collector "Garbage collector"
             from the \p libcds library.
-            Note the \p GC must be the same as the GC used for \p OrderedList
-        - \p OrderedList - ordered list implementation used as bucket for hash set, for example, MichaelList.
-            The ordered list implementation specifies the type \p T stored in the hash-set, the reclamation
-            schema \p GC used by hash-set, the comparison functor for the type \p T and other features specific for
-            the ordered list.
-        - \p Traits - type traits. See michael_set::type_traits for explanation.
-
-        Instead of defining \p Traits struct you may use option-based syntax with michael_set::make_traits metafunction.
-        For michael_set::make_traits the following option may be used:
-        - opt::hash - mandatory option, specifies hash functor.
-        - opt::item_counter - optional, specifies item counting policy. See michael_set::type_traits for explanation.
-        - opt::allocator - optional, bucket table allocator. Default is \ref CDS_DEFAULT_ALLOCATOR.
+            Note the \p GC must be the same as the \p GC used for \p OrderedList
+        - \p OrderedList - ordered list implementation used as bucket for hash set, for example, \p MichaelList.
+            The ordered list implementation specifies the type \p T to be stored in the hash-set,
+            the comparing functor for the type \p T and other features specific for the ordered list.
+        - \p Traits - set traits, default is \p michael_set::traits.
+            Instead of defining \p Traits struct you may use option-based syntax with \p michael_set::make_traits metafunction.
 
         There are the specializations:
         - for \ref cds_urcu_desc "RCU" - declared in <tt>cd/container/michael_set_rcu.h</tt>,
@@ -49,7 +43,7 @@ namespace cds { namespace container {
         It is expected that type \p Q contains full key of node type \p value_type, and if keys of type \p Q and \p value_type
         are equal the hash values of these keys must be equal too.
 
-        The hash functor <tt>Traits::hash</tt> should accept parameters of both type:
+        The hash functor \p Traits::hash should accept parameters of both type:
         \code
         // Our node type
         struct Foo {
@@ -79,13 +73,13 @@ namespace cds { namespace container {
         so, the element cannot be reclaimed while the iterator object is alive.
         However, passing an iterator object between threads is dangerous.
 
-        \warning Due to concurrent nature of Michael's set it is not guarantee that you can iterate
+        @warning Due to concurrent nature of Michael's set it is not guarantee that you can iterate
         all elements in the set: any concurrent deletion can exclude the element
         pointed by the iterator from the set, and your iteration can be terminated
         before end of the set. Therefore, such iteration is more suitable for debugging purpose only
 
         Remember, each iterator object requires an additional hazard pointer, that may be
-        a limited resource for \p GC like \p gc::HP (for gc::PTB the count of
+        a limited resource for \p GC like \p gc::HP (for \p gc::DHP the total count of
         guards is unlimited).
 
         The iterator class supports the following minimalistic interface:
@@ -114,7 +108,7 @@ namespace cds { namespace container {
 
         <b>How to use</b>
 
-        Suppose, we have the following type \p Foo that we want to store in our MichaelHashSet:
+        Suppose, we have the following type \p Foo that we want to store in our \p %MichaelHashSet:
         \code
         struct Foo {
             int     nKey    ;   // key field
@@ -123,8 +117,8 @@ namespace cds { namespace container {
         \endcode
 
         To use \p %MichaelHashSet for \p Foo values, you should first choose suitable ordered list class
-        that will be used as a bucket for the set. We will use gc::PTB reclamation schema and
-        MichaelList as a bucket type. Also, for ordered list we should develop a comparator for our \p Foo
+        that will be used as a bucket for the set. We will use \p gc::DHP reclamation schema and
+        \p MichaelList as a bucket type. Also, for ordered list we should develop a comparator for our \p Foo
         struct.
         \code
         #include <cds/container/michael_list_dhp.h>
@@ -143,7 +137,7 @@ namespace cds { namespace container {
         };
 
         // Our ordered list
-        typedef cc::MichaelList< cds::gc::PTB, Foo,
+        typedef cc::MichaelList< cds::gc::DHP, Foo,
             typename cc::michael_list::make_traits<
                 cc::opt::compare< Foo_cmp >     // item comparator option
             >::type
@@ -163,7 +157,7 @@ namespace cds { namespace container {
 
         // Declare set type.
         // Note that \p GC template parameter of ordered list must be equal \p GC for the set.
-        typedef cc::MichaelHashSet< cds::gc::PTB, bucket_list,
+        typedef cc::MichaelHashSet< cds::gc::DHP, bucket_list,
             cc::michael_set::make_traits<
                 cc::opt::hash< foo_hash >
             >::type
@@ -177,7 +171,7 @@ namespace cds { namespace container {
         class GC,
         class OrderedList,
 #ifdef CDS_DOXYGEN_INVOKED
-        class Traits = michael_set::type_traits
+        class Traits = michael_set::traits
 #else
         class Traits
 #endif
@@ -185,27 +179,26 @@ namespace cds { namespace container {
     class MichaelHashSet
     {
     public:
-        typedef OrderedList bucket_type     ;   ///< type of ordered list used as a bucket implementation
-        typedef Traits      options         ;   ///< Traits template parameters
+        typedef GC          gc;          ///< Garbage collector
+        typedef OrderedList bucket_type; ///< type of ordered list used as a bucket implementation
+        typedef Traits      traits;      ///< Set traits
 
-        typedef typename bucket_type::value_type        value_type      ;   ///< type of value stored in the list
-        typedef GC                                      gc              ;   ///< Garbage collector
-        typedef typename bucket_type::key_comparator    key_comparator  ;   ///< key comparison functor
+        typedef typename bucket_type::value_type     value_type;     ///< type of value to be stored in the list
+        typedef typename bucket_type::key_comparator key_comparator; ///< key comparison functor
 
         /// Hash functor for \ref value_type and all its derivatives that you use
-        typedef typename cds::opt::v::hash_selector< typename options::hash >::type   hash;
-        typedef typename options::item_counter          item_counter    ;   ///< Item counter type
+        typedef typename cds::opt::v::hash_selector< typename traits::hash >::type hash;
+        typedef typename traits::item_counter item_counter; ///< Item counter type
 
         /// Bucket table allocator
-        typedef cds::details::Allocator< bucket_type, typename options::allocator >  bucket_table_allocator;
+        typedef cds::details::Allocator< bucket_type, typename traits::allocator >  bucket_table_allocator;
 
-        typedef typename bucket_type::guarded_ptr      guarded_ptr; ///< Guarded pointer
+        typedef typename bucket_type::guarded_ptr  guarded_ptr; ///< Guarded pointer
 
     protected:
-        item_counter    m_ItemCounter   ;   ///< Item counter
-        hash            m_HashFunctor   ;   ///< Hash functor
-
-        bucket_type *   m_Buckets       ;   ///< bucket table
+        item_counter    m_ItemCounter; ///< Item counter
+        hash            m_HashFunctor; ///< Hash functor
+        bucket_type *   m_Buckets;     ///< bucket table
 
     private:
         //@cond
@@ -213,6 +206,7 @@ namespace cds { namespace container {
         //@endcond
 
     protected:
+        //@cond
         /// Calculates hash value of \p key
         template <typename Q>
         size_t hash_value( Q const& key ) const
@@ -226,6 +220,7 @@ namespace cds { namespace container {
         {
             return m_Buckets[ hash_value( key ) ];
         }
+        //@endcond
 
     public:
         /// Forward iterator
@@ -292,14 +287,13 @@ namespace cds { namespace container {
 
     public:
         /// Initialize hash set
-        /**
+        /** @anchor cds_nonintrusive_MichaelHashSet_hp_ctor
             The Michael's hash set is non-expandable container. You should point the average count of items \p nMaxItemCount
             when you create an object.
             \p nLoadFactor parameter defines average count of items per bucket and it should be small number between 1 and 10.
             Remember, since the bucket implementation is an ordered list, searching in the bucket is linear [<tt>O(nLoadFactor)</tt>].
-            Note, that many popular STL hash map implementation uses load factor 1.
 
-            The ctor defines hash table size as rounding <tt>nMacItemCount / nLoadFactor</tt> up to nearest power of two.
+            The ctor defines hash table size as rounding <tt>nMaxItemCount / nLoadFactor</tt> up to nearest power of two.
         */
         MichaelHashSet(
             size_t nMaxItemCount,   ///< estimation of max item count in the hash set
@@ -307,15 +301,16 @@ namespace cds { namespace container {
         ) : m_nHashBitmask( michael_set::details::init_hash_bitmask( nMaxItemCount, nLoadFactor ))
         {
             // GC and OrderedList::gc must be the same
-            static_assert(( std::is_same<gc, typename bucket_type::gc>::value ), "GC and OrderedList::gc must be the same");
+            static_assert( std::is_same<gc, typename bucket_type::gc>::value, "GC and OrderedList::gc must be the same");
 
             // atomicity::empty_item_counter is not allowed as a item counter
-            static_assert(( !std::is_same<item_counter, atomicity::empty_item_counter>::value ), "atomicity::empty_item_counter is not allowed as a item counter");
+            static_assert( !std::is_same<item_counter, atomicity::empty_item_counter>::value, 
+                           "cds::atomicity::empty_item_counter is not allowed as a item counter");
 
             m_Buckets = bucket_table_allocator().NewArray( bucket_count() );
         }
 
-        /// Clear hash set and destroy it
+        /// Clears hash set and destroys it
         ~MichaelHashSet()
         {
             clear();
@@ -353,10 +348,12 @@ namespace cds { namespace container {
             \code
                 void func( value_type& val );
             \endcode
-            where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
-            \p val no any other changes could be made on this set's item by concurrent threads.
-            The user-defined functor is called only if the inserting is success. It may be passed by reference
-            using \p std::ref
+            where \p val is the item inserted.
+            The user-defined functor is called only if the inserting is success. 
+
+            @warning For \ref cds_nonintrusive_MichaelList_gc "MichaelList" as the bucket see \ref cds_intrusive_item_creating "insert item troubleshooting".
+            \ref cds_nonintrusive_LazyList_gc "LazyList" provides exclusive access to inserted item and does not require any node-level
+            synchronization.
         */
         template <typename Q, typename Func>
         bool insert( Q const& val, Func f )
@@ -373,11 +370,7 @@ namespace cds { namespace container {
 
             If the \p val key not found in the set, then the new item created from \p val
             is inserted into the set. Otherwise, the functor \p func is called with the item found.
-            The functor \p Func should be a function with signature:
-            \code
-                void func( bool bNew, value_type& item, const Q& val );
-            \endcode
-            or a functor:
+            The functor \p Func signature is:
             \code
                 struct my_functor {
                     void operator()( bool bNew, value_type& item, const Q& val );
@@ -389,15 +382,16 @@ namespace cds { namespace container {
             - \p item - item of the set
             - \p val - argument \p key passed into the \p ensure function
 
-            The functor may change non-key fields of the \p item; however, \p func must guarantee
-            that during changing no any other modifications could be made on this item by concurrent threads.
-
-            You may pass \p func argument by reference using \p std::ref
+            The functor may change non-key fields of the \p item.
 
             Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
             \p second is true if new item has been added or \p false if the item with \p key
             already is in the set.
-        */
+
+            @warning For \ref cds_nonintrusive_MichaelList_gc "MichaelList" as the bucket see \ref cds_intrusive_item_creating "insert item troubleshooting".
+            \ref cds_nonintrusive_LazyList_gc "LazyList" provides exclusive access to inserted item and does not require any node-level
+            synchronization.
+            */
         template <typename Q, typename Func>
         std::pair<bool, bool> ensure( const Q& val, Func func )
         {
@@ -407,7 +401,7 @@ namespace cds { namespace container {
             return bRet;
         }
 
-        /// Inserts data of type \ref value_type constructed with <tt>std::forward<Args>(args)...</tt>
+        /// Inserts data of type \p value_type constructed from \p args
         /**
             Returns \p true if inserting successful, \p false otherwise.
         */
@@ -464,10 +458,10 @@ namespace cds { namespace container {
             The functor \p Func interface:
             \code
             struct extractor {
-                void operator()(value_type const& val);
+                void operator()(value_type& item);
             };
             \endcode
-            The functor may be passed by reference using <tt>boost:ref</tt>
+            where \p item - the item found.
 
             Since the key of %MichaelHashSet's \p value_type is not explicitly specified,
             template parameter \p Q defines the key type searching in the list.
@@ -554,17 +548,17 @@ namespace cds { namespace container {
             return bRet;
         }
 
-        /// Finds the key \p val
+        /// Finds the key \p key
         /** \anchor cds_nonintrusive_MichaelSet_find_func
 
-            The function searches the item with key equal to \p val and calls the functor \p f for item found.
+            The function searches the item with key equal to \p key and calls the functor \p f for item found.
             The interface of \p Func functor is:
             \code
             struct functor {
-                void operator()( value_type& item, Q& val );
+                void operator()( value_type& item, Q& key );
             };
             \endcode
-            where \p item is the item found, \p val is the <tt>find</tt> function argument.
+            where \p item is the item found, \p key is the <tt>find</tt> function argument.
 
             You may pass \p f argument by reference using \p std::ref.
 
@@ -573,21 +567,21 @@ namespace cds { namespace container {
             The functor does not serialize simultaneous access to the set's \p item. If such access is
             possible you must provide your own synchronization schema on item level to exclude unsafe item modifications.
 
-            The \p val argument is non-const since it can be used as \p f functor destination i.e., the functor
+            The \p key argument is non-const since it can be used as \p f functor destination i.e., the functor
             can modify both arguments.
 
             Note the hash functor specified for class \p Traits template parameter
             should accept a parameter of type \p Q that may be not the same as \p value_type.
 
-            The function returns \p true if \p val is found, \p false otherwise.
+            The function returns \p true if \p key is found, \p false otherwise.
         */
         template <typename Q, typename Func>
-        bool find( Q& val, Func f )
+        bool find( Q& key, Func f )
         {
-            return bucket( val ).find( val, f );
+            return bucket( key ).find( key, f );
         }
 
-        /// Finds the key \p val using \p pred predicate for searching
+        /// Finds the key \p key using \p pred predicate for searching
         /**
             The function is an analog of \ref cds_nonintrusive_MichaelSet_find_func "find(Q&, Func)"
             but \p pred is used for key comparing.
@@ -595,69 +589,26 @@ namespace cds { namespace container {
             \p Less must imply the same element order as the comparator used for building the set.
         */
         template <typename Q, typename Less, typename Func>
-        bool find_with( Q& val, Less pred, Func f )
-        {
-            return bucket( val ).find_with( val, pred, f );
-        }
-
-        /// Finds the key \p val
-        /** \anchor cds_nonintrusive_MichaelSet_find_cfunc
-
-            The function searches the item with key equal to \p val and calls the functor \p f for item found.
-            The interface of \p Func functor is:
-            \code
-            struct functor {
-                void operator()( value_type& item, Q const& val );
-            };
-            \endcode
-            where \p item is the item found, \p val is the <tt>find</tt> function argument.
-
-            You may pass \p f argument by reference using \p std::ref.
-
-            The functor may change non-key fields of \p item. Note that the functor is only guarantee
-            that \p item cannot be disposed during functor is executing.
-            The functor does not serialize simultaneous access to the set's \p item. If such access is
-            possible you must provide your own synchronization schema on item level to exclude unsafe item modifications.
-
-            Note the hash functor specified for class \p Traits template parameter
-            should accept a parameter of type \p Q that may be not the same as \p value_type.
-
-            The function returns \p true if \p val is found, \p false otherwise.
-        */
-        template <typename Q, typename Func>
-        bool find( Q const& val, Func f )
-        {
-            return bucket( val ).find( val, f );
-        }
-
-        /// Finds the key \p val using \p pred predicate for searching
-        /**
-            The function is an analog of \ref cds_nonintrusive_MichaelSet_find_cfunc "find(Q const&, Func)"
-            but \p pred is used for key comparing.
-            \p Less functor has the interface like \p std::less.
-            \p Less must imply the same element order as the comparator used for building the set.
-        */
-        template <typename Q, typename Less, typename Func>
-        bool find_with( Q const& val, Less pred, Func f )
+        bool find_with( Q& key, Less pred, Func f )
         {
-            return bucket( val ).find_with( val, pred, f );
+            return bucket( key ).find_with( key, pred, f );
         }
 
-        /// Finds the key \p val
+        /// Finds the key \p key
         /** \anchor cds_nonintrusive_MichaelSet_find_val
-            The function searches the item with key equal to \p val
+            The function searches the item with key equal to \p key
             and returns \p true if it is found, and \p false otherwise.
 
             Note the hash functor specified for class \p Traits template parameter
             should accept a parameter of type \p Q that may be not the same as \ref value_type.
         */
         template <typename Q>
-        bool find( Q const& val )
+        bool find( Q const& key )
         {
-            return bucket( val ).find( val );
+            return bucket( key ).find( key );
         }
 
-        /// Finds the key \p val using \p pred predicate for searching
+        /// Finds the key \p key using \p pred predicate for searching
         /**
             The function is an analog of \ref cds_nonintrusive_MichaelSet_find_val "find(Q const&)"
             but \p pred is used for key comparing.
@@ -665,17 +616,17 @@ namespace cds { namespace container {
             \p Less must imply the same element order as the comparator used for building the set.
         */
         template <typename Q, typename Less>
-        bool find_with( Q const& val, Less pred )
+        bool find_with( Q const& key, Less pred )
         {
-            return bucket( val ).find_with( val, pred );
+            return bucket( key ).find_with( key, pred );
         }
 
-        /// Finds the key \p val and return the item found
+        /// Finds the key \p key and return the item found
         /** \anchor cds_nonintrusive_MichaelHashSet_hp_get
-            The function searches the item with key equal to \p val
+            The function searches the item with key equal to \p key
             and assigns the item found to guarded pointer \p ptr.
-            The function returns \p true if \p val is found, and \p false otherwise.
-            If \p val is not found the \p ptr parameter is not changed.
+            The function returns \p true if \p key is found, and \p false otherwise.
+            If \p key is not found the \p ptr parameter is not changed.
 
             @note Each \p guarded_ptr object uses one GC's guard which can be limited resource.
 
@@ -698,12 +649,12 @@ namespace cds { namespace container {
             should accept a parameter of type \p Q that can be not the same as \p value_type.
         */
         template <typename Q>
-        bool get( guarded_ptr& ptr, Q const& val )
+        bool get( guarded_ptr& ptr, Q const& key )
         {
-            return bucket( val ).get( ptr, val );
+            return bucket( key ).get( ptr, key );
         }
 
-        /// Finds the key \p val and return the item found
+        /// Finds the key \p key and return the item found
         /**
             The function is an analog of \ref cds_nonintrusive_MichaelHashSet_hp_get "get( guarded_ptr& ptr, Q const&)"
             but \p pred is used for comparing the keys.
@@ -713,9 +664,9 @@ namespace cds { namespace container {
             \p pred must imply the same element order as the comparator used for building the set.
         */
         template <typename Q, typename Less>
-        bool get_with( guarded_ptr& ptr, Q const& val, Less pred )
+        bool get_with( guarded_ptr& ptr, Q const& key, Less pred )
         {
-            return bucket( val ).get_with( ptr, val, pred );
+            return bucket( key ).get_with( ptr, key, pred );
         }
 
         /// Clears the set (non-atomic)
index 0f2412601aebe66a8473f185eb82d0413c352ee1..326c602eeeb00f4d036d909b21e1d4cdc7ca2a7b 100644 (file)
@@ -13,51 +13,48 @@ namespace cds { namespace container {
     /** @ingroup cds_nonintrusive_set
         \anchor cds_nonintrusive_MichaelHashSet_nogc
 
-        This specialization is intended for so-called persistent usage when no item
+        This specialization is so-called append-only when no item
         reclamation may be performed. The class does not support deleting of list item.
 
         See \ref cds_nonintrusive_MichaelHashSet_hp "MichaelHashSet" for description of template parameters.
-        The template parameter \p OrderedList should be any gc::nogc-derived ordered list, for example,
-        \ref cds_nonintrusive_MichaelList_nogc "persistent MichaelList".
-
-        The interface of the specialization is a slightly different.
+        The template parameter \p OrderedList should be any \p gc::nogc -derived ordered list, for example,
+        \ref cds_nonintrusive_MichaelList_nogc "append-only MichaelList".
     */
     template <
         class OrderedList,
 #ifdef CDS_DOXYGEN_INVOKED
-        class Traits = michael_set::type_traits
+        class Traits = michael_set::traits
 #else
         class Traits
 #endif
     >
-    class MichaelHashSet< gc::nogc, OrderedList, Traits >
+    class MichaelHashSet< cds::gc::nogc, OrderedList, Traits >
     {
     public:
-        typedef OrderedList bucket_type     ;   ///< type of ordered list used as a bucket implementation
-        typedef Traits      options         ;   ///< Traits template parameters
+        typedef cds::gc::nogc gc;        ///< Garbage collector
+        typedef OrderedList bucket_type; ///< type of ordered list to be used as a bucket implementation
+        typedef Traits      traits;      ///< Set traits
 
-        typedef typename bucket_type::value_type        value_type      ;   ///< type of value stored in the list
-        typedef gc::nogc                                gc              ;   ///< Garbage collector
-        typedef typename bucket_type::key_comparator    key_comparator  ;   ///< key comparison functor
+        typedef typename bucket_type::value_type        value_type;     ///< type of value stored in the list
+        typedef typename bucket_type::key_comparator    key_comparator; ///< key comparison functor
 
         /// Hash functor for \ref value_type and all its derivatives that you use
-        typedef typename cds::opt::v::hash_selector< typename options::hash >::type   hash;
-        typedef typename options::item_counter          item_counter    ;   ///< Item counter type
+        typedef typename cds::opt::v::hash_selector< typename traits::hash >::type hash;
+        typedef typename traits::item_counter  item_counter; ///< Item counter type
 
         /// Bucket table allocator
-        typedef cds::details::Allocator< bucket_type, typename options::allocator >  bucket_table_allocator;
+        typedef cds::details::Allocator< bucket_type, typename traits::allocator >  bucket_table_allocator;
 
     protected:
         //@cond
-        typedef typename bucket_type::iterator          bucket_iterator;
-        typedef typename bucket_type::const_iterator    bucket_const_iterator;
+        typedef typename bucket_type::iterator        bucket_iterator;
+        typedef typename bucket_type::const_iterator  bucket_const_iterator;
         //@endcond
 
     protected:
-        item_counter    m_ItemCounter   ;   ///< Item counter
-        hash            m_HashFunctor   ;   ///< Hash functor
-
-        bucket_type *   m_Buckets       ;   ///< bucket table
+        item_counter    m_ItemCounter;   ///< Item counter
+        hash            m_HashFunctor;   ///< Hash functor
+        bucket_type *   m_Buckets;       ///< bucket table
 
     private:
         //@cond
@@ -65,6 +62,7 @@ namespace cds { namespace container {
         //@endcond
 
     protected:
+        //@cond
         /// Calculates hash value of \p key
         template <typename Q>
         size_t hash_value( const Q& key ) const
@@ -78,6 +76,7 @@ namespace cds { namespace container {
         {
             return m_Buckets[ hash_value( key ) ];
         }
+        //@endcond
 
     public:
         /// Forward iterator
@@ -139,7 +138,7 @@ namespace cds { namespace container {
         //@}
 
     private:
-        //@{
+        //@cond
         const_iterator get_const_begin() const
         {
             return const_iterator( const_cast<bucket_type const&>(m_Buckets[0]).begin(), m_Buckets, m_Buckets + bucket_count() );
@@ -148,12 +147,11 @@ namespace cds { namespace container {
         {
             return const_iterator( const_cast<bucket_type const&>(m_Buckets[bucket_count() - 1]).end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count() );
         }
-        //@}
+        //@endcond
 
     public:
         /// Initialize hash set
-        /**
-            See \ref cds_nonintrusive_MichaelHashSet_hp "MichaelHashSet" ctor for explanation
+        /** @copydetails cds_nonintrusive_MichaelHashSet_hp_ctor
         */
         MichaelHashSet(
             size_t nMaxItemCount,   ///< estimation of max item count in the hash set
@@ -161,15 +159,16 @@ namespace cds { namespace container {
         ) : m_nHashBitmask( michael_set::details::init_hash_bitmask( nMaxItemCount, nLoadFactor ))
         {
             // GC and OrderedList::gc must be the same
-            static_assert(( std::is_same<gc, typename bucket_type::gc>::value ), "GC and OrderedList::gc must be the same");
+            static_assert( std::is_same<gc, typename bucket_type::gc>::value, "GC and OrderedList::gc must be the same");
 
             // atomicity::empty_item_counter is not allowed as a item counter
-            static_assert(( !std::is_same<item_counter, atomicity::empty_item_counter>::value ), "atomicity::empty_item_counter is not allowed as a item counter");
+            static_assert( !std::is_same<item_counter, atomicity::empty_item_counter>::value, 
+                           "cds::atomicity::empty_item_counter is not allowed as a item counter");
 
             m_Buckets = bucket_table_allocator().NewArray( bucket_count() );
         }
 
-        /// Clear hash set and destroy it
+        /// Clears hash set and destroys it
         ~MichaelHashSet()
         {
             clear();
@@ -220,9 +219,13 @@ namespace cds { namespace container {
             The operation inserts new item if the key \p val is not found in the set.
             Otherwise, the function returns an iterator that points to item found.
 
-            Returns <tt> std::pair<iterator, bool>  </tt> where \p first is an iterator pointing to
+            Returns <tt> std::pair<iterator, bool> </tt> where \p first is an iterator pointing to
             item found or inserted, \p second is true if new item has been added or \p false if the item
             already is in the set.
+
+            @warning For \ref cds_nonintrusive_MichaelList_nogc "MichaelList" as the bucket see \ref cds_intrusive_item_creating "insert item troubleshooting".
+            \ref cds_nonintrusive_LazyList_nogc "LazyList" provides exclusive access to inserted item and does not require any node-level
+            synchronization.
         */
         template <typename Q>
         std::pair<iterator, bool> ensure( const Q& val )
@@ -274,15 +277,7 @@ namespace cds { namespace container {
             return end();
         }
 
-
-        /// Clears the set (non-atomic, not thread-safe)
-        /**
-            The function deletes all items from the set.
-            The function is not atomic and even not thread-safe.
-            It cleans up each bucket and then resets the item counter to zero.
-            If there are a thread that performs insertion while \p clear is working the result is undefined in general case:
-            <tt> empty() </tt> may return \p true but the set may contain item(s).
-        */
+        /// Clears the set (not atomic)
         void clear()
         {
             for ( size_t i = 0; i < bucket_count(); ++i )
@@ -290,10 +285,9 @@ namespace cds { namespace container {
             m_ItemCounter.reset();
         }
 
-
         /// Checks if the set is empty
         /**
-            Emptiness is checked by item counting: if item count is zero then the set is empty.
+            The emptiness is checked by the item counting: if item count is zero then the set is empty.
             Thus, the correct item counting feature is an important part of Michael's set implementation.
         */
         bool empty() const
@@ -309,7 +303,7 @@ namespace cds { namespace container {
 
         /// Returns the size of hash table
         /**
-            Since MichaelHashSet cannot dynamically extend the hash table size,
+            Since \p %MichaelHashSet cannot dynamically extend the hash table size,
             the value returned is an constant depending on object initialization parameters;
             see MichaelHashSet::MichaelHashSet for explanation.
         */
index 8f9446d10eb53257df13b7d37b62c39471ee6f17..95ee8fd8157fb682a263c6c5f45fa0efdeb01a63 100644 (file)
@@ -22,23 +22,19 @@ namespace cds { namespace container {
 
         Template parameters are:
         - \p RCU - one of \ref cds_urcu_gc "RCU type"
-        - \p OrderedList - ordered list implementation used as bucket for hash set, for example, MichaelList.
+        - \p OrderedList - ordered list implementation used as the bucket for hash set, for example, 
+            \ref cds_nonintrusive_MichaelList_rcu "MichaelList".
             The ordered list implementation specifies the type \p T stored in the hash-set,
             the comparison functor for the type \p T and other features specific for
             the ordered list.
-        - \p Traits - type traits. See michael_set::type_traits for explanation.
+        - \p Traits - set traits, default is michael_set::traits.
+            Instead of defining \p Traits struct you may use option-based syntax with michael_set::make_traits metafunction.
 
-        Instead of defining \p Traits struct you may use option-based syntax with michael_set::make_traits metafunction.
-        For michael_set::make_traits the following option may be used:
-        - opt::hash - mandatory option, specifies hash functor.
-        - opt::item_counter - optional, specifies item counting policy. See michael_set::type_traits for explanation.
-        - opt::allocator - optional, bucket table allocator. Default is \ref CDS_DEFAULT_ALLOCATOR.
-
-        \note About hash functor see \ref cds_nonintrusive_MichaelHashSet_hash_functor "MichaelSet".
+        About hash functor see \ref cds_nonintrusive_MichaelHashSet_hash_functor "MichaelSet hash functor".
 
         <b>How to use</b>
 
-        Suppose, we have the following type \p Foo that we want to store in our MichaelHashSet:
+        Suppose, we have the following type \p Foo that we want to store in your \p %MichaelHashSet:
         \code
         struct Foo {
             int     nKey    ;   // key field
@@ -69,7 +65,7 @@ namespace cds { namespace container {
             }
         };
 
-        // Our ordered list
+        // Ordered list
         typedef cc::MichaelList< cds::urcu::gc< cds::urcu::general_buffered<> >, Foo,
             typename cc::michael_list::make_traits<
                 cc::opt::compare< Foo_cmp >     // item comparator option
@@ -88,7 +84,7 @@ namespace cds { namespace container {
             }
         };
 
-        // Declare set type.
+        // Declare the set
         // Note that \p RCU template parameter of ordered list must be equal \p RCU for the set.
         typedef cc::MichaelHashSet< cds::urcu::gc< cds::urcu::general_buffered<> >, bucket_list,
             cc::michael_set::make_traits<
@@ -96,7 +92,6 @@ namespace cds { namespace container {
             >::type
         > foo_set;
 
-        // Set variable
         foo_set fooSet;
         \endcode
     */
@@ -104,7 +99,7 @@ namespace cds { namespace container {
         class RCU,
         class OrderedList,
 #ifdef CDS_DOXYGEN_INVOKED
-        class Traits = michael_set::type_traits
+        class Traits = michael_set::traits
 #else
         class Traits
 #endif
@@ -112,30 +107,29 @@ namespace cds { namespace container {
     class MichaelHashSet< cds::urcu::gc< RCU >, OrderedList, Traits >
     {
     public:
-        typedef OrderedList bucket_type     ;   ///< type of ordered list used as a bucket implementation
-        typedef Traits      options         ;   ///< Traits template parameters
+        typedef cds::urcu::gc< RCU > gc; ///< RCU used as garbage collector
+        typedef OrderedList bucket_type; ///< type of ordered list to be used as a bucket implementation
+        typedef Traits      traits;      ///< Set traits
 
-        typedef typename bucket_type::value_type        value_type      ;   ///< type of value stored in the list
-        typedef cds::urcu::gc< RCU >                    gc              ;   ///< RCU used as garbage collector
-        typedef typename bucket_type::key_comparator    key_comparator  ;   ///< key comparing functor
+        typedef typename bucket_type::value_type        value_type;     ///< type of value to be stored in the list
+        typedef typename bucket_type::key_comparator    key_comparator; ///< key comparing functor
 
         /// Hash functor for \ref value_type and all its derivatives that you use
-        typedef typename cds::opt::v::hash_selector< typename options::hash >::type   hash;
-        typedef typename options::item_counter          item_counter    ;   ///< Item counter type
+        typedef typename cds::opt::v::hash_selector< typename traits::hash >::type hash;
+        typedef typename traits::item_counter item_counter;   ///< Item counter type
 
         /// Bucket table allocator
-        typedef cds::details::Allocator< bucket_type, typename options::allocator >  bucket_table_allocator;
+        typedef cds::details::Allocator< bucket_type, typename traits::allocator >  bucket_table_allocator;
 
-        typedef typename bucket_type::rcu_lock      rcu_lock   ; ///< RCU scoped lock
-        typedef typename bucket_type::exempt_ptr    exempt_ptr ; ///< pointer to extracted node
+        typedef typename bucket_type::rcu_lock   rcu_lock;   ///< RCU scoped lock
+        typedef typename bucket_type::exempt_ptr exempt_ptr; ///< pointer to extracted node
         /// Group of \p extract_xxx functions require external locking if underlying ordered list requires that
         static CDS_CONSTEXPR const bool c_bExtractLockExternal = bucket_type::c_bExtractLockExternal;
 
     protected:
-        item_counter    m_ItemCounter   ;   ///< Item counter
-        hash            m_HashFunctor   ;   ///< Hash functor
-
-        bucket_type *   m_Buckets       ;   ///< bucket table
+        item_counter    m_ItemCounter; ///< Item counter
+        hash            m_HashFunctor; ///< Hash functor
+        bucket_type *   m_Buckets;     ///< bucket table
 
     private:
         //@cond
@@ -143,6 +137,7 @@ namespace cds { namespace container {
         //@endcond
 
     protected:
+        //@cond
         /// Calculates hash value of \p key
         template <typename Q>
         size_t hash_value( Q const& key ) const
@@ -151,7 +146,6 @@ namespace cds { namespace container {
         }
 
         /// Returns the bucket (ordered list) for \p key
-        //@{
         template <typename Q>
         bucket_type&    bucket( Q const& key )
         {
@@ -162,7 +156,7 @@ namespace cds { namespace container {
         {
             return m_Buckets[ hash_value( key ) ];
         }
-        //@}
+        //@endcond
     public:
         /// Forward iterator
         /**
@@ -239,14 +233,7 @@ namespace cds { namespace container {
 
     public:
         /// Initialize hash set
-        /**
-            The Michael's hash set is non-expandable container. You should point the average count of items \p nMaxItemCount
-            when you create an object.
-            \p nLoadFactor parameter defines average count of items per bucket and it should be small number between 1 and 10.
-            Remember, since the bucket implementation is an ordered list, searching in the bucket is linear [<tt>O(nLoadFactor)</tt>].
-            Note, that many popular STL hash map implementation uses load factor 1.
-
-            The ctor defines hash table size as rounding <tt>nMacItemCount / nLoadFactor</tt> up to nearest power of two.
+        /** @copydetails cds_nonintrusive_MichaelHashSet_hp_ctor
         */
         MichaelHashSet(
             size_t nMaxItemCount,   ///< estimation of max item count in the hash set
@@ -254,15 +241,16 @@ namespace cds { namespace container {
         ) : m_nHashBitmask( michael_set::details::init_hash_bitmask( nMaxItemCount, nLoadFactor ))
         {
             // GC and OrderedList::gc must be the same
-            static_assert(( std::is_same<gc, typename bucket_type::gc>::value ), "GC and OrderedList::gc must be the same");
+            static_assert( std::is_same<gc, typename bucket_type::gc>::value, "GC and OrderedList::gc must be the same");
 
             // atomicity::empty_item_counter is not allowed as a item counter
-            static_assert(( !std::is_same<item_counter, atomicity::empty_item_counter>::value ), "atomicity::empty_item_counter is not allowed as a item counter");
+            static_assert( !std::is_same<item_counter, atomicity::empty_item_counter>::value,
+                           "atomicity::empty_item_counter is not allowed as a item counter");
 
             m_Buckets = bucket_table_allocator().NewArray( bucket_count() );
         }
 
-        /// Clear hash set and destroy it
+        /// Clears hash set and destroys it
         ~MichaelHashSet()
         {
             clear();
@@ -302,13 +290,15 @@ namespace cds { namespace container {
             \code
                 void func( value_type& val );
             \endcode
-            where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
-            \p val no any other changes could be made on this set's item by concurrent threads.
-            The user-defined functor is called only if the inserting is success. It may be passed by reference
-            using \p std::ref
+            where \p val is the item inserted.
+            The user-defined functor is called only if the inserting is success.
 
             The function applies RCU lock internally.
-        */
+
+            @warning For \ref cds_nonintrusive_MichaelList_rcu "MichaelList" as the bucket see \ref cds_intrusive_item_creating "insert item troubleshooting".
+            \ref cds_nonintrusive_LazyList_rcu "LazyList" provides exclusive access to inserted item and does not require any node-level
+            synchronization.
+            */
         template <typename Q, typename Func>
         bool insert( Q const& val, Func f )
         {
@@ -324,11 +314,7 @@ namespace cds { namespace container {
 
             If the \p val key not found in the set, then the new item created from \p val
             is inserted into the set. Otherwise, the functor \p func is called with the item found.
-            The functor \p Func should be a function with signature:
-            \code
-                void func( bool bNew, value_type& item, const Q& val );
-            \endcode
-            or a functor:
+            The functor \p Func signature is:
             \code
                 struct my_functor {
                     void operator()( bool bNew, value_type& item, const Q& val );
@@ -340,16 +326,17 @@ namespace cds { namespace container {
             - \p item - item of the set
             - \p val - argument \p key passed into the \p ensure function
 
-            The functor may change non-key fields of the \p item; however, \p func must guarantee
-            that during changing no any other modifications could be made on this item by concurrent threads.
-
-            You may pass \p func argument by reference using \p std::ref
+            The functor may change non-key fields of the \p item.
 
             The function applies RCU lock internally.
 
             Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
             \p second is true if new item has been added or \p false if the item with \p key
             already is in the set.
+
+            @warning For \ref cds_nonintrusive_MichaelList_rcu "MichaelList" as the bucket see \ref cds_intrusive_item_creating "insert item troubleshooting".
+            \ref cds_nonintrusive_LazyList_rcu "LazyList" provides exclusive access to inserted item and does not require any node-level
+            synchronization.
         */
         template <typename Q, typename Func>
         std::pair<bool, bool> ensure( const Q& val, Func func )
@@ -360,7 +347,7 @@ namespace cds { namespace container {
             return bRet;
         }
 
-        /// Inserts data of type \ref value_type constructed with <tt>std::forward<Args>(args)...</tt>
+        /// Inserts data of type \p value_type created from \p args
         /**
             Returns \p true if inserting successful, \p false otherwise.
 
@@ -378,7 +365,7 @@ namespace cds { namespace container {
         /// Deletes \p key from the set
         /** \anchor cds_nonintrusive_MichealSet_rcu_erase_val
 
-            Since the key of MichaelHashSet's item type \ref value_type is not explicitly specified,
+            Since the key of MichaelHashSet's item type \p value_type is not explicitly specified,
             template parameter \p Q defines the key type searching in the list.
             The set item comparator should be able to compare the type \p value_type
             and the type \p Q.
@@ -424,7 +411,6 @@ namespace cds { namespace container {
                 void operator()(value_type const& val);
             };
             \endcode
-            The functor may be passed by reference using <tt>boost:ref</tt>
 
             Since the key of %MichaelHashSet's \p value_type is not explicitly specified,
             template parameter \p Q defines the key type searching in the list.
@@ -462,9 +448,9 @@ namespace cds { namespace container {
 
         /// Extracts an item from the set
         /** \anchor cds_nonintrusive_MichaelHashSet_rcu_extract
-            The function searches an item with key equal to \p val in the set,
+            The function searches an item with key equal to \p key in the set,
             unlinks it from the set, places item pointer into \p dest argument, and returns \p true.
-            If the item with the key equal to \p val is not found the function return \p false.
+            If the item with the key equal to \p key is not found the function return \p false.
 
             @note The function does NOT call RCU read-side lock or synchronization,
             and does NOT dispose the item found. It just excludes the item from the set
@@ -503,9 +489,9 @@ namespace cds { namespace container {
             \endcode
         */
         template <typename Q>
-        bool extract( exempt_ptr& dest, Q const& val )
+        bool extract( exempt_ptr& dest, Q const& key )
         {
-            if ( bucket( val ).extract( dest, val )) {
+            if ( bucket( key ).extract( dest, key )) {
                 --m_ItemCounter;
                 return true;
             }
@@ -520,35 +506,33 @@ namespace cds { namespace container {
             \p pred must imply the same element order as the comparator used for building the set.
         */
         template <typename Q, typename Less>
-        bool extract_with( exempt_ptr& dest, Q const& val, Less pred )
+        bool extract_with( exempt_ptr& dest, Q const& key, Less pred )
         {
-            if ( bucket( val ).extract_with( dest, val, pred )) {
+            if ( bucket( key ).extract_with( dest, key, pred )) {
                 --m_ItemCounter;
                 return true;
             }
             return false;
         }
 
-        /// Finds the key \p val
+        /// Finds the key \p key
         /** \anchor cds_nonintrusive_MichealSet_rcu_find_func
 
-            The function searches the item with key equal to \p val and calls the functor \p f for item found.
+            The function searches the item with key equal to \p key and calls the functor \p f for item found.
             The interface of \p Func functor is:
             \code
             struct functor {
-                void operator()( value_type& item, Q& val );
+                void operator()( value_type& item, Q& key );
             };
             \endcode
-            where \p item is the item found, \p val is the <tt>find</tt> function argument.
-
-            You may pass \p f argument by reference using \p std::ref.
+            where \p item is the item found, \p key is the <tt>find</tt> function argument.
 
             The functor may change non-key fields of \p item. Note that the functor is only guarantee
             that \p item cannot be disposed during functor is executing.
             The functor does not serialize simultaneous access to the set's \p item. If such access is
             possible you must provide your own synchronization schema on item level to exclude unsafe item modifications.
 
-            The \p val argument is non-const since it can be used as \p f functor destination i.e., the functor
+            The \p key argument is non-const since it can be used as \p f functor destination i.e., the functor
             can modify both arguments.
 
             Note the hash functor specified for class \p Traits template parameter
@@ -556,15 +540,15 @@ namespace cds { namespace container {
 
             The function applies RCU lock internally.
 
-            The function returns \p true if \p val is found, \p false otherwise.
+            The function returns \p true if \p key is found, \p false otherwise.
         */
         template <typename Q, typename Func>
-        bool find( Q& val, Func f ) const
+        bool find( Q& key, Func f ) const
         {
-            return bucket( val ).find( val, f );
+            return bucket( key ).find( key, f );
         }
 
-        /// Finds the key \p val using \p pred predicate for searching
+        /// Finds the key \p key using \p pred predicate for searching
         /**
             The function is an analog of \ref cds_nonintrusive_MichealSet_rcu_find_func "find(Q&, Func)"
             but \p pred is used for key comparing.
@@ -572,72 +556,27 @@ namespace cds { namespace container {
             \p Less must imply the same element order as the comparator used for building the set.
         */
         template <typename Q, typename Less, typename Func>
-        bool find_with( Q& val, Less pred, Func f ) const
+        bool find_with( Q& key, Less pred, Func f ) const
         {
-            return bucket( val ).find_with( val, pred, f );
+            return bucket( key ).find_with( key, pred, f );
         }
 
-        /// Finds the key \p val
-        /** \anchor cds_nonintrusive_MichealSet_rcu_find_cfunc
-
-            The function searches the item with key equal to \p val and calls the functor \p f for item found.
-            The interface of \p Func functor is:
-            \code
-            struct functor {
-                void operator()( value_type& item, Q const& val );
-            };
-            \endcode
-            where \p item is the item found, \p val is the <tt>find</tt> function argument.
-
-            You may pass \p f argument by reference using \p std::ref.
-
-            The functor may change non-key fields of \p item. Note that the functor is only guarantee
-            that \p item cannot be disposed during functor is executing.
-            The functor does not serialize simultaneous access to the set's \p item. If such access is
-            possible you must provide your own synchronization schema on item level to exclude unsafe item modifications.
-
-            Note the hash functor specified for class \p Traits template parameter
-            should accept a parameter of type \p Q that may be not the same as \p value_type.
-
-            The function applies RCU lock internally.
-
-            The function returns \p true if \p val is found, \p false otherwise.
-        */
-        template <typename Q, typename Func>
-        bool find( Q const& val, Func f ) const
-        {
-            return bucket( val ).find( val, f );
-        }
-
-        /// Finds the key \p val using \p pred predicate for searching
-        /**
-            The function is an analog of \ref cds_nonintrusive_MichealSet_rcu_find_cfunc "find(Q const&, Func)"
-            but \p pred is used for key comparing.
-            \p Less functor has the interface like \p std::less.
-            \p Less must imply the same element order as the comparator used for building the set.
-        */
-        template <typename Q, typename Less, typename Func>
-        bool find_with( Q const& val, Less pred, Func f ) const
-        {
-            return bucket( val ).find_with( val, pred, f );
-        }
-
-        /// Finds the key \p val
+        /// Finds the key \p key
         /** \anchor cds_nonintrusive_MichealSet_rcu_find_val
 
-            The function searches the item with key equal to \p val
+            The function searches the item with key equal to \p key
             and returns \p true if it is found, and \p false otherwise.
 
             Note the hash functor specified for class \p Traits template parameter
-            should accept a parameter of type \p Q that may be not the same as \ref value_type.
+            should accept a parameter of type \p Q that may be not the same as \p value_type.
         */
         template <typename Q>
-        bool find( Q const & val ) const
+        bool find( Q const & key ) const
         {
-            return bucket( val ).find( val );
+            return bucket( key ).find( key );
         }
 
-        /// Finds the key \p val using \p pred predicate for searching
+        /// Finds the key \p key using \p pred predicate for searching
         /**
             The function is an analog of \ref cds_nonintrusive_MichealSet_rcu_find_val "find(Q const&)"
             but \p pred is used for key comparing.
@@ -645,15 +584,15 @@ namespace cds { namespace container {
             \p Less must imply the same element order as the comparator used for building the set.
         */
         template <typename Q, typename Less>
-        bool find_with( Q const & val, Less pred ) const
+        bool find_with( Q const & key, Less pred ) const
         {
-            return bucket( val ).find_with( val, pred );
+            return bucket( key ).find_with( key, pred );
         }
 
-        /// Finds the key \p val and return the item found
+        /// Finds the key \p key and return the item found
         /** \anchor cds_nonintrusive_MichaelHashSet_rcu_get
-            The function searches the item with key equal to \p val and returns the pointer to item found.
-            If \p val is not found it returns \p nullptr.
+            The function searches the item with key equal to \p key and returns the pointer to item found.
+            If \p key is not found it returns \p nullptr.
 
             Note the compare functor should accept a parameter of type \p Q that can be not the same as \p value_type.
 
@@ -678,12 +617,12 @@ namespace cds { namespace container {
             \endcode
         */
         template <typename Q>
-        value_type * get( Q const& val ) const
+        value_type * get( Q const& key ) const
         {
-            return bucket( val ).get( val );
+            return bucket( key ).get( key );
         }
 
-        /// Finds the key \p val and return the item found
+        /// Finds the key \p key and return the item found
         /**
             The function is an analog of \ref cds_nonintrusive_MichaelHashSet_rcu_get "get(Q const&)"
             but \p pred is used for comparing the keys.
@@ -693,22 +632,12 @@ namespace cds { namespace container {
             \p pred must imply the same element order as the comparator used for building the set.
         */
         template <typename Q, typename Less>
-        value_type * get_with( Q const& val, Less pred ) const
+        value_type * get_with( Q const& key, Less pred ) const
         {
-            return bucket( val ).get_with( val, pred );
+            return bucket( key ).get_with( key, pred );
         }
 
-        /// Clears the set (non-atomic)
-        /**
-            The function erases all items from the set.
-
-            The function is not atomic. It cleans up each bucket and then resets the item counter to zero.
-            If there are a thread that performs insertion while \p clear is working the result is undefined in general case:
-            <tt> empty() </tt> may return \p true but the set may contain item(s).
-            Therefore, \p clear may be used only for debugging purposes.
-
-            RCU \p synchronize method can be called. RCU should not be locked.
-        */
+        /// Clears the set (not atomic)
         void clear()
         {
             for ( size_t i = 0; i < bucket_count(); ++i )
@@ -734,7 +663,7 @@ namespace cds { namespace container {
 
         /// Returns the size of hash table
         /**
-            Since MichaelHashSet cannot dynamically extend the hash table size,
+            Since \p %MichaelHashSet cannot dynamically extend the hash table size,
             the value returned is an constant depending on object initialization parameters;
             see MichaelHashSet::MichaelHashSet for explanation.
         */
@@ -746,4 +675,4 @@ namespace cds { namespace container {
 
 }} // namespace cds::container
 
-#endif // ifndef __CDS_CONTAINER_MICHAEL_SET_H
+#endif // ifndef __CDS_CONTAINER_MICHAEL_SET_RCU_H
index 1f6e998d4617f6960e663ab606df579afe2e1baa..012a7c76de6da1d43eb1ec379386732f6736b0dd 100644 (file)
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_intrusive_splitlist_set_rcu_shb_lazy.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_intrusive_splitlist_set_rcu_sht.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_intrusive_splitlist_set_rcu_sht_lazy.cpp" />\r
+    <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_dhp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_hp.cpp" />\r
+    <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_dhp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_hp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_nogc.cpp" />\r
-    <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_ptb.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_rcu_gpb.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_rcu_gpi.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_rcu_gpt.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_rcu_shb.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_rcu_sht.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_nogc.cpp" />\r
-    <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_ptb.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_rcu_gpb.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_rcu_gpi.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_rcu_gpt.cpp" />\r
index 5fe49abc1c124048e2bce9be3a5aebfb4eba5a4c..ca24563ba8d0e5be7a510448ed317fc31dee3c3a 100644 (file)
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_nogc.cpp">\r
       <Filter>container\michael_set</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_ptb.cpp">\r
-      <Filter>container\michael_set</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_rcu_gpb.cpp">\r
-      <Filter>container\michael_set</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_rcu_gpi.cpp">\r
       <Filter>container\michael_set</Filter>\r
     </ClCompile>\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_nogc.cpp">\r
       <Filter>container\michael_set</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_ptb.cpp">\r
-      <Filter>container\michael_set</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_rcu_gpb.cpp">\r
       <Filter>container\michael_set</Filter>\r
     </ClCompile>\r
     <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_intrusive_michael_set_dhp_lazy.cpp">\r
       <Filter>intrusive\michael_set</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_dhp.cpp">\r
+      <Filter>container\michael_set</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_dhp.cpp">\r
+      <Filter>container\michael_set</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\tests\test-hdr\set\hdr_michael_set_lazy_rcu_gpb.cpp">\r
+      <Filter>container\michael_set</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file
diff --git a/tests/test-hdr/set/hdr_michael_set_dhp.cpp b/tests/test-hdr/set/hdr_michael_set_dhp.cpp
new file mode 100644 (file)
index 0000000..fe35856
--- /dev/null
@@ -0,0 +1,88 @@
+//$$CDS-header$$
+
+#include "set/hdr_set.h"
+#include <cds/container/michael_list_dhp.h>
+#include <cds/container/michael_set.h>
+
+namespace set {
+
+    namespace {
+        struct set_traits: public cc::michael_set::traits
+        {
+            typedef HashSetHdrTest::hash_int            hash;
+            typedef HashSetHdrTest::simple_item_counter item_counter;
+        };
+
+        struct DHP_cmp_traits: public cc::michael_list::traits
+        {
+            typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
+        };
+
+        struct DHP_less_traits: public cc::michael_list::traits
+        {
+            typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
+        };
+
+        struct DHP_cmpmix_traits: public cc::michael_list::traits
+        {
+            typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
+            typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
+        };
+    }
+
+    void HashSetHdrTest::Michael_DHP_cmp()
+    {
+        typedef cc::MichaelList< cds::gc::DHP, item, DHP_cmp_traits > list;
+
+        // traits-based version
+        typedef cc::MichaelHashSet< cds::gc::DHP, list, set_traits > set;
+        test_int< set >();
+
+        // option-based version
+        typedef cc::MichaelHashSet< cds::gc::DHP, list,
+            cc::michael_set::make_traits<
+                cc::opt::hash< hash_int >
+                ,cc::opt::item_counter< simple_item_counter >
+            >::type
+        > opt_set;
+        test_int< opt_set >();
+    }
+
+    void HashSetHdrTest::Michael_DHP_less()
+    {
+        typedef cc::MichaelList< cds::gc::DHP, item, DHP_less_traits > list;
+
+        // traits-based version
+        typedef cc::MichaelHashSet< cds::gc::DHP, list, set_traits > set;
+        test_int< set >();
+
+        // option-based version
+        typedef cc::MichaelHashSet< cds::gc::DHP, list,
+            cc::michael_set::make_traits<
+                cc::opt::hash< hash_int >
+                ,cc::opt::item_counter< simple_item_counter >
+            >::type
+        > opt_set;
+        test_int< opt_set >();
+    }
+
+    void HashSetHdrTest::Michael_DHP_cmpmix()
+    {
+        typedef cc::MichaelList< cds::gc::DHP, item, DHP_cmpmix_traits > list;
+
+        // traits-based version
+        typedef cc::MichaelHashSet< cds::gc::DHP, list, set_traits > set;
+        test_int< set >();
+
+        // option-based version
+        typedef cc::MichaelHashSet< cds::gc::DHP, list,
+            cc::michael_set::make_traits<
+                cc::opt::hash< hash_int >
+                ,cc::opt::item_counter< simple_item_counter >
+            >::type
+        > opt_set;
+        test_int< opt_set >();
+    }
+
+
+} // namespace set
index db54bd22c5ecf57a4e8027e72716e171ea313711..400fa6c76ff57902d1123a92131ac7ec4e404b68 100644 (file)
@@ -7,23 +7,23 @@
 namespace set {
 
     namespace {
-        struct set_traits: public cc::michael_set::type_traits
+        struct set_traits: public cc::michael_set::traits
         {
             typedef HashSetHdrTest::hash_int            hash;
             typedef HashSetHdrTest::simple_item_counter item_counter;
         };
 
-        struct HP_cmp_traits: public cc::michael_list::type_traits
+        struct HP_cmp_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
         };
 
-        struct HP_less_traits: public cc::michael_list::type_traits
+        struct HP_less_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
         };
 
-        struct HP_cmpmix_traits: public cc::michael_list::type_traits
+        struct HP_cmpmix_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
diff --git a/tests/test-hdr/set/hdr_michael_set_lazy_dhp.cpp b/tests/test-hdr/set/hdr_michael_set_lazy_dhp.cpp
new file mode 100644 (file)
index 0000000..ad4e924
--- /dev/null
@@ -0,0 +1,88 @@
+//$$CDS-header$$
+
+#include "set/hdr_set.h"
+#include <cds/container/lazy_list_dhp.h>
+#include <cds/container/michael_set.h>
+
+namespace set {
+
+    namespace {
+        struct set_traits: public cc::michael_set::traits
+        {
+            typedef HashSetHdrTest::hash_int            hash;
+            typedef HashSetHdrTest::simple_item_counter item_counter;
+        };
+
+        struct DHP_cmp_traits: public cc::lazy_list::traits
+        {
+            typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
+        };
+
+        struct DHP_less_traits: public cc::lazy_list::traits
+        {
+            typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
+        };
+
+        struct DHP_cmpmix_traits: public cc::lazy_list::traits
+        {
+            typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
+            typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
+        };
+    }
+
+    void HashSetHdrTest::Lazy_DHP_cmp()
+    {
+        typedef cc::LazyList< cds::gc::DHP, item, DHP_cmp_traits > list;
+
+        // traits-based version
+        typedef cc::MichaelHashSet< cds::gc::DHP, list, set_traits > set;
+        test_int< set >();
+
+        // option-based version
+        typedef cc::MichaelHashSet< cds::gc::DHP, list,
+            cc::michael_set::make_traits<
+                cc::opt::hash< hash_int >
+                ,cc::opt::item_counter< simple_item_counter >
+            >::type
+        > opt_set;
+        test_int< opt_set >();
+    }
+
+    void HashSetHdrTest::Lazy_DHP_less()
+    {
+        typedef cc::LazyList< cds::gc::DHP, item, DHP_less_traits > list;
+
+        // traits-based version
+        typedef cc::MichaelHashSet< cds::gc::DHP, list, set_traits > set;
+        test_int< set >();
+
+        // option-based version
+        typedef cc::MichaelHashSet< cds::gc::DHP, list,
+            cc::michael_set::make_traits<
+                cc::opt::hash< hash_int >
+                ,cc::opt::item_counter< simple_item_counter >
+            >::type
+        > opt_set;
+        test_int< opt_set >();
+    }
+
+    void HashSetHdrTest::Lazy_DHP_cmpmix()
+    {
+        typedef cc::LazyList< cds::gc::DHP, item, DHP_cmpmix_traits > list;
+
+        // traits-based version
+        typedef cc::MichaelHashSet< cds::gc::DHP, list, set_traits > set;
+        test_int< set >();
+
+        // option-based version
+        typedef cc::MichaelHashSet< cds::gc::DHP, list,
+            cc::michael_set::make_traits<
+                cc::opt::hash< hash_int >
+                ,cc::opt::item_counter< simple_item_counter >
+            >::type
+        > opt_set;
+        test_int< opt_set >();
+    }
+
+
+} // namespace set
index c8fa8dcae031361e743ec29af579ab92f20c125e..066e1b7d8e5cab8ce87c1731f85c424968e6561f 100644 (file)
@@ -7,23 +7,23 @@
 namespace set {
 
     namespace {
-        struct set_traits: public cc::michael_set::type_traits
+        struct set_traits: public cc::michael_set::traits
         {
             typedef HashSetHdrTest::hash_int            hash;
             typedef HashSetHdrTest::simple_item_counter item_counter;
         };
 
-        struct HP_cmp_traits: public cc::lazy_list::type_traits
+        struct HP_cmp_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
         };
 
-        struct HP_less_traits: public cc::lazy_list::type_traits
+        struct HP_less_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
         };
 
-        struct HP_cmpmix_traits: public cc::lazy_list::type_traits
+        struct HP_cmpmix_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
index 7d424a008868bc26bd9a173a18412593c7ca48a9..4d988f438440970ded0c141b5bd50613b10d15b8 100644 (file)
@@ -7,23 +7,23 @@
 namespace set {
 
     namespace {
-        struct set_traits: public cc::michael_set::type_traits
+        struct set_traits: public cc::michael_set::traits
         {
             typedef HashSetHdrTest::hash_int            hash;
             typedef HashSetHdrTest::simple_item_counter item_counter;
         };
 
-        struct nogc_cmp_traits: public cc::lazy_list::type_traits
+        struct nogc_cmp_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
         };
 
-        struct nogc_less_traits: public cc::lazy_list::type_traits
+        struct nogc_less_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
         };
 
-        struct nogc_cmpmix_traits: public cc::lazy_list::type_traits
+        struct nogc_cmpmix_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
diff --git a/tests/test-hdr/set/hdr_michael_set_lazy_ptb.cpp b/tests/test-hdr/set/hdr_michael_set_lazy_ptb.cpp
deleted file mode 100644 (file)
index b8c3136..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-//$$CDS-header$$
-
-#include "set/hdr_set.h"
-#include <cds/container/lazy_list_dhp.h>
-#include <cds/container/michael_set.h>
-
-namespace set {
-
-    namespace {
-        struct set_traits: public cc::michael_set::type_traits
-        {
-            typedef HashSetHdrTest::hash_int            hash;
-            typedef HashSetHdrTest::simple_item_counter item_counter;
-        };
-
-        struct PTB_cmp_traits: public cc::lazy_list::type_traits
-        {
-            typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
-        };
-
-        struct PTB_less_traits: public cc::lazy_list::type_traits
-        {
-            typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
-        };
-
-        struct PTB_cmpmix_traits: public cc::lazy_list::type_traits
-        {
-            typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
-            typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
-        };
-    }
-
-    void HashSetHdrTest::Lazy_PTB_cmp()
-    {
-        typedef cc::LazyList< cds::gc::PTB, item, PTB_cmp_traits > list;
-
-        // traits-based version
-        typedef cc::MichaelHashSet< cds::gc::PTB, list, set_traits > set;
-        test_int< set >();
-
-        // option-based version
-        typedef cc::MichaelHashSet< cds::gc::PTB, list,
-            cc::michael_set::make_traits<
-                cc::opt::hash< hash_int >
-                ,cc::opt::item_counter< simple_item_counter >
-            >::type
-        > opt_set;
-        test_int< opt_set >();
-    }
-
-    void HashSetHdrTest::Lazy_PTB_less()
-    {
-        typedef cc::LazyList< cds::gc::PTB, item, PTB_less_traits > list;
-
-        // traits-based version
-        typedef cc::MichaelHashSet< cds::gc::PTB, list, set_traits > set;
-        test_int< set >();
-
-        // option-based version
-        typedef cc::MichaelHashSet< cds::gc::PTB, list,
-            cc::michael_set::make_traits<
-                cc::opt::hash< hash_int >
-                ,cc::opt::item_counter< simple_item_counter >
-            >::type
-        > opt_set;
-        test_int< opt_set >();
-    }
-
-    void HashSetHdrTest::Lazy_PTB_cmpmix()
-    {
-        typedef cc::LazyList< cds::gc::PTB, item, PTB_cmpmix_traits > list;
-
-        // traits-based version
-        typedef cc::MichaelHashSet< cds::gc::PTB, list, set_traits > set;
-        test_int< set >();
-
-        // option-based version
-        typedef cc::MichaelHashSet< cds::gc::PTB, list,
-            cc::michael_set::make_traits<
-                cc::opt::hash< hash_int >
-                ,cc::opt::item_counter< simple_item_counter >
-            >::type
-        > opt_set;
-        test_int< opt_set >();
-    }
-
-
-} // namespace set
index 82238d58b64e2c3892e165bbdc16d08ac5d3333c..8b2234b232929bf97bfd43fd554a249187f2eca8 100644 (file)
@@ -10,23 +10,23 @@ namespace set {
     namespace {
         typedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_type;
 
-        struct set_traits: public cc::michael_set::type_traits
+        struct set_traits: public cc::michael_set::traits
         {
             typedef HashSetHdrTest::hash_int            hash;
             typedef HashSetHdrTest::simple_item_counter item_counter;
         };
 
-        struct RCU_GPB_cmp_traits: public cc::lazy_list::type_traits
+        struct RCU_GPB_cmp_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
         };
 
-        struct RCU_GPB_less_traits: public cc::lazy_list::type_traits
+        struct RCU_GPB_less_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
         };
 
-        struct RCU_GPB_cmpmix_traits: public cc::lazy_list::type_traits
+        struct RCU_GPB_cmpmix_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
index 1ea98e85a6659a1c3f0adeca5e7e8e4d2a52ca70..8e9933e93b737e2f272bdf009fb632ec9ccefe80 100644 (file)
@@ -10,23 +10,23 @@ namespace set {
     namespace {
         typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_type;
 
-        struct set_traits: public cc::michael_set::type_traits
+        struct set_traits: public cc::michael_set::traits
         {
             typedef HashSetHdrTest::hash_int            hash;
             typedef HashSetHdrTest::simple_item_counter item_counter;
         };
 
-        struct RCU_GPI_cmp_traits: public cc::lazy_list::type_traits
+        struct RCU_GPI_cmp_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
         };
 
-        struct RCU_GPI_less_traits: public cc::lazy_list::type_traits
+        struct RCU_GPI_less_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
         };
 
-        struct RCU_GPI_cmpmix_traits: public cc::lazy_list::type_traits
+        struct RCU_GPI_cmpmix_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
index 20841a428f01e8546147922882c0862d073ff5e4..b17a4659fa7324fdac580696afcb2bb8f4847d54 100644 (file)
@@ -10,23 +10,23 @@ namespace set {
     namespace {
         typedef cds::urcu::gc< cds::urcu::general_threaded<> > rcu_type;
 
-        struct set_traits: public cc::michael_set::type_traits
+        struct set_traits: public cc::michael_set::traits
         {
             typedef HashSetHdrTest::hash_int            hash;
             typedef HashSetHdrTest::simple_item_counter item_counter;
         };
 
-        struct RCU_GPT_cmp_traits: public cc::lazy_list::type_traits
+        struct RCU_GPT_cmp_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
         };
 
-        struct RCU_GPT_less_traits: public cc::lazy_list::type_traits
+        struct RCU_GPT_less_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
         };
 
-        struct RCU_GPT_cmpmix_traits: public cc::lazy_list::type_traits
+        struct RCU_GPT_cmpmix_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
index 823a332b3b0b2291499eb790f51471ed19232499..a6a551037fd5531ba49faf3bc8c5cedbce476671 100644 (file)
@@ -11,23 +11,23 @@ namespace set {
     namespace {
         typedef cds::urcu::gc< cds::urcu::signal_buffered<> > rcu_type;
 
-        struct set_traits: public cc::michael_set::type_traits
+        struct set_traits: public cc::michael_set::traits
         {
             typedef HashSetHdrTest::hash_int            hash;
             typedef HashSetHdrTest::simple_item_counter item_counter;
         };
 
-        struct RCU_SHB_cmp_traits: public cc::lazy_list::type_traits
+        struct RCU_SHB_cmp_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
         };
 
-        struct RCU_SHB_less_traits: public cc::lazy_list::type_traits
+        struct RCU_SHB_less_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
         };
 
-        struct RCU_SHB_cmpmix_traits: public cc::lazy_list::type_traits
+        struct RCU_SHB_cmpmix_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
index 13c7f59475e3f72aca5ef7f04eb1931ba817858f..343dd7822961f464bc25d9384436c77f89b0919d 100644 (file)
@@ -11,23 +11,23 @@ namespace set {
     namespace {
         typedef cds::urcu::gc< cds::urcu::signal_threaded<> > rcu_type;
 
-        struct set_traits: public cc::michael_set::type_traits
+        struct set_traits: public cc::michael_set::traits
         {
             typedef HashSetHdrTest::hash_int            hash;
             typedef HashSetHdrTest::simple_item_counter item_counter;
         };
 
-        struct RCU_SHT_cmp_traits: public cc::lazy_list::type_traits
+        struct RCU_SHT_cmp_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
         };
 
-        struct RCU_SHT_less_traits: public cc::lazy_list::type_traits
+        struct RCU_SHT_less_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
         };
 
-        struct RCU_SHT_cmpmix_traits: public cc::lazy_list::type_traits
+        struct RCU_SHT_cmpmix_traits: public cc::lazy_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
index 032114dca208cb284e762cfdbc9eeb244ef0ae17..8160f4c2f543983914752ddaba30bb1a441665a5 100644 (file)
@@ -7,23 +7,23 @@
 namespace set {
 
     namespace {
-        struct set_traits: public cc::michael_set::type_traits
+        struct set_traits: public cc::michael_set::traits
         {
             typedef HashSetHdrTest::hash_int            hash;
             typedef HashSetHdrTest::simple_item_counter item_counter;
         };
 
-        struct nogc_cmp_traits: public cc::michael_list::type_traits
+        struct nogc_cmp_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
         };
 
-        struct nogc_less_traits: public cc::michael_list::type_traits
+        struct nogc_less_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
         };
 
-        struct nogc_cmpmix_traits: public cc::michael_list::type_traits
+        struct nogc_cmpmix_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
diff --git a/tests/test-hdr/set/hdr_michael_set_ptb.cpp b/tests/test-hdr/set/hdr_michael_set_ptb.cpp
deleted file mode 100644 (file)
index 0d4305e..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-//$$CDS-header$$
-
-#include "set/hdr_set.h"
-#include <cds/container/michael_list_dhp.h>
-#include <cds/container/michael_set.h>
-
-namespace set {
-
-    namespace {
-        struct set_traits: public cc::michael_set::type_traits
-        {
-            typedef HashSetHdrTest::hash_int            hash;
-            typedef HashSetHdrTest::simple_item_counter item_counter;
-        };
-
-        struct PTB_cmp_traits: public cc::michael_list::type_traits
-        {
-            typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
-        };
-
-        struct PTB_less_traits: public cc::michael_list::type_traits
-        {
-            typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
-        };
-
-        struct PTB_cmpmix_traits: public cc::michael_list::type_traits
-        {
-            typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
-            typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
-        };
-    }
-
-    void HashSetHdrTest::Michael_PTB_cmp()
-    {
-        typedef cc::MichaelList< cds::gc::PTB, item, PTB_cmp_traits > list;
-
-        // traits-based version
-        typedef cc::MichaelHashSet< cds::gc::PTB, list, set_traits > set;
-        test_int< set >();
-
-        // option-based version
-        typedef cc::MichaelHashSet< cds::gc::PTB, list,
-            cc::michael_set::make_traits<
-                cc::opt::hash< hash_int >
-                ,cc::opt::item_counter< simple_item_counter >
-            >::type
-        > opt_set;
-        test_int< opt_set >();
-    }
-
-    void HashSetHdrTest::Michael_PTB_less()
-    {
-        typedef cc::MichaelList< cds::gc::PTB, item, PTB_less_traits > list;
-
-        // traits-based version
-        typedef cc::MichaelHashSet< cds::gc::PTB, list, set_traits > set;
-        test_int< set >();
-
-        // option-based version
-        typedef cc::MichaelHashSet< cds::gc::PTB, list,
-            cc::michael_set::make_traits<
-                cc::opt::hash< hash_int >
-                ,cc::opt::item_counter< simple_item_counter >
-            >::type
-        > opt_set;
-        test_int< opt_set >();
-    }
-
-    void HashSetHdrTest::Michael_PTB_cmpmix()
-    {
-        typedef cc::MichaelList< cds::gc::PTB, item, PTB_cmpmix_traits > list;
-
-        // traits-based version
-        typedef cc::MichaelHashSet< cds::gc::PTB, list, set_traits > set;
-        test_int< set >();
-
-        // option-based version
-        typedef cc::MichaelHashSet< cds::gc::PTB, list,
-            cc::michael_set::make_traits<
-                cc::opt::hash< hash_int >
-                ,cc::opt::item_counter< simple_item_counter >
-            >::type
-        > opt_set;
-        test_int< opt_set >();
-    }
-
-
-} // namespace set
index 215abc8594ef8a559884653a24ffc8cbf1b9ab83..21c2809483641daf46d40c855a9a9f113a4256f9 100644 (file)
@@ -10,23 +10,23 @@ namespace set {
     namespace {
         typedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_type;
 
-        struct set_traits: public cc::michael_set::type_traits
+        struct set_traits: public cc::michael_set::traits
         {
             typedef HashSetHdrTest::hash_int            hash;
             typedef HashSetHdrTest::simple_item_counter item_counter;
         };
 
-        struct RCU_GPB_cmp_traits: public cc::michael_list::type_traits
+        struct RCU_GPB_cmp_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
         };
 
-        struct RCU_GPB_less_traits: public cc::michael_list::type_traits
+        struct RCU_GPB_less_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
         };
 
-        struct RCU_GPB_cmpmix_traits: public cc::michael_list::type_traits
+        struct RCU_GPB_cmpmix_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
index 5d6ca35a3ec58631fe91a03e738935f7a39eec35..aed109b501e45b95f4255373e7ea0dc24bd35c02 100644 (file)
@@ -10,23 +10,23 @@ namespace set {
     namespace {
         typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_type;
 
-        struct set_traits: public cc::michael_set::type_traits
+        struct set_traits: public cc::michael_set::traits
         {
             typedef HashSetHdrTest::hash_int            hash;
             typedef HashSetHdrTest::simple_item_counter item_counter;
         };
 
-        struct RCU_GPI_cmp_traits: public cc::michael_list::type_traits
+        struct RCU_GPI_cmp_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
         };
 
-        struct RCU_GPI_less_traits: public cc::michael_list::type_traits
+        struct RCU_GPI_less_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
         };
 
-        struct RCU_GPI_cmpmix_traits: public cc::michael_list::type_traits
+        struct RCU_GPI_cmpmix_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
index 056514bc282d0dbb31ea09288744357f63a052fa..c75eed96bd3a6aee64fdf8a7f9cbfcb39ab95fea 100644 (file)
@@ -10,23 +10,23 @@ namespace set {
     namespace {
         typedef cds::urcu::gc< cds::urcu::general_threaded<> > rcu_type;
 
-        struct set_traits: public cc::michael_set::type_traits
+        struct set_traits: public cc::michael_set::traits
         {
             typedef HashSetHdrTest::hash_int            hash;
             typedef HashSetHdrTest::simple_item_counter item_counter;
         };
 
-        struct RCU_GPT_cmp_traits: public cc::michael_list::type_traits
+        struct RCU_GPT_cmp_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
         };
 
-        struct RCU_GPT_less_traits: public cc::michael_list::type_traits
+        struct RCU_GPT_less_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
         };
 
-        struct RCU_GPT_cmpmix_traits: public cc::michael_list::type_traits
+        struct RCU_GPT_cmpmix_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
index d06cfeab9cf5786673de0c241ee68687dc276bf6..fe37af6540001cb657572ff815e7ebfdddf6fba9 100644 (file)
@@ -11,23 +11,23 @@ namespace set {
     namespace {
         typedef cds::urcu::gc< cds::urcu::signal_buffered<> > rcu_type;
 
-        struct set_traits: public cc::michael_set::type_traits
+        struct set_traits: public cc::michael_set::traits
         {
             typedef HashSetHdrTest::hash_int            hash;
             typedef HashSetHdrTest::simple_item_counter item_counter;
         };
 
-        struct RCU_SHB_cmp_traits: public cc::michael_list::type_traits
+        struct RCU_SHB_cmp_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
         };
 
-        struct RCU_SHB_less_traits: public cc::michael_list::type_traits
+        struct RCU_SHB_less_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
         };
 
-        struct RCU_SHB_cmpmix_traits: public cc::michael_list::type_traits
+        struct RCU_SHB_cmpmix_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
index 81534a960c11d6db3a47d1d0f3bf40ab22a9fe51..0122333fd496c1b0726b40ab2ab7555b685b5020 100644 (file)
@@ -11,23 +11,23 @@ namespace set {
     namespace {
         typedef cds::urcu::gc< cds::urcu::signal_threaded<> > rcu_type;
 
-        struct set_traits: public cc::michael_set::type_traits
+        struct set_traits: public cc::michael_set::traits
         {
             typedef HashSetHdrTest::hash_int            hash;
             typedef HashSetHdrTest::simple_item_counter item_counter;
         };
 
-        struct RCU_SHT_cmp_traits: public cc::michael_list::type_traits
+        struct RCU_SHT_cmp_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
         };
 
-        struct RCU_SHT_less_traits: public cc::michael_list::type_traits
+        struct RCU_SHT_less_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
         };
 
-        struct RCU_SHT_cmpmix_traits: public cc::michael_list::type_traits
+        struct RCU_SHT_cmpmix_traits: public cc::michael_list::traits
         {
             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
index cb6cf43bca600c7266a6586c263dda7369778087..14792f32d37d00fe47c8df237d7cb1f83c0fe1e2 100644 (file)
@@ -825,9 +825,9 @@ namespace set {
         void Michael_HP_less();
         void Michael_HP_cmpmix();
 
-        void Michael_PTB_cmp();
-        void Michael_PTB_less();
-        void Michael_PTB_cmpmix();
+        void Michael_DHP_cmp();
+        void Michael_DHP_less();
+        void Michael_DHP_cmpmix();
 
         void Michael_RCU_GPI_cmp();
         void Michael_RCU_GPI_less();
@@ -857,9 +857,9 @@ namespace set {
         void Lazy_HP_less();
         void Lazy_HP_cmpmix();
 
-        void Lazy_PTB_cmp();
-        void Lazy_PTB_less();
-        void Lazy_PTB_cmpmix();
+        void Lazy_DHP_cmp();
+        void Lazy_DHP_less();
+        void Lazy_DHP_cmpmix();
 
         void Lazy_RCU_GPI_cmp();
         void Lazy_RCU_GPI_less();
@@ -955,9 +955,9 @@ namespace set {
             CPPUNIT_TEST(Michael_HP_less)
             CPPUNIT_TEST(Michael_HP_cmpmix)
 
-            CPPUNIT_TEST(Michael_PTB_cmp)
-            CPPUNIT_TEST(Michael_PTB_less)
-            CPPUNIT_TEST(Michael_PTB_cmpmix)
+            CPPUNIT_TEST(Michael_DHP_cmp)
+            CPPUNIT_TEST(Michael_DHP_less)
+            CPPUNIT_TEST(Michael_DHP_cmpmix)
 
             CPPUNIT_TEST(Michael_RCU_GPI_cmp)
             CPPUNIT_TEST(Michael_RCU_GPI_less)
@@ -987,9 +987,9 @@ namespace set {
             CPPUNIT_TEST(Lazy_HP_less)
             CPPUNIT_TEST(Lazy_HP_cmpmix)
 
-            CPPUNIT_TEST(Lazy_PTB_cmp)
-            CPPUNIT_TEST(Lazy_PTB_less)
-            CPPUNIT_TEST(Lazy_PTB_cmpmix)
+            CPPUNIT_TEST(Lazy_DHP_cmp)
+            CPPUNIT_TEST(Lazy_DHP_less)
+            CPPUNIT_TEST(Lazy_DHP_cmpmix)
 
             CPPUNIT_TEST(Lazy_RCU_GPI_cmp)
             CPPUNIT_TEST(Lazy_RCU_GPI_less)