From: khizmax Date: Thu, 6 Nov 2014 20:20:04 +0000 (+0300) Subject: SkipListMap/Set refactoring X-Git-Tag: v2.0.0~134 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=commitdiff_plain;h=08d0b59b5c079cb2dc07d0682ff417c2cdae144d SkipListMap/Set refactoring --- diff --git a/cds/container/details/make_skip_list_set.h b/cds/container/details/make_skip_list_set.h index 7f7392af..a65aa37c 100644 --- a/cds/container/details/make_skip_list_set.h +++ b/cds/container/details/make_skip_list_set.h @@ -14,7 +14,7 @@ namespace cds { namespace container { namespace details { { typedef GC gc; typedef T value_type; - typedef Traits type_traits; + typedef Traits traits; typedef cds::intrusive::skip_list::node< gc > intrusive_node_type; struct node_type: public intrusive_node_type @@ -50,7 +50,7 @@ namespace cds { namespace container { namespace details { node_type() ; // no default ctor }; - typedef skip_list::details::node_allocator< node_type, type_traits> node_allocator; + typedef skip_list::details::node_allocator< node_type, traits> node_allocator; struct node_deallocator { void operator ()( node_type * pNode ) @@ -68,15 +68,15 @@ namespace cds { namespace container { namespace details { return node.m_Value; } }; - typedef typename opt::details::make_comparator< value_type, type_traits >::type key_comparator; + typedef typename opt::details::make_comparator< value_type, traits >::type key_comparator; template struct less_wrapper { typedef cds::details::compare_wrapper< node_type, cds::opt::details::make_comparator_from_less, value_accessor > type; }; - class intrusive_type_traits: public cds::intrusive::skip_list::make_traits< - cds::opt::type_traits< type_traits > + class intrusive_traits: public cds::intrusive::skip_list::make_traits< + cds::opt::type_traits< traits > ,cds::intrusive::opt::hook< intrusive::skip_list::base_hook< cds::opt::gc< gc > > > ,cds::intrusive::opt::disposer< node_deallocator > ,cds::intrusive::skip_list::internal_node_builder< dummy_node_builder > @@ -84,7 +84,7 @@ namespace cds { namespace container { namespace details { >::type {}; - typedef cds::intrusive::SkipListSet< gc, node_type, intrusive_type_traits> type; + typedef cds::intrusive::SkipListSet< gc, node_type, intrusive_traits> type; }; }}} // namespace cds::container::details //@endcond diff --git a/cds/container/details/skip_list_base.h b/cds/container/details/skip_list_base.h index 85499c06..75b1e090 100644 --- a/cds/container/details/skip_list_base.h +++ b/cds/container/details/skip_list_base.h @@ -13,43 +13,25 @@ namespace cds { namespace container { */ namespace skip_list { -#ifdef CDS_DOXYGEN_INVOKED - /// Typedef for intrusive::skip_list::random_level_generator template - struct random_level_generator {}; -#else - using cds::intrusive::skip_list::random_level_generator; -#endif - -#ifdef CDS_DOXYGEN_INVOKED - /// Typedef for intrusive::skip_list::xorshift class - class xorshift {}; -#else - using cds::intrusive::skip_list::xorshift; -#endif - -#ifdef CDS_DOXYGEN_INVOKED - /// Typedef for intrusive::skip_list::turbo_pascal class - class turbo_pascal {}; -#else - using cds::intrusive::skip_list::turbo_pascal; -#endif - -#ifdef CDS_DOXYGEN_INVOKED - /// Typedef for intrusive::skip_list::stat class - class stat {}; -#else - using cds::intrusive::skip_list::stat; -#endif - -#ifdef CDS_DOXYGEN_INVOKED - /// Typedef for intrusive::skip_list::empty_stat class - class empty_stat {}; -#else - using cds::intrusive::skip_list::empty_stat; -#endif - - /// Type traits for SkipListSet class - struct type_traits + /// Option specifying random level generator + template + using random_level_generator = cds::intrusive::skip_list::random_level_generator; + + /// Xor-shift random level generator + typedef cds::intrusive::skip_list::xorshift xorshift; + + /// Turbo-pascal random level generator + typedef cds::intrusive::skip_list::turbo_pascal turbo_pascal; + + /// Skip list internal statistics + template + using stat = cds::intrusive::skip_list::stat < EventCounter > ; + + /// Skip list empty internal statistics + typedef cds::intrusive::skip_list::empty_stat empty_stat; + + /// SkipListSet traits + struct traits { /// Key comparison functor /** @@ -65,14 +47,14 @@ namespace cds { namespace container { /// Item counter /** - The type for item counting feature. - Default is no item counter (\ref atomicity::empty_item_counter) + The type for item counting feature, + by defaulr disabled (\p atomicity::empty_item_counter) */ typedef atomicity::empty_item_counter item_counter; /// C++ memory ordering model /** - List of available memory ordering see opt::memory_model + List of available memory ordering see \p opt::memory_model */ typedef opt::v::relaxed_ordering memory_model; @@ -83,20 +65,17 @@ namespace cds { namespace container { where half of the nodes that have level \p i also have level i+1 (i = 0..30). The height of a node is in range [0..31]. - See skip_list::random_level_generator option setter. + See \p skip_list::random_level_generator option setter. */ typedef turbo_pascal random_level_generator; /// Allocator for skip-list nodes, \p std::allocator interface typedef CDS_DEFAULT_ALLOCATOR allocator; - /// back-off strategy used - /** - If the option is not specified, the cds::backoff::Default is used. - */ + /// back-off strategy, default is \p cds::backoff::Default typedef cds::backoff::Default back_off; - /// Internal statistics + /// Internal statistics, by default disabled. To enable, use \p split_list::stat typedef empty_stat stat; /// RCU deadlock checking policy (for \ref cds_nonintrusive_SkipListSet_rcu "RCU-based SkipListSet") @@ -113,8 +92,22 @@ namespace cds { namespace container { /// Metafunction converting option list to SkipListSet traits /** - This is a wrapper for cds::opt::make_options< type_traits, Options...> - \p Options list see \ref SkipListSet. + \p Options are: + - \p opt::compare - key comparison functor. No default functor is provided. + If the option is not specified, the \p opt::less is used. + - \p opt::less - specifies binary predicate used for key comparison. Default is \p std::less. + - \p opt::item_counter - the type of item counting feature. Default is \pf atomicity::empty_item_counter that is no item counting. + - \p opt::memory_model - C++ memory ordering model. Can be \p opt::v::relaxed_ordering (relaxed memory model, the default) + or \p opt::v::sequential_consistent (sequentially consisnent memory model). + - \p skip_list::random_level_generator - random level generator. Can be \p skip_list::xorshift, \p skip_list::turbo_pascal or + user-provided one. + Default is \p %skip_list::turbo_pascal. + - \p opt::allocator - allocator for skip-list node. Default is \ref CDS_DEFAULT_ALLOCATOR. + - \p opt::back_off - back-off strategy used. If the option is not specified, the \p cds::backoff::Default is used. + - \p opt::stat - internal statistics. Available types: \p skip_list::stat, \p skip_list::empty_stat (the default) + - \p opt::rcu_check_deadlock - a deadlock checking policy for RCU-based skip-list. + Default is \p opt::v::rcu_throw_deadlock + */ template struct make_traits { @@ -122,7 +115,7 @@ namespace cds { namespace container { typedef implementation_defined type ; ///< Metafunction result # else typedef typename cds::opt::make_options< - typename cds::opt::find_type_traits< type_traits, Options... >::type + typename cds::opt::find_type_traits< traits, Options... >::type ,Options... >::type type; # endif @@ -136,11 +129,11 @@ namespace cds { namespace container { { protected: typedef Node node_type; - typedef Traits type_traits; + typedef Traits traits; typedef typename node_type::tower_item_type node_tower_item; - typedef typename type_traits::allocator::template rebind::other tower_allocator_type; - typedef typename type_traits::allocator::template rebind::other node_allocator_type; + typedef typename traits::allocator::template rebind::other tower_allocator_type; + typedef typename traits::allocator::template rebind::other node_allocator_type; static size_t const c_nTowerItemSize = sizeof(node_tower_item); static size_t const c_nNodePadding = sizeof(node_type) % c_nTowerItemSize; @@ -285,11 +278,11 @@ namespace cds { namespace container { } // namespace skip_list // Forward declaration - template + template class SkipListSet; // Forward declaration - template + template class SkipListMap; }} // namespace cds::container diff --git a/cds/container/impl/skip_list_map.h b/cds/container/impl/skip_list_map.h index 2bc344b8..e2c17d03 100644 --- a/cds/container/impl/skip_list_map.h +++ b/cds/container/impl/skip_list_map.h @@ -36,32 +36,18 @@ namespace cds { namespace container { - \p GC - Garbage collector used. - \p K - type of a key to be stored in the list. - \p T - type of a value to be stored in the list. - - \p Traits - type traits. See skip_list::type_traits for explanation. - - It is possible to declare option-based list with cds::container::skip_list::make_traits metafunction istead of \p Traits template - argument. - Template argument list \p Options of cds::container::skip_list::make_traits metafunction are: - - opt::compare - key compare functor. No default functor is provided. - If the option is not specified, the opt::less is used. - - opt::less - specifies binary predicate used for key comparison. Default is \p std::less. - - opt::item_counter - the type of item counting feature. Default is \ref atomicity::empty_item_counter that is no item counting. - - opt::memory_model - C++ memory ordering model. Can be opt::v::relaxed_ordering (relaxed memory model, the default) - or opt::v::sequential_consistent (sequentially consisnent memory model). - - skip_list::random_level_generator - random level generator. Can be skip_list::xorshift, skip_list::turbo_pascal or - user-provided one. See skip_list::random_level_generator option description for explanation. - Default is \p %skip_list::turbo_pascal. - - opt::allocator - allocator for skip-list node. Default is \ref CDS_DEFAULT_ALLOCATOR. - - opt::back_off - back-off strategy used. If the option is not specified, the cds::backoff::Default is used. - - opt::stat - internal statistics. Available types: skip_list::stat, skip_list::empty_stat (the default) - - Like STL map class, %SkipListMap stores its key-value pair as std:pair< K const, T>. - - \warning The skip-list requires up to 67 hazard pointers that may be critical for some GCs for which + - \p Traits - map traits, default is \p skip_list::traits + It is possible to declare option-based list with \p cds::container::skip_list::make_traits metafunction + istead of \p Traits template argument. + + Like STL map class, \p %SkipListMap stores the key-value pair as std:pair< K const, T>. + + @warning The skip-list requires up to 67 hazard pointers that may be critical for some GCs for which the guard count is limited (like \p gc::HP). Those GCs should be explicitly initialized with hazard pointer enough: \code cds::gc::HP myhp( 67 ) \endcode. Otherwise an run-time exception may be raised when you try to create skip-list object. - \note There are several specializations of \p %SkipListMap for each \p GC. You should include: + @note There are several specializations of \p %SkipListMap for each \p GC. You should include: - for \p gc::HP garbage collector - for \p gc::DHP garbage collector - for \ref cds_nonintrusive_SkipListMap_rcu "RCU type" @@ -114,7 +100,7 @@ namespace cds { namespace container { typename Key, typename T, #ifdef CDS_DOXYGEN_INVOKED - typename Traits = skip_list::type_traits + typename Traits = skip_list::traits #else typename Traits #endif @@ -127,27 +113,27 @@ namespace cds { namespace container { #endif { //@cond - typedef details::make_skip_list_map< GC, Key, T, Traits > maker; + typedef details::make_skip_list_map< GC, Key, T, Traits > maker; typedef typename maker::type base_class; //@endcond public: - typedef typename base_class::gc gc ; ///< Garbage collector used - typedef Key key_type ; ///< Key type - typedef T mapped_type ; ///< Mapped type + typedef GC gc; ///< Garbage collector + typedef Key key_type; ///< Key type + typedef T mapped_type; ///< Mapped type + typedef Traits traits; ///< Map traits # ifdef CDS_DOXYGEN_INVOKED - typedef std::pair< K const, T> value_type ; ///< Value type stored in the map + typedef std::pair< K const, T> value_type; ///< Key-value pair to be stored in the map # else typedef typename maker::value_type value_type; # endif - typedef Traits options ; ///< Options specified - typedef typename base_class::back_off back_off ; ///< Back-off strategy used - typedef typename options::allocator allocator_type ; ///< Allocator type used for allocate/deallocate the skip-list nodes - typedef typename base_class::item_counter item_counter ; ///< Item counting policy used - typedef typename maker::key_comparator key_comparator ; ///< key comparison functor - typedef typename base_class::memory_model memory_model ; ///< Memory ordering. See cds::opt::memory_model option - typedef typename options::random_level_generator random_level_generator ; ///< random level generator - typedef typename options::stat stat ; ///< internal statistics type + typedef typename base_class::back_off back_off; ///< Back-off strategy + typedef typename traits::allocator allocator_type; ///< Allocator type used for allocate/deallocate the skip-list nodes + typedef typename base_class::item_counter item_counter; ///< Item counting policy used + typedef typename maker::key_comparator key_comparator; ///< key comparison functor + typedef typename base_class::memory_model memory_model; ///< Memory ordering, see \p cds::opt::memory_model + typedef typename traits::random_level_generator random_level_generator ; ///< random level generator + typedef typename traits::stat stat; ///< internal statistics type protected: //@cond @@ -155,7 +141,6 @@ namespace cds { namespace container { typedef typename maker::node_allocator node_allocator; typedef std::unique_ptr< node_type, typename maker::node_deallocator > scoped_node_ptr; - //@endcond public: @@ -194,16 +179,15 @@ namespace cds { namespace container { } /// Returns a forward const iterator addressing the first element in a map - //@{ const_iterator begin() const { return cbegin(); } + /// Returns a forward const iterator addressing the first element in a map const_iterator cbegin() const { return const_iterator( base_class::cbegin() ); } - //@} /// Returns a forward iterator that addresses the location succeeding the last element in a map. iterator end() @@ -212,16 +196,15 @@ namespace cds { namespace container { } /// Returns a forward const iterator that addresses the location succeeding the last element in a map. - //@{ const_iterator end() const { return cend(); } + /// Returns a forward const iterator that addresses the location succeeding the last element in a map. const_iterator cend() const { return const_iterator( base_class::cend() ); } - //@} public: /// Inserts new node with key and default value @@ -229,9 +212,9 @@ namespace cds { namespace container { The function creates a node with \p key and default value, and then inserts the node created into the map. Preconditions: - - The \ref key_type should be constructible from a value of type \p K. - In trivial case, \p K is equal to \ref key_type. - - The \ref mapped_type should be default-constructible. + - The \p key_type should be constructible from a value of type \p K. + In trivial case, \p K is equal to \p key_type. + - The \p mapped_type should be default-constructible. Returns \p true if inserting successful, \p false otherwise. */ @@ -247,8 +230,8 @@ namespace cds { namespace container { and then inserts the node created into the map. Preconditions: - - The \ref key_type should be constructible from \p key of type \p K. - - The \ref value_type should be constructible from \p val of type \p V. + - The \p key_type should be constructible from \p key of type \p K. + - The \p value_type should be constructible from \p val of type \p V. Returns \p true if \p val is inserted into the set, \p false otherwise. */ @@ -273,10 +256,7 @@ namespace cds { namespace container { - item.first is a const reference to item's key that cannot be changed. - item.second is a reference to item's value that may be changed. - The user-defined functor can be passed by reference using \p std::ref - and it is called only if inserting is successful. - - The key_type should be constructible from value of type \p K. + \p key_type should be constructible from value of type \p K. The function allows to split creating of new item into two part: - create item from \p key; @@ -297,7 +277,7 @@ namespace cds { namespace container { return false; } - /// For key \p key inserts data of type \ref value_type constructed with std::forward(args)... + /// For key \p key inserts data of type \p value_type created in-place from std::forward(args)... /** Returns \p true if inserting successful, \p false otherwise. */ @@ -337,11 +317,11 @@ namespace cds { namespace container { The functor may change any fields of the \p item.second that is \ref value_type. - You may pass \p func argument by reference using \p std::ref - Returns std::pair 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 list. + + @warning See \ref cds_intrusive_item_creating "insert item troubleshooting" */ template std::pair ensure( K const& key, Func func ) @@ -391,7 +371,6 @@ namespace cds { namespace container { void operator()(value_type& item) { ... } }; \endcode - The functor may be passed by reference using boost:ref Return \p true if key is found and deleted, \p false otherwise */ @@ -535,8 +514,6 @@ namespace cds { namespace container { \endcode where \p item is the item found. - You can pass \p f argument by reference using \p std::ref - The functor may change \p item.second. The function returns \p true if \p key is found, \p false otherwise. @@ -646,9 +623,6 @@ namespace cds { namespace container { } /// Checks if the map is empty - /** - Emptiness is checked by item counting: if item count is zero then the map is empty. - */ bool empty() const { return base_class::empty(); @@ -665,7 +639,6 @@ namespace cds { namespace container { { return base_class::statistics(); } - }; }} // namespace cds::container diff --git a/cds/container/impl/skip_list_set.h b/cds/container/impl/skip_list_set.h index ee1bb700..9d436121 100644 --- a/cds/container/impl/skip_list_set.h +++ b/cds/container/impl/skip_list_set.h @@ -36,30 +36,16 @@ namespace cds { namespace container { Template arguments: - \p GC - Garbage collector used. - \p T - type to be stored in the list. - - \p Traits - type traits. See skip_list::type_traits for explanation. - - It is possible to declare option-based list with cds::container::skip_list::make_traits metafunction istead of \p Traits template - argument. - Template argument list \p Options of cds::container::skip_list::make_traits metafunction are: - - opt::compare - key comparison functor. No default functor is provided. - If the option is not specified, the opt::less is used. - - opt::less - specifies binary predicate used for key comparison. Default is \p std::less. - - opt::item_counter - the type of item counting feature. Default is \ref atomicity::empty_item_counter that is no item counting. - - opt::memory_model - C++ memory ordering model. Can be opt::v::relaxed_ordering (relaxed memory model, the default) - or opt::v::sequential_consistent (sequentially consisnent memory model). - - skip_list::random_level_generator - random level generator. Can be skip_list::xorshift, skip_list::turbo_pascal or - user-provided one. See skip_list::random_level_generator option description for explanation. - Default is \p %skip_list::turbo_pascal. - - opt::allocator - allocator for skip-list node. Default is \ref CDS_DEFAULT_ALLOCATOR. - - opt::back_off - back-off strategy used. If the option is not specified, the cds::backoff::Default is used. - - opt::stat - internal statistics. Available types: skip_list::stat, skip_list::empty_stat (the default) - - \warning The skip-list requires up to 67 hazard pointers that may be critical for some GCs for which + - \p Traits - set traits, default is \p skip_list::traits. + It is possible to declare option-based list with \p cds::container::skip_list::make_traits metafunction + istead of \p Traits template argument. + + @warning The skip-list requires up to 67 hazard pointers that may be critical for some GCs for which the guard count is limited (like as \p gc::HP). Those GCs should be explicitly initialized with hazard pointer enough: \code cds::gc::HP myhp( 67 ) \endcode. Otherwise an run-time exception may be raised when you try to create skip-list object. - \note There are several specializations of \p %SkipListSet for each \p GC. You should include: + @note There are several specializations of \p %SkipListSet for each \p GC. You should include: - for \p gc::HP garbage collector - for \p gc::DHP garbage collector - for \ref cds_nonintrusive_SkipListSet_rcu "RCU type" @@ -104,14 +90,13 @@ namespace cds { namespace container { bool operator !=(iterator const& i ) const; }; \endcode - Note, the iterator object returned by \ref end, \p cend member functions points to \p nullptr and should not be dereferenced. - + Note, the iterator object returned by \p end(), \p cend() member functions points to \p nullptr and should not be dereferenced. */ template < typename GC, typename T, #ifdef CDS_DOXYGEN_INVOKED - typename Traits = skip_list::type_traits + typename Traits = skip_list::traits #else typename Traits #endif @@ -124,21 +109,21 @@ namespace cds { namespace container { #endif { //@cond - typedef details::make_skip_list_set< GC, T, Traits > maker; + typedef details::make_skip_list_set< GC, T, Traits > maker; typedef typename maker::type base_class; //@endcond public: - typedef typename base_class::gc gc ; ///< Garbage collector used - typedef T value_type ; ///< @anchor cds_containewr_SkipListSet_value_type Value type stored in the set - typedef Traits options ; ///< Options specified - - typedef typename base_class::back_off back_off ; ///< Back-off strategy used - typedef typename options::allocator allocator_type ; ///< Allocator type used for allocate/deallocate the skip-list nodes - typedef typename base_class::item_counter item_counter ; ///< Item counting policy used - typedef typename maker::key_comparator key_comparator ; ///< key comparison functor - typedef typename base_class::memory_model memory_model ; ///< Memory ordering. See cds::opt::memory_model option - typedef typename options::random_level_generator random_level_generator ; ///< random level generator - typedef typename options::stat stat ; ///< internal statistics type + typedef GC gc; ///< Garbage collector used + typedef T value_type; ///< @anchor cds_containewr_SkipListSet_value_type Value type to be stored in the set + typedef Traits traits; ///< Options specified + + typedef typename base_class::back_off back_off; ///< Back-off strategy + typedef typename traits::allocator allocator_type; ///< Allocator type used for allocate/deallocate the skip-list nodes + typedef typename base_class::item_counter item_counter; ///< Item counting policy used + typedef typename maker::key_comparator key_comparator; ///< key comparison functor + typedef typename base_class::memory_model memory_model; ///< Memory ordering. See cds::opt::memory_model option + typedef typename traits::random_level_generator random_level_generator; ///< random level generator + typedef typename traits::stat stat; ///< internal statistics type protected: //@cond @@ -249,8 +234,7 @@ namespace cds { namespace container { \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 + The user-defined functor is called only if the inserting is success. */ template bool insert( Q const& val, Func f ) @@ -283,16 +267,16 @@ namespace cds { namespace container { with arguments: - \p bNew - \p true if the item has been inserted, \p false otherwise - \p item - item of the set - - \p val - argument \p key passed into the \p ensure function + - \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 - Returns std::pair 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 See \ref cds_intrusive_item_creating "insert item troubleshooting" */ template std::pair ensure( const Q& val, Func func ) @@ -305,7 +289,7 @@ namespace cds { namespace container { return bRes; } - /// Inserts data of type \ref cds_containewr_SkipListSet_value_type "value_type" constructed with std::forward(args)... + /// Inserts data of type \p value_type created in-place from std::forward(args)... /** Returns \p true if inserting successful, \p false otherwise. */ @@ -359,7 +343,6 @@ namespace cds { namespace container { void operator()(value_type const& val); }; \endcode - The functor may be passed by reference using boost:ref Since the key of \p value_type is not explicitly specified, template parameter \p Q defines the key type to search in the list. @@ -367,8 +350,6 @@ namespace cds { namespace container { and the type \p Q. Return \p true if key is found and deleted, \p false otherwise - - See also: \ref erase */ template bool erase( Q const& key, Func f ) @@ -497,40 +478,35 @@ namespace cds { namespace container { return base_class::extract_max_( result.guard() ); } - /// Find the key \p val + /// Find the \p key /** \anchor cds_nonintrusive_SkipListSet_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 find 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 find 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 - 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 - bool find( Q& val, Func f ) + bool find( Q& key, Func f ) { - return base_class::find( val, [&f]( node_type& node, Q& v ) { f( node.m_Value, v ); }); + return base_class::find( key, [&f]( node_type& node, Q& v ) { f( node.m_Value, v ); }); } - /// Finds the key \p val using \p pred predicate for searching + /// Finds \p key using \p pred predicate for searching /** The function is an analog of \ref cds_nonintrusive_SkipListSet_find_func "find(Q&, Func)" but \p pred is used for key comparing. @@ -538,72 +514,28 @@ namespace cds { namespace container { \p Less must imply the same element order as the comparator used for building the set. */ template - bool find_with( Q& val, Less pred, Func f ) + bool find_with( Q& key, Less pred, Func f ) { - return base_class::find_with( val, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >(), + return base_class::find_with( key, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >(), [&f]( node_type& node, Q& v ) { f( node.m_Value, v ); } ); } - /// Find the key \p val - /** \anchor cds_nonintrusive_SkipListSet_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 find 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 - bool find( Q const& val, Func f ) - { - return base_class::find( val, [&f]( node_type& node, Q const& v ) { f( node.m_Value, v ); }); - } - - /// Finds the key \p val using \p pred predicate for searching - /** - The function is an analog of \ref cds_nonintrusive_SkipListSet_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 - bool find_with( Q const& val, Less cmp, Func f ) - { - return base_class::find_with( val, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >(), - [&f]( node_type& node, Q const& v ) { f( node.m_Value, v ); } ); - } - - /// Find the key \p val + /// Find \p key /** \anchor cds_nonintrusive_SkipListSet_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 - bool find( Q const& val ) + bool find( Q const& key ) { - return base_class::find( val ); + return base_class::find( key ); } - /// Finds the key \p val using \p pred predicate for searching + /// Finds \p key using \p pred predicate for searching /** The function is an analog of \ref cds_nonintrusive_SkipListSet_find_val "find(Q const&)" but \p pred is used for key comparing. @@ -611,9 +543,9 @@ namespace cds { namespace container { \p Less must imply the same element order as the comparator used for building the set. */ template - bool find_with( Q const& val, Less pred ) + bool find_with( Q const& key, Less pred ) { - return base_class::find_with( val, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >()); + return base_class::find_with( key, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >()); } /// Finds \p key and return the item found @@ -668,7 +600,7 @@ namespace cds { namespace container { return base_class::get_with_( result.guard(), key, cds::opt::details::make_comparator_from_less< wrapped_less >()); } - /// Clears the set (non-atomic). + /// Clears the set (not atomic). /** The function deletes all items from the set. The function is not atomic, thus, in multi-threaded environment with parallel insertions @@ -695,8 +627,8 @@ namespace cds { namespace container { /// Returns item count in the set /** The value returned depends on item counter type provided by \p Traits template parameter. - If it is atomicity::empty_item_counter this function always returns 0. - Therefore, the function is not suitable for checking the set emptiness, use \ref empty + If it is \p atomicity::empty_item_counter this function always returns 0. + Therefore, the function is not suitable for checking the set emptiness, use \p empty() member function for this purpose. */ size_t size() const @@ -709,7 +641,6 @@ namespace cds { namespace container { { return base_class::statistics(); } - }; }} // namespace cds::container diff --git a/cds/container/skip_list_map_nogc.h b/cds/container/skip_list_map_nogc.h index ce6f85b2..4aa63eca 100644 --- a/cds/container/skip_list_map_nogc.h +++ b/cds/container/skip_list_map_nogc.h @@ -29,31 +29,17 @@ namespace cds { namespace container { See \ref cds_nonintrusive_SkipListMap_hp "SkipListMap" for detailed description. Template arguments: - - \p K - type of a key to be stored in the list. - - \p T - type of a value to be stored in the list. - - \p Traits - type traits. See skip_list::type_traits for explanation. - - It is possible to declare option-based list with cds::container::skip_list::make_traits metafunction istead of \p Traits template - argument. - Template argument list \p Options of cds::container::skip_list::make_traits metafunction are: - - opt::compare - key compare functor. No default functor is provided. - If the option is not specified, the opt::less is used. - - opt::less - specifies binary predicate used for key comparison. Default is \p std::less. - - opt::item_counter - the type of item counting feature. Default is \ref atomicity::empty_item_counter that is no item counting. - - opt::memory_model - C++ memory ordering model. Can be opt::v::relaxed_ordering (relaxed memory model, the default) - or opt::v::sequential_consistent (sequentially consisnent memory model). - - skip_list::random_level_generator - random level generator. Can be skip_list::xorshift, skip_list::turbo_pascal or - user-provided one. See skip_list::random_level_generator option description for explanation. - Default is \p %skip_list::turbo_pascal. - - opt::allocator - allocator for skip-list node. Default is \ref CDS_DEFAULT_ALLOCATOR. - - opt::back_off - back-off strategy used. If the option is not specified, the cds::backoff::Default is used. - - opt::stat - internal statistics. Available types: skip_list::stat, skip_list::empty_stat (the default) + - \p K - type of a key to be stored in the map. + - \p T - type of a value to be stored in the map. + - \p Traits - map traits, default is \p skip_list::traits + It is possible to declare option-based list with \p cds::container::skip_list::make_traits + metafunction istead of \p Traits template argument. */ template < typename Key, typename T, #ifdef CDS_DOXYGEN_INVOKED - typename Traits = skip_list::type_traits + typename Traits = skip_list::traits #else typename Traits #endif @@ -78,48 +64,24 @@ namespace cds { namespace container { //@endcond public: - typedef typename base_class::gc gc ; ///< Garbage collector used - typedef Key key_type ; ///< Key type - typedef T mapped_type ; ///< Mapped type - typedef std::pair< key_type const, mapped_type> value_type ; ///< Key-value pair stored in the map - typedef Traits options ; ///< Options specified - - typedef typename base_class::back_off back_off ; ///< Back-off strategy used - typedef typename base_class::allocator_type allocator_type ; ///< Allocator type used for allocate/deallocate the skip-list nodes - typedef typename base_class::item_counter item_counter ; ///< Item counting policy used - typedef typename base_class::key_comparator key_comparator ; ///< key compare functor - typedef typename base_class::memory_model memory_model ; ///< Memory ordering. See cds::opt::memory_model option - typedef typename base_class::stat stat ; ///< internal statistics type - typedef typename base_class::random_level_generator random_level_generator ; ///< random level generator + typedef cds::gc::nogc gc; ///< Garbage collector + typedef Key key_type; ///< Key type + typedef T mapped_type; ///< Mapped type + typedef std::pair< key_type const, mapped_type> value_type; ///< Key-value pair stored in the map + typedef Traits traits; ///< Options specified + + typedef typename base_class::back_off back_off; ///< Back-off strategy + typedef typename base_class::allocator_type allocator_type; ///< Allocator type used for allocate/deallocate the skip-list nodes + typedef typename base_class::item_counter item_counter; ///< Item counting policy + typedef typename base_class::key_comparator key_comparator; ///< key compare functor + typedef typename base_class::memory_model memory_model; ///< Memory ordering, see \p cds::opt::memory_model option + typedef typename base_class::stat stat; ///< internal statistics type + typedef typename base_class::random_level_generator random_level_generator; ///< random level generator protected: //@cond typedef typename base_class::node_type node_type; typedef typename base_class::node_allocator node_allocator; - - /* - template - struct less_wrapper { - typedef Less less_op; - - bool operator()( value_type const& v1, value_type const& v2 ) const - { - return less_op()( v1.first, v2.first); - } - - template - bool operator()( value_type const& v1, Q const& v2 ) const - { - return less_op()( v1.first, v2 ); - } - - template - bool operator()( Q const& v1, value_type const& v2 ) const - { - return less_op()( v1, v2.first ); - } - }; - */ //@endcond public: @@ -164,28 +126,26 @@ namespace cds { namespace container { } /// Returns a forward const iterator addressing the first element in a map - //@{ const_iterator begin() const { return base_class::begin(); } + /// Returns a forward const iterator addressing the first element in a map const_iterator cbegin() const { return base_class::cbegin(); } - //@} /// Returns an const iterator that addresses the location succeeding the last element in a map - //@{ const_iterator end() const { return base_class::end(); } + /// Returns an const iterator that addresses the location succeeding the last element in a map const_iterator cend() const { return base_class::cend(); } - //@} public: /// Inserts new node with key and default value @@ -238,12 +198,10 @@ namespace cds { namespace container { to the map's item inserted. item.second is a reference to item's value that may be changed. User-defined functor \p func should guarantee that during changing item's value no any other changes could be made on this map's item by concurrent threads. - The user-defined functor can be passed by reference using \p std::ref - and it is called only if the inserting is successful. The key_type should be constructible from value of type \p K. - The function allows to split creating of new item into two part: + The function allows to split creating of new item into three part: - create item from \p key; - insert new item into the map; - if inserting is successful, initialize the value of item by calling \p f functor @@ -262,7 +220,7 @@ namespace cds { namespace container { return it; } - /// For key \p key inserts data of type \ref mapped_type constructed with std::forward(args)... + /// For key \p key inserts data of type \p mapped_type created in-place from \p args /** \p key_type should be constructible from type \p K @@ -334,9 +292,8 @@ namespace cds { namespace container { return base_class::get_max(); } - /// Clears the map (non-atomic) + /// Clears the map (not atomic) /** - The function is not atomic. Finding and/or inserting is prohibited while clearing. Otherwise an unpredictable result may be encountered. Thus, \p clear() may be used only for debugging purposes. diff --git a/cds/container/skip_list_map_rcu.h b/cds/container/skip_list_map_rcu.h index ea14f08c..25087d94 100644 --- a/cds/container/skip_list_map_rcu.h +++ b/cds/container/skip_list_map_rcu.h @@ -37,24 +37,9 @@ namespace cds { namespace container { - \p RCU - one of \ref cds_urcu_gc "RCU type". - \p K - type of a key to be stored in the list. - \p T - type of a value to be stored in the list. - - \p Traits - type traits. See skip_list::type_traits for explanation. - - It is possible to declare option-based list with cds::container::skip_list::make_traits metafunction istead of \p Traits template - argument. - Template argument list \p Options of cds::container::skip_list::make_traits metafunction are: - - opt::compare - key compare functor. No default functor is provided. - If the option is not specified, the opt::less is used. - - opt::less - specifies binary predicate used for key comparison. Default is \p std::less. - - opt::item_counter - the type of item counting feature. Default is \ref atomicity::empty_item_counter that is no item counting. - - opt::memory_model - C++ memory ordering model. Can be opt::v::relaxed_ordering (relaxed memory model, the default) - or opt::v::sequential_consistent (sequentially consisnent memory model). - - skip_list::random_level_generator - random level generator. Can be skip_list::xorshift, skip_list::turbo_pascal or - user-provided one. See skip_list::random_level_generator option description for explanation. - Default is \p %skip_list::turbo_pascal. - - opt::allocator - allocator for skip-list node. Default is \ref CDS_DEFAULT_ALLOCATOR. - - opt::back_off - back-off strategy used. If the option is not specified, the cds::backoff::Default is used. - - opt::stat - internal statistics. Available types: skip_list::stat, skip_list::empty_stat (the default) - - opt::rcu_check_deadlock - a deadlock checking policy. Default is opt::v::rcu_throw_deadlock + - \p Traits - map traits, default is \p skip_list::traits. + It is possible to declare option-based list with \p cds::container::skip_list::make_traits metafunction + instead of \p Traits template argument. Like STL map class, \p %SkipListMap stores its key-value pair as std:pair< K const, T>. @@ -104,7 +89,7 @@ namespace cds { namespace container { typename Key, typename T, #ifdef CDS_DOXYGEN_INVOKED - typename Traits = skip_list::type_traits + typename Traits = skip_list::traits #else typename Traits #endif @@ -121,23 +106,23 @@ namespace cds { namespace container { typedef typename maker::type base_class; //@endcond public: - typedef typename base_class::gc gc ; ///< Garbage collector used - typedef Key key_type ; ///< Key type - typedef T mapped_type ; ///< Mapped type + typedef cds::urcu::gc< RCU > gc; ///< Garbage collector used + typedef Key key_type; ///< Key type + typedef T mapped_type; ///< Mapped type # ifdef CDS_DOXYGEN_INVOKED - typedef std::pair< K const, T> value_type ; ///< Value type stored in the map + typedef std::pair< K const, T> value_type; ///< Value type stored in the map # else typedef typename maker::value_type value_type; # endif - typedef Traits options ; ///< Options specified + typedef Traits traits; ///< Map traits - typedef typename base_class::back_off back_off ; ///< Back-off strategy used - typedef typename options::allocator allocator_type ; ///< Allocator type used for allocate/deallocate the skip-list nodes - typedef typename base_class::item_counter item_counter ; ///< Item counting policy used - typedef typename maker::key_comparator key_comparator ; ///< key comparison functor - typedef typename base_class::memory_model memory_model ; ///< Memory ordering. See cds::opt::memory_model option - typedef typename options::random_level_generator random_level_generator ; ///< random level generator - typedef typename options::stat stat ; ///< internal statistics type + typedef typename base_class::back_off back_off; ///< Back-off strategy used + typedef typename traits::allocator allocator_type; ///< Allocator type used for allocate/deallocate the skip-list nodes + typedef typename base_class::item_counter item_counter; ///< Item counting policy used + typedef typename maker::key_comparator key_comparator; ///< key comparison functor + typedef typename base_class::memory_model memory_model; ///< Memory ordering. See cds::opt::memory_model option + typedef typename traits::random_level_generator random_level_generator; ///< random level generator + typedef typename traits::stat stat; ///< internal statistics type protected: //@cond @@ -192,16 +177,15 @@ namespace cds { namespace container { } /// Returns a forward const iterator addressing the first element in a map - //@{ const_iterator begin() const { return cbegin(); } + /// Returns a forward const iterator addressing the first element in a map const_iterator cbegin() const { return const_iterator( base_class::cbegin() ); } - //@} /// Returns a forward iterator that addresses the location succeeding the last element in a map. iterator end() @@ -210,16 +194,15 @@ namespace cds { namespace container { } /// Returns a forward const iterator that addresses the location succeeding the last element in a map. - //@{ const_iterator end() const { return cend(); } + /// Returns a forward const iterator that addresses the location succeeding the last element in a map. const_iterator cend() const { return const_iterator( base_class::cend() ); } - //@} public: /// Inserts new node with key and default value @@ -227,9 +210,9 @@ namespace cds { namespace container { The function creates a node with \p key and default value, and then inserts the node created into the map. Preconditions: - - The \ref key_type should be constructible from a value of type \p K. - In trivial case, \p K is equal to \ref key_type. - - The \ref mapped_type should be default-constructible. + - The \p key_type should be constructible from a value of type \p K. + In trivial case, \p K is equal to \p key_type. + - The \p mapped_type should be default-constructible. RCU \p synchronize method can be called. RCU should not be locked. @@ -247,8 +230,8 @@ namespace cds { namespace container { and then inserts the node created into the map. Preconditions: - - The \ref key_type should be constructible from \p key of type \p K. - - The \ref value_type should be constructible from \p val of type \p V. + - The \p key_type should be constructible from \p key of type \p K. + - The \p value_type should be constructible from \p val of type \p V. RCU \p synchronize method can be called. RCU should not be locked. @@ -281,12 +264,7 @@ namespace cds { namespace container { - item.first is a const reference to item's key that cannot be changed. - item.second is a reference to item's value that may be changed. - The user-defined functor can be passed by reference using \p std::ref - and it is called only if inserting is successful. - - The key_type should be constructible from value of type \p K. - - The function allows to split creating of new item into two part: + The function allows to split creating of new item into three part: - create item from \p key; - insert new item into the map; - if inserting is successful, initialize the value of item by calling \p func functor @@ -307,11 +285,11 @@ namespace cds { namespace container { return false; } - /// For key \p key inserts data of type \ref value_type constructed with std::forward(args)... + /// For key \p key inserts data of type \p value_type created in-place from \p args /** Returns \p true if inserting successful, \p false otherwise. - RCU \p synchronize method can be called. RCU should not be locked. + RCU \p synchronize() method can be called. RCU should not be locked. */ template bool emplace( K&& key, Args&&... args ) @@ -332,30 +310,25 @@ namespace cds { namespace container { is inserted into the map (note that in this case the \ref key_type should be constructible from type \p K). Otherwise, the functor \p func is called with item found. - The functor \p Func may be a function with signature: - \code - void func( bool bNew, value_type& item ); - \endcode - or a functor: + The functor \p Func interface is: \code struct my_functor { void operator()( bool bNew, value_type& item ); }; \endcode - with arguments: - \p bNew - \p true if the item has been inserted, \p false otherwise - \p item - item of the list - The functor may change any fields of the \p item.second that is \ref value_type. + The functor may change any fields of \p item.second. - You may pass \p func argument by reference using \p std::ref - - RCU \p synchronize method can be called. RCU should not be locked. + RCU \p synchronize() method can be called. RCU should not be locked. Returns std::pair 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 list. + + @warning See \ref cds_intrusive_item_creating "insert item troubleshooting" */ template std::pair ensure( K const& key, Func func ) @@ -407,7 +380,6 @@ namespace cds { namespace container { void operator()(value_type& item) { ... } }; \endcode - The functor may be passed by reference using boost:ref RCU \p synchronize method can be called. RCU should not be locked. @@ -442,7 +414,8 @@ namespace cds { namespace container { Note the compare functor from \p Traits class' template argument should accept a parameter of type \p K that can be not the same as \p key_type. - RCU \p synchronize method can be called. RCU should NOT be locked. + RCU \p synchronize() method can be called. RCU should NOT be locked. + The function does not free the item found. The item will be implicitly freed when \p result object is destroyed or when result.release() is called, see cds::urcu::exempt_ptr for explanation. @@ -473,6 +446,7 @@ namespace cds { namespace container { If the skip-list is empty the function returns \p false. RCU \p synchronize method can be called. RCU should NOT be locked. + The function does not free the item found. The item will be implicitly freed when \p result object is destroyed or when result.release() is called, see cds::urcu::exempt_ptr for explanation. @@ -489,6 +463,7 @@ namespace cds { namespace container { in \p result parameter. If the skip-list is empty the function returns \p false. RCU \p synchronize method can be called. RCU should NOT be locked. + The function does not free the item found. The item will be implicitly freed when \p result object is destroyed or when result.release() is called, see cds::urcu::exempt_ptr for explanation. @@ -511,8 +486,6 @@ namespace cds { namespace container { \endcode where \p item is the item found. - You can pass \p f argument by reference using \p std::ref. - The functor may change \p item.second. The function applies RCU lock internally. @@ -617,7 +590,7 @@ namespace cds { namespace container { return to_value_ptr( base_class::get_with( key, cds::details::predicate_wrapper< node_type, Less, typename maker::key_accessor >() )); } - /// Clears the map + /// Clears the map (not atomic) void clear() { base_class::clear(); @@ -645,8 +618,7 @@ namespace cds { namespace container { } /// Clears internal list of ready-to-delete items passing them to RCU reclamation cycle - /** - See \ref cds_intrusive_SkipListSet_rcu_force_dispose "intrusive SkipListSet" for explanation + /** @copydetails cds_intrusive_SkipListSet_rcu_force_dispose */ void force_dispose() { diff --git a/cds/container/skip_list_set_rcu.h b/cds/container/skip_list_set_rcu.h index 85bc71ad..56ceb71a 100644 --- a/cds/container/skip_list_set_rcu.h +++ b/cds/container/skip_list_set_rcu.h @@ -185,7 +185,7 @@ namespace cds { namespace container { static CDS_CONSTEXPR const bool c_bExtractLockExternal = base_class::c_bExtractLockExternal; /// pointer to extracted node - typedef cds::urcu::exempt_ptr< gc, node_type, value_type, typename maker::intrusive_type_traits::disposer > exempt_ptr; + typedef cds::urcu::exempt_ptr< gc, node_type, value_type, typename maker::intrusive_traits::disposer > exempt_ptr; protected: //@cond diff --git a/cds/intrusive/skip_list_rcu.h b/cds/intrusive/skip_list_rcu.h index b8749b85..18927600 100644 --- a/cds/intrusive/skip_list_rcu.h +++ b/cds/intrusive/skip_list_rcu.h @@ -1517,7 +1517,7 @@ retry: with arguments: - \p bNew - \p true if the item has been inserted, \p false otherwise - \p item - item of the set - - \p val - argument \p val passed into the \p ensure function + - \p val - argument \p val passed into the \p %ensure() function If new item has been inserted (i.e. \p bNew is \p true) then \p item and \p val arguments refer to the same thing. diff --git a/projects/Win/vc12/cds.vcxproj b/projects/Win/vc12/cds.vcxproj index 13e256b8..391591e1 100644 --- a/projects/Win/vc12/cds.vcxproj +++ b/projects/Win/vc12/cds.vcxproj @@ -693,6 +693,7 @@ + diff --git a/projects/Win/vc12/cds.vcxproj.filters b/projects/Win/vc12/cds.vcxproj.filters index a2508bb8..bed704df 100644 --- a/projects/Win/vc12/cds.vcxproj.filters +++ b/projects/Win/vc12/cds.vcxproj.filters @@ -1229,5 +1229,8 @@ Header Files\cds\container + + Header Files\cds\container + \ No newline at end of file diff --git a/projects/Win/vc12/hdr-test-map.vcxproj b/projects/Win/vc12/hdr-test-map.vcxproj index 3c43895e..cd30650a 100644 --- a/projects/Win/vc12/hdr-test-map.vcxproj +++ b/projects/Win/vc12/hdr-test-map.vcxproj @@ -569,9 +569,9 @@ + - diff --git a/projects/Win/vc12/hdr-test-map.vcxproj.filters b/projects/Win/vc12/hdr-test-map.vcxproj.filters index 9777cdcf..dc1016c6 100644 --- a/projects/Win/vc12/hdr-test-map.vcxproj.filters +++ b/projects/Win/vc12/hdr-test-map.vcxproj.filters @@ -46,9 +46,6 @@ skip_list - - skip_list - split_list @@ -181,6 +178,9 @@ split_list + + skip_list + diff --git a/projects/Win/vc12/hdr-test-set.vcxproj b/projects/Win/vc12/hdr-test-set.vcxproj index 5ed54a00..3eab4e97 100644 --- a/projects/Win/vc12/hdr-test-set.vcxproj +++ b/projects/Win/vc12/hdr-test-set.vcxproj @@ -607,9 +607,9 @@ + - diff --git a/projects/Win/vc12/hdr-test-set.vcxproj.filters b/projects/Win/vc12/hdr-test-set.vcxproj.filters index 70d1633c..e579d1ac 100644 --- a/projects/Win/vc12/hdr-test-set.vcxproj.filters +++ b/projects/Win/vc12/hdr-test-set.vcxproj.filters @@ -143,9 +143,6 @@ container\skip_list - - container\skip_list - container\split_list @@ -311,5 +308,8 @@ intrusive\skip_list + + container\skip_list + \ No newline at end of file diff --git a/tests/test-hdr/map/hdr_skiplist_map.h b/tests/test-hdr/map/hdr_skiplist_map.h index 7b00054d..9122af35 100644 --- a/tests/test-hdr/map/hdr_skiplist_map.h +++ b/tests/test-hdr/map/hdr_skiplist_map.h @@ -394,30 +394,30 @@ namespace map { void SkipList_HP_michaelalloc_cmp_stat(); void SkipList_HP_michaelalloc_cmpless_stat(); - void SkipList_PTB_less(); - void SkipList_PTB_cmp(); - void SkipList_PTB_cmpless(); - void SkipList_PTB_less_stat(); - void SkipList_PTB_cmp_stat(); - void SkipList_PTB_cmpless_stat(); - void SkipList_PTB_xorshift_less(); - void SkipList_PTB_xorshift_cmp(); - void SkipList_PTB_xorshift_cmpless(); - void SkipList_PTB_xorshift_less_stat(); - void SkipList_PTB_xorshift_cmp_stat(); - void SkipList_PTB_xorshift_cmpless_stat(); - void SkipList_PTB_turbopas_less(); - void SkipList_PTB_turbopas_cmp(); - void SkipList_PTB_turbopas_cmpless(); - void SkipList_PTB_turbopas_less_stat(); - void SkipList_PTB_turbopas_cmp_stat(); - void SkipList_PTB_turbopas_cmpless_stat(); - void SkipList_PTB_michaelalloc_less(); - void SkipList_PTB_michaelalloc_cmp(); - void SkipList_PTB_michaelalloc_cmpless(); - void SkipList_PTB_michaelalloc_less_stat(); - void SkipList_PTB_michaelalloc_cmp_stat(); - void SkipList_PTB_michaelalloc_cmpless_stat(); + void SkipList_DHP_less(); + void SkipList_DHP_cmp(); + void SkipList_DHP_cmpless(); + void SkipList_DHP_less_stat(); + void SkipList_DHP_cmp_stat(); + void SkipList_DHP_cmpless_stat(); + void SkipList_DHP_xorshift_less(); + void SkipList_DHP_xorshift_cmp(); + void SkipList_DHP_xorshift_cmpless(); + void SkipList_DHP_xorshift_less_stat(); + void SkipList_DHP_xorshift_cmp_stat(); + void SkipList_DHP_xorshift_cmpless_stat(); + void SkipList_DHP_turbopas_less(); + void SkipList_DHP_turbopas_cmp(); + void SkipList_DHP_turbopas_cmpless(); + void SkipList_DHP_turbopas_less_stat(); + void SkipList_DHP_turbopas_cmp_stat(); + void SkipList_DHP_turbopas_cmpless_stat(); + void SkipList_DHP_michaelalloc_less(); + void SkipList_DHP_michaelalloc_cmp(); + void SkipList_DHP_michaelalloc_cmpless(); + void SkipList_DHP_michaelalloc_less_stat(); + void SkipList_DHP_michaelalloc_cmp_stat(); + void SkipList_DHP_michaelalloc_cmpless_stat(); void SkipList_NOGC_less(); void SkipList_NOGC_cmp(); @@ -470,30 +470,30 @@ namespace map { CPPUNIT_TEST(SkipList_HP_michaelalloc_cmp_stat) CPPUNIT_TEST(SkipList_HP_michaelalloc_cmpless_stat) - CPPUNIT_TEST(SkipList_PTB_less) - CPPUNIT_TEST(SkipList_PTB_cmp) - CPPUNIT_TEST(SkipList_PTB_cmpless) - CPPUNIT_TEST(SkipList_PTB_less_stat) - CPPUNIT_TEST(SkipList_PTB_cmp_stat) - CPPUNIT_TEST(SkipList_PTB_cmpless_stat) - CPPUNIT_TEST(SkipList_PTB_xorshift_less) - CPPUNIT_TEST(SkipList_PTB_xorshift_cmp) - CPPUNIT_TEST(SkipList_PTB_xorshift_cmpless) - CPPUNIT_TEST(SkipList_PTB_xorshift_less_stat) - CPPUNIT_TEST(SkipList_PTB_xorshift_cmp_stat) - CPPUNIT_TEST(SkipList_PTB_xorshift_cmpless_stat) - CPPUNIT_TEST(SkipList_PTB_turbopas_less) - CPPUNIT_TEST(SkipList_PTB_turbopas_cmp) - CPPUNIT_TEST(SkipList_PTB_turbopas_cmpless) - CPPUNIT_TEST(SkipList_PTB_turbopas_less_stat) - CPPUNIT_TEST(SkipList_PTB_turbopas_cmp_stat) - CPPUNIT_TEST(SkipList_PTB_turbopas_cmpless_stat) - CPPUNIT_TEST(SkipList_PTB_michaelalloc_less) - CPPUNIT_TEST(SkipList_PTB_michaelalloc_cmp) - CPPUNIT_TEST(SkipList_PTB_michaelalloc_cmpless) - CPPUNIT_TEST(SkipList_PTB_michaelalloc_less_stat) - CPPUNIT_TEST(SkipList_PTB_michaelalloc_cmp_stat) - CPPUNIT_TEST(SkipList_PTB_michaelalloc_cmpless_stat) + CPPUNIT_TEST(SkipList_DHP_less) + CPPUNIT_TEST(SkipList_DHP_cmp) + CPPUNIT_TEST(SkipList_DHP_cmpless) + CPPUNIT_TEST(SkipList_DHP_less_stat) + CPPUNIT_TEST(SkipList_DHP_cmp_stat) + CPPUNIT_TEST(SkipList_DHP_cmpless_stat) + CPPUNIT_TEST(SkipList_DHP_xorshift_less) + CPPUNIT_TEST(SkipList_DHP_xorshift_cmp) + CPPUNIT_TEST(SkipList_DHP_xorshift_cmpless) + CPPUNIT_TEST(SkipList_DHP_xorshift_less_stat) + CPPUNIT_TEST(SkipList_DHP_xorshift_cmp_stat) + CPPUNIT_TEST(SkipList_DHP_xorshift_cmpless_stat) + CPPUNIT_TEST(SkipList_DHP_turbopas_less) + CPPUNIT_TEST(SkipList_DHP_turbopas_cmp) + CPPUNIT_TEST(SkipList_DHP_turbopas_cmpless) + CPPUNIT_TEST(SkipList_DHP_turbopas_less_stat) + CPPUNIT_TEST(SkipList_DHP_turbopas_cmp_stat) + CPPUNIT_TEST(SkipList_DHP_turbopas_cmpless_stat) + CPPUNIT_TEST(SkipList_DHP_michaelalloc_less) + CPPUNIT_TEST(SkipList_DHP_michaelalloc_cmp) + CPPUNIT_TEST(SkipList_DHP_michaelalloc_cmpless) + CPPUNIT_TEST(SkipList_DHP_michaelalloc_less_stat) + CPPUNIT_TEST(SkipList_DHP_michaelalloc_cmp_stat) + CPPUNIT_TEST(SkipList_DHP_michaelalloc_cmpless_stat) CPPUNIT_TEST(SkipList_NOGC_less) CPPUNIT_TEST(SkipList_NOGC_cmp) diff --git a/tests/test-hdr/map/hdr_skiplist_map_dhp.cpp b/tests/test-hdr/map/hdr_skiplist_map_dhp.cpp new file mode 100644 index 00000000..15de149a --- /dev/null +++ b/tests/test-hdr/map/hdr_skiplist_map_dhp.cpp @@ -0,0 +1,311 @@ +//$$CDS-header$$ + +#include "map/hdr_skiplist_map.h" +#include +#include "unit/michael_alloc.h" +#include "map/print_skiplist_stat.h" + +namespace map { + + void SkipListMapHdrTest::SkipList_DHP_less() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_cmp() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_cmpless() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_less_stat() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_cmp_stat() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_cmpless_stat() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_xorshift_less() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_xorshift_cmp() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_xorshift_cmpless() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_xorshift_less_stat() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_xorshift_cmp_stat() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_xorshift_cmpless_stat() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_turbopas_less() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_turbopas_cmp() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_turbopas_cmpless() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_turbopas_less_stat() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_turbopas_cmp_stat() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_turbopas_cmpless_stat() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_michaelalloc_less() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + ,co::allocator< memory::MichaelAllocator > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_michaelalloc_cmp() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::allocator< memory::MichaelAllocator > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_michaelalloc_cmpless() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::allocator< memory::MichaelAllocator > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_michaelalloc_less_stat() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,co::allocator< memory::MichaelAllocator > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_michaelalloc_cmp_stat() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,co::allocator< memory::MichaelAllocator > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListMapHdrTest::SkipList_DHP_michaelalloc_cmpless_stat() + { + typedef cc::SkipListMap< cds::gc::DHP, key_type, value_type, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,co::allocator< memory::MichaelAllocator > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } +} // namespace map diff --git a/tests/test-hdr/map/hdr_skiplist_map_hp.cpp b/tests/test-hdr/map/hdr_skiplist_map_hp.cpp index bf27665d..bbad002f 100644 --- a/tests/test-hdr/map/hdr_skiplist_map_hp.cpp +++ b/tests/test-hdr/map/hdr_skiplist_map_hp.cpp @@ -9,12 +9,12 @@ namespace map { void SkipListMapHdrTest::SkipList_HP_less() { - typedef cc::SkipListMap< cds::gc::HP, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - >::type - > set; + struct map_traits : public cc::skip_list::traits + { + typedef SkipListMapHdrTest::less less; + typedef simple_item_counter item_counter; + }; + typedef cc::SkipListMap< cds::gc::HP, key_type, value_type, map_traits > set; test< set, misc::print_skiplist_stat >(); } diff --git a/tests/test-hdr/map/hdr_skiplist_map_nogc.cpp b/tests/test-hdr/map/hdr_skiplist_map_nogc.cpp index 3d0b909c..7d2e4fdd 100644 --- a/tests/test-hdr/map/hdr_skiplist_map_nogc.cpp +++ b/tests/test-hdr/map/hdr_skiplist_map_nogc.cpp @@ -9,12 +9,12 @@ namespace map { void SkipListMapHdrTest::SkipList_NOGC_less() { - typedef cc::SkipListMap< cds::gc::nogc, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - >::type - > set; + struct map_traits : public cc::skip_list::traits + { + typedef SkipListMapHdrTest::less less; + typedef simple_item_counter item_counter; + }; + typedef cc::SkipListMap< cds::gc::nogc, key_type, value_type, map_traits > set; test_nogc< set, misc::print_skiplist_stat >(); } diff --git a/tests/test-hdr/map/hdr_skiplist_map_ptb.cpp b/tests/test-hdr/map/hdr_skiplist_map_ptb.cpp deleted file mode 100644 index 7405d776..00000000 --- a/tests/test-hdr/map/hdr_skiplist_map_ptb.cpp +++ /dev/null @@ -1,311 +0,0 @@ -//$$CDS-header$$ - -#include "map/hdr_skiplist_map.h" -#include -#include "unit/michael_alloc.h" -#include "map/print_skiplist_stat.h" - -namespace map { - - void SkipListMapHdrTest::SkipList_PTB_less() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_cmp() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_cmpless() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_less_stat() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_cmp_stat() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_cmpless_stat() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_xorshift_less() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_xorshift_cmp() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_xorshift_cmpless() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_xorshift_less_stat() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_xorshift_cmp_stat() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_xorshift_cmpless_stat() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_turbopas_less() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_turbopas_cmp() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_turbopas_cmpless() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_turbopas_less_stat() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_turbopas_cmp_stat() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_turbopas_cmpless_stat() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_michaelalloc_less() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - ,co::allocator< memory::MichaelAllocator > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_michaelalloc_cmp() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::allocator< memory::MichaelAllocator > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_michaelalloc_cmpless() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::allocator< memory::MichaelAllocator > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_michaelalloc_less_stat() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,co::allocator< memory::MichaelAllocator > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_michaelalloc_cmp_stat() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,co::allocator< memory::MichaelAllocator > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListMapHdrTest::SkipList_PTB_michaelalloc_cmpless_stat() - { - typedef cc::SkipListMap< cds::gc::PTB, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,co::allocator< memory::MichaelAllocator > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } -} // namespace map diff --git a/tests/test-hdr/map/hdr_skiplist_map_rcu_gpb.cpp b/tests/test-hdr/map/hdr_skiplist_map_rcu_gpb.cpp index a2e47498..2e9e69cc 100644 --- a/tests/test-hdr/map/hdr_skiplist_map_rcu_gpb.cpp +++ b/tests/test-hdr/map/hdr_skiplist_map_rcu_gpb.cpp @@ -15,12 +15,12 @@ namespace map { void SkipListMapRCUHdrTest::SkipList_RCU_GPB_less() { - typedef cc::SkipListMap< rcu_type, key_type, value_type, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - >::type - > set; + struct map_traits : public cc::skip_list::traits + { + typedef SkipListMapRCUHdrTest::less less; + typedef simple_item_counter item_counter; + }; + typedef cc::SkipListMap< rcu_type, key_type, value_type, map_traits > set; test< set, misc::print_skiplist_stat >(); } diff --git a/tests/test-hdr/set/hdr_skiplist_set.h b/tests/test-hdr/set/hdr_skiplist_set.h index 7a2d4be4..2cd81163 100644 --- a/tests/test-hdr/set/hdr_skiplist_set.h +++ b/tests/test-hdr/set/hdr_skiplist_set.h @@ -431,30 +431,30 @@ namespace set { void SkipList_HP_michaelalloc_cmp_stat(); void SkipList_HP_michaelalloc_cmpless_stat(); - void SkipList_PTB_less(); - void SkipList_PTB_cmp(); - void SkipList_PTB_cmpless(); - void SkipList_PTB_less_stat(); - void SkipList_PTB_cmp_stat(); - void SkipList_PTB_cmpless_stat(); - void SkipList_PTB_xorshift_less(); - void SkipList_PTB_xorshift_cmp(); - void SkipList_PTB_xorshift_cmpless(); - void SkipList_PTB_xorshift_less_stat(); - void SkipList_PTB_xorshift_cmp_stat(); - void SkipList_PTB_xorshift_cmpless_stat(); - void SkipList_PTB_turbopas_less(); - void SkipList_PTB_turbopas_cmp(); - void SkipList_PTB_turbopas_cmpless(); - void SkipList_PTB_turbopas_less_stat(); - void SkipList_PTB_turbopas_cmp_stat(); - void SkipList_PTB_turbopas_cmpless_stat(); - void SkipList_PTB_michaelalloc_less(); - void SkipList_PTB_michaelalloc_cmp(); - void SkipList_PTB_michaelalloc_cmpless(); - void SkipList_PTB_michaelalloc_less_stat(); - void SkipList_PTB_michaelalloc_cmp_stat(); - void SkipList_PTB_michaelalloc_cmpless_stat(); + void SkipList_DHP_less(); + void SkipList_DHP_cmp(); + void SkipList_DHP_cmpless(); + void SkipList_DHP_less_stat(); + void SkipList_DHP_cmp_stat(); + void SkipList_DHP_cmpless_stat(); + void SkipList_DHP_xorshift_less(); + void SkipList_DHP_xorshift_cmp(); + void SkipList_DHP_xorshift_cmpless(); + void SkipList_DHP_xorshift_less_stat(); + void SkipList_DHP_xorshift_cmp_stat(); + void SkipList_DHP_xorshift_cmpless_stat(); + void SkipList_DHP_turbopas_less(); + void SkipList_DHP_turbopas_cmp(); + void SkipList_DHP_turbopas_cmpless(); + void SkipList_DHP_turbopas_less_stat(); + void SkipList_DHP_turbopas_cmp_stat(); + void SkipList_DHP_turbopas_cmpless_stat(); + void SkipList_DHP_michaelalloc_less(); + void SkipList_DHP_michaelalloc_cmp(); + void SkipList_DHP_michaelalloc_cmpless(); + void SkipList_DHP_michaelalloc_less_stat(); + void SkipList_DHP_michaelalloc_cmp_stat(); + void SkipList_DHP_michaelalloc_cmpless_stat(); void SkipList_NOGC_less(); void SkipList_NOGC_cmp(); @@ -507,30 +507,30 @@ namespace set { CPPUNIT_TEST(SkipList_HP_michaelalloc_cmp_stat) CPPUNIT_TEST(SkipList_HP_michaelalloc_cmpless_stat) - CPPUNIT_TEST(SkipList_PTB_less) - CPPUNIT_TEST(SkipList_PTB_cmp) - CPPUNIT_TEST(SkipList_PTB_cmpless) - CPPUNIT_TEST(SkipList_PTB_less_stat) - CPPUNIT_TEST(SkipList_PTB_cmp_stat) - CPPUNIT_TEST(SkipList_PTB_cmpless_stat) - CPPUNIT_TEST(SkipList_PTB_xorshift_less) - CPPUNIT_TEST(SkipList_PTB_xorshift_cmp) - CPPUNIT_TEST(SkipList_PTB_xorshift_cmpless) - CPPUNIT_TEST(SkipList_PTB_xorshift_less_stat) - CPPUNIT_TEST(SkipList_PTB_xorshift_cmp_stat) - CPPUNIT_TEST(SkipList_PTB_xorshift_cmpless_stat) - CPPUNIT_TEST(SkipList_PTB_turbopas_less) - CPPUNIT_TEST(SkipList_PTB_turbopas_cmp) - CPPUNIT_TEST(SkipList_PTB_turbopas_cmpless) - CPPUNIT_TEST(SkipList_PTB_turbopas_less_stat) - CPPUNIT_TEST(SkipList_PTB_turbopas_cmp_stat) - CPPUNIT_TEST(SkipList_PTB_turbopas_cmpless_stat) - CPPUNIT_TEST(SkipList_PTB_michaelalloc_less) - CPPUNIT_TEST(SkipList_PTB_michaelalloc_cmp) - CPPUNIT_TEST(SkipList_PTB_michaelalloc_cmpless) - CPPUNIT_TEST(SkipList_PTB_michaelalloc_less_stat) - CPPUNIT_TEST(SkipList_PTB_michaelalloc_cmp_stat) - CPPUNIT_TEST(SkipList_PTB_michaelalloc_cmpless_stat) + CPPUNIT_TEST(SkipList_DHP_less) + CPPUNIT_TEST(SkipList_DHP_cmp) + CPPUNIT_TEST(SkipList_DHP_cmpless) + CPPUNIT_TEST(SkipList_DHP_less_stat) + CPPUNIT_TEST(SkipList_DHP_cmp_stat) + CPPUNIT_TEST(SkipList_DHP_cmpless_stat) + CPPUNIT_TEST(SkipList_DHP_xorshift_less) + CPPUNIT_TEST(SkipList_DHP_xorshift_cmp) + CPPUNIT_TEST(SkipList_DHP_xorshift_cmpless) + CPPUNIT_TEST(SkipList_DHP_xorshift_less_stat) + CPPUNIT_TEST(SkipList_DHP_xorshift_cmp_stat) + CPPUNIT_TEST(SkipList_DHP_xorshift_cmpless_stat) + CPPUNIT_TEST(SkipList_DHP_turbopas_less) + CPPUNIT_TEST(SkipList_DHP_turbopas_cmp) + CPPUNIT_TEST(SkipList_DHP_turbopas_cmpless) + CPPUNIT_TEST(SkipList_DHP_turbopas_less_stat) + CPPUNIT_TEST(SkipList_DHP_turbopas_cmp_stat) + CPPUNIT_TEST(SkipList_DHP_turbopas_cmpless_stat) + CPPUNIT_TEST(SkipList_DHP_michaelalloc_less) + CPPUNIT_TEST(SkipList_DHP_michaelalloc_cmp) + CPPUNIT_TEST(SkipList_DHP_michaelalloc_cmpless) + CPPUNIT_TEST(SkipList_DHP_michaelalloc_less_stat) + CPPUNIT_TEST(SkipList_DHP_michaelalloc_cmp_stat) + CPPUNIT_TEST(SkipList_DHP_michaelalloc_cmpless_stat) CPPUNIT_TEST(SkipList_NOGC_less) CPPUNIT_TEST(SkipList_NOGC_cmp) diff --git a/tests/test-hdr/set/hdr_skiplist_set_dhp.cpp b/tests/test-hdr/set/hdr_skiplist_set_dhp.cpp new file mode 100644 index 00000000..460b9753 --- /dev/null +++ b/tests/test-hdr/set/hdr_skiplist_set_dhp.cpp @@ -0,0 +1,312 @@ +//$$CDS-header$$ + +#include "set/hdr_skiplist_set.h" +#include +#include "unit/michael_alloc.h" +#include "map/print_skiplist_stat.h" + +namespace set { + + void SkipListSetHdrTest::SkipList_DHP_less() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_cmp() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_cmpless() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_less_stat() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_cmp_stat() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_cmpless_stat() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_xorshift_less() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_xorshift_cmp() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_xorshift_cmpless() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_xorshift_less_stat() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_xorshift_cmp_stat() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_xorshift_cmpless_stat() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_turbopas_less() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_turbopas_cmp() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_turbopas_cmpless() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_turbopas_less_stat() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_turbopas_cmp_stat() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_turbopas_cmpless_stat() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_michaelalloc_less() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + ,co::allocator< memory::MichaelAllocator > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_michaelalloc_cmp() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::allocator< memory::MichaelAllocator > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_michaelalloc_cmpless() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::allocator< memory::MichaelAllocator > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_michaelalloc_less_stat() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::less< less > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,co::allocator< memory::MichaelAllocator > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_michaelalloc_cmp_stat() + { + typedef cc::SkipListSet< cds::gc::DHP, item, + cc::skip_list::make_traits< + co::compare< cmp > + ,co::item_counter< simple_item_counter > + ,co::stat< cc::skip_list::stat<> > + ,co::allocator< memory::MichaelAllocator > + >::type + > set; + test< set, misc::print_skiplist_stat >(); + } + + void SkipListSetHdrTest::SkipList_DHP_michaelalloc_cmpless_stat() + { + struct set_traits : public cc::skip_list::traits + { + typedef SkipListSetHdrTest::less less; + typedef cmp compare; + typedef simple_item_counter item_counter; + typedef cc::skip_list::stat<> stat; + typedef memory::MichaelAllocator allocator; + }; + + typedef cc::SkipListSet< cds::gc::DHP, item, set_traits > set; + test< set, misc::print_skiplist_stat >(); + } +} // namespace set diff --git a/tests/test-hdr/set/hdr_skiplist_set_hp.cpp b/tests/test-hdr/set/hdr_skiplist_set_hp.cpp index 1f120cff..00eaed1b 100644 --- a/tests/test-hdr/set/hdr_skiplist_set_hp.cpp +++ b/tests/test-hdr/set/hdr_skiplist_set_hp.cpp @@ -9,12 +9,12 @@ namespace set { void SkipListSetHdrTest::SkipList_HP_less() { - typedef cc::SkipListSet< cds::gc::HP, item, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - >::type - > set; + struct set_traits : public cc::skip_list::traits + { + typedef SkipListSetHdrTest::less less; + typedef simple_item_counter item_counter; + }; + typedef cc::SkipListSet< cds::gc::HP, item, set_traits > set; test< set, misc::print_skiplist_stat >(); } diff --git a/tests/test-hdr/set/hdr_skiplist_set_nogc.cpp b/tests/test-hdr/set/hdr_skiplist_set_nogc.cpp index e80b73cf..063dff78 100644 --- a/tests/test-hdr/set/hdr_skiplist_set_nogc.cpp +++ b/tests/test-hdr/set/hdr_skiplist_set_nogc.cpp @@ -9,12 +9,12 @@ namespace set { void SkipListSetHdrTest::SkipList_NOGC_less() { - typedef cc::SkipListSet< cds::gc::nogc, item, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - >::type - > set; + struct set_traits : public cc::skip_list::traits + { + typedef SkipListSetHdrTest::less less; + typedef simple_item_counter item_counter; + }; + typedef cc::SkipListSet< cds::gc::nogc, item, set_traits > set; test_nogc< set, misc::print_skiplist_stat >(); } diff --git a/tests/test-hdr/set/hdr_skiplist_set_ptb.cpp b/tests/test-hdr/set/hdr_skiplist_set_ptb.cpp deleted file mode 100644 index 60366f8f..00000000 --- a/tests/test-hdr/set/hdr_skiplist_set_ptb.cpp +++ /dev/null @@ -1,311 +0,0 @@ -//$$CDS-header$$ - -#include "set/hdr_skiplist_set.h" -#include -#include "unit/michael_alloc.h" -#include "map/print_skiplist_stat.h" - -namespace set { - - void SkipListSetHdrTest::SkipList_PTB_less() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_cmp() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_cmpless() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_less_stat() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_cmp_stat() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_cmpless_stat() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_xorshift_less() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_xorshift_cmp() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_xorshift_cmpless() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_xorshift_less_stat() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_xorshift_cmp_stat() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_xorshift_cmpless_stat() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_turbopas_less() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_turbopas_cmp() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_turbopas_cmpless() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_turbopas_less_stat() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_turbopas_cmp_stat() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_turbopas_cmpless_stat() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_michaelalloc_less() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - ,co::allocator< memory::MichaelAllocator > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_michaelalloc_cmp() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::allocator< memory::MichaelAllocator > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_michaelalloc_cmpless() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::allocator< memory::MichaelAllocator > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_michaelalloc_less_stat() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,co::allocator< memory::MichaelAllocator > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_michaelalloc_cmp_stat() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,co::allocator< memory::MichaelAllocator > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } - - void SkipListSetHdrTest::SkipList_PTB_michaelalloc_cmpless_stat() - { - typedef cc::SkipListSet< cds::gc::PTB, item, - cc::skip_list::make_traits< - co::less< less > - ,co::compare< cmp > - ,co::item_counter< simple_item_counter > - ,co::stat< cc::skip_list::stat<> > - ,co::allocator< memory::MichaelAllocator > - >::type - > set; - test< set, misc::print_skiplist_stat >(); - } -} // namespace set diff --git a/tests/test-hdr/set/hdr_skiplist_set_rcu_gpb.cpp b/tests/test-hdr/set/hdr_skiplist_set_rcu_gpb.cpp index fefafa92..719d8f28 100644 --- a/tests/test-hdr/set/hdr_skiplist_set_rcu_gpb.cpp +++ b/tests/test-hdr/set/hdr_skiplist_set_rcu_gpb.cpp @@ -15,12 +15,12 @@ namespace set { void SkipListSetRCUHdrTest::SkipList_RCU_GPB_less() { - typedef cc::SkipListSet< rcu_type, item, - cc::skip_list::make_traits< - co::less< less > - ,co::item_counter< simple_item_counter > - >::type - > set; + struct set_traits : public cc::skip_list::traits + { + typedef SkipListSetRCUHdrTest::less less; + typedef simple_item_counter item_counter; + }; + typedef cc::SkipListSet< rcu_type, item, set_traits > set; test< set, misc::print_skiplist_stat >(); }