among \p Options template arguments.
The \p Options are:
- - \p opt::mutex_policy - concurrent access policy.
- Available policies: \p intrusive::striped_set::striping, \p intrusive::striped_set::refinable.
- Default is %striped_set::striping.
- - \p opt::hash - hash functor. Default option value see <tt>opt::v::hash_selector<opt::none> </tt>
+ - \p cds::opt::mutex_policy - concurrent access policy.
+ Available policies: \p striped_set::striping, \p striped_set::refinable.
+ Default is \p %striped_set::striping.
+ - \p cds::opt::hash - hash functor. Default option value see <tt>opt::v::hash_selector<opt::none> </tt>
which selects default hash functor for your compiler.
- - \p opt::compare - key comparison functor. No default functor is provided.
+ - \p cds::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<T>.
- - \p opt::item_counter - item counter type. Default is \p atomicity::item_counter since some operation on the counter is performed
+ - \p cds::opt::less - specifies binary predicate used for key comparison. Default is \p std::less<T>.
+ - \p cds::opt::item_counter - item counter type. Default is \p atomicity::item_counter since some operation on the counter is performed
without locks. Note that item counting is an essential part of the map algorithm, so dummy counter
like as \p atomicity::empty_item_counter is not suitable.
- - \p opt::allocator - the allocator type using for memory allocation of bucket table and lock array. Default is \ref CDS_DEFAULT_ALLOCATOR.
- - \p opt::resizing_policy - the resizing policy that is a functor that decides when to resize the hash map.
+ - \p cds::opt::allocator - the allocator type using for memory allocation of bucket table and lock array. Default is \ref CDS_DEFAULT_ALLOCATOR.
+ - \p cds::opt::resizing_policy - the resizing policy that is a functor that decides when to resize the hash map.
Default option value depends on bucket container type:
for sequential containers like \p std::list, \p std::vector the resizing policy is <tt>striped_set::load_factor_resizing<4> </tt>;
for other type of containers like \p std::map, \p std::unordered_map the resizing policy is \p striped_set::no_resizing.
significantly improve performance.
For other, non-sequential types of \p Container (like a \p std::map)
the resizing policy is not so important.
- - \p opt::copy_policy - the copy policy which is used to copy items from the old map to the new one when resizing.
+ - \p cds::opt::copy_policy - the copy policy which is used to copy items from the old map to the new one when resizing.
The policy can be optionally used in adapted bucket container for performance reasons of resizing.
The detail of copy algorithm depends on type of bucket container and explains below.
typedef typename base_class::allocator_type allocator_type ; ///< allocator type specified in options.
typedef typename base_class::mutex_policy mutex_policy ; ///< Mutex policy
- //@cond
- typedef cds::container::striped_set::implementation_tag implementation_tag;
- //@endcond
protected:
//@cond
typedef typename base_class::scoped_cell_lock scoped_cell_lock;
typedef typename base_class::allocator_type allocator_type ; ///< allocator type specified in options.
typedef typename base_class::mutex_policy mutex_policy ; ///< Mutex policy
- //@cond
- typedef cds::container::striped_set::implementation_tag implementation_tag;
- //@endcond
-
protected:
//@cond
typedef typename base_class::scoped_cell_lock scoped_cell_lock;
namespace cds { namespace container {
/// Striped hash set related definitions
namespace striped_set {
- using cds::intrusive::striped_set::implementation_tag;
//@cond
struct copy_item ; // copy_item_policy tag
//@cond
using cds::intrusive::striped_set::adapted_sequential_container;
using cds::intrusive::striped_set::adapted_container;
+ //@endcond
- using cds::intrusive::striped_set::load_factor_resizing;
- using cds::intrusive::striped_set::rational_load_factor_resizing;
- using cds::intrusive::striped_set::single_bucket_size_threshold;
- using cds::intrusive::striped_set::no_resizing;
+ ///@copydoc cds::intrusive::striped_set::load_factor_resizing
+ template <size_t LoadFactor>
+ using load_factor_resizing = cds::intrusive::striped_set::load_factor_resizing<LoadFactor>;
- using cds::intrusive::striped_set::striping;
- using cds::intrusive::striped_set::refinable;
- //@endcond
+ ///@copydoc cds::intrusive::striped_set::rational_load_factor_resizing
+ template <size_t Numerator, size_t Denominator = 1>
+ using rational_load_factor_resizing = cds::intrusive::striped_set::rational_load_factor_resizing<Numerator, Denominator>;
+
+ ///@copydoc cds::intrusive::striped_set::single_bucket_size_threshold
+ template <size_t Threshold>
+ using single_bucket_size_threshold = cds::intrusive::striped_set::single_bucket_size_threshold<Threshold>;
+
+ ///@copydoc cds::intrusive::striped_set::no_resizing
+ typedef cds::intrusive::striped_set::no_resizing no_resizing;
+
+ ///@copydoc cds::intrusive::striped_set::striping
+ template <class Lock = std::mutex, class Alloc = CDS_DEFAULT_ALLOCATOR >
+ using striping = cds::intrusive::striped_set::striping<Lock, Alloc>;
+
+ ///@copydoc cds::intrusive::striped_set::refinable
+ template <
+ class RecursiveLock = std::recursive_mutex,
+ typename BackOff = cds::backoff::yield,
+ class Alloc = CDS_DEFAULT_ALLOCATOR
+ >
+ using refinable = cds::intrusive::striped_set::refinable<RecursiveLock, BackOff, Alloc >;
//@cond
namespace details {
+++ /dev/null
-//$$CDS-header$$
-
-#ifndef CDSLIB_OPT_MAKE_OPTIONS_VAR_H
-#define CDSLIB_OPT_MAKE_OPTIONS_VAR_H
-
-#ifndef CDSLIB_OPT_OPTIONS_H
-# error <cds/opt/options.h> must be included instead of <cds/opt/make_options_var.h>
-#endif
-
-namespace cds { namespace opt {
-
- //@cond
- namespace details {
- template <typename OptionList, typename Option>
- struct do_pack
- {
- // Use "pack" member template to pack options
- typedef typename Option::template pack<OptionList> type;
- };
-
- template <typename ...T> class typelist;
-
- template <typename Typelist> struct typelist_head;
- template <typename Head, typename ...Tail>
- struct typelist_head< typelist<Head, Tail...> > {
- typedef Head type;
- };
- template <typename Head>
- struct typelist_head< typelist<Head> > {
- typedef Head type;
- };
-
- template <typename Typelist> struct typelist_tail;
- template <typename Head, typename ...Tail>
- struct typelist_tail< typelist<Head, Tail...> > {
- typedef typelist<Tail...> type;
- };
- template <typename Head>
- struct typelist_tail< typelist<Head> > {
- typedef typelist<> type;
- };
-
- template <typename OptionList, typename Typelist>
- struct make_options_impl {
- typedef typename make_options_impl<
- typename do_pack<
- OptionList,
- typename typelist_head< Typelist >::type
- >::type,
- typename typelist_tail<Typelist>::type
- >::type type;
- };
-
- template <typename OptionList>
- struct make_options_impl<OptionList, typelist<> > {
- typedef OptionList type;
- };
- } // namespace details
- //@endcond
-
- /// make_options metafunction
- /** @headerfile cds/opt/options.h
-
- The metafunction converts option list \p Options to traits structure.
- The result of metafunction is \p type.
-
- Template parameter \p OptionList is default option set (default traits).
- \p Options is option list.
- */
- template <typename OptionList, typename... Options>
- struct make_options {
-#ifdef CDS_DOXYGEN_INVOKED
- typedef implementation_defined type ; ///< Result of the metafunction
-#else
- typedef typename details::make_options_impl< OptionList, details::typelist<Options...> >::type type;
-#endif
- };
-
-
- // *****************************************************************
- // find_type_traits metafunction
- // *****************************************************************
-
- //@cond
- namespace details {
- template <typename... Options>
- struct find_type_traits_option;
-
- template <>
- struct find_type_traits_option<> {
- typedef cds::opt::none type;
- };
-
- template <typename Any>
- struct find_type_traits_option< Any > {
- typedef cds::opt::none type;
- };
-
- template <typename Any>
- struct find_type_traits_option< cds::opt::type_traits< Any > > {
- typedef Any type;
- };
-
- template <typename Any, typename... Options>
- struct find_type_traits_option< cds::opt::type_traits< Any >, Options... > {
- typedef Any type;
- };
-
- template <typename Any, typename... Options>
- struct find_type_traits_option< Any, Options... > {
- typedef typename find_type_traits_option< Options... >::type type;
- };
- } // namespace details
- //@endcond
-
- /// Metafunction to find opt::type_traits option in \p Options list
- /** @headerfile cds/opt/options.h
-
- If \p Options contains opt::type_traits option then it is the metafunction result.
- Otherwise the result is \p DefaultOptons.
- */
- template <typename DefaultOptions, typename... Options>
- struct find_type_traits {
- typedef typename select_default< typename details::find_type_traits_option<Options...>::type, DefaultOptions>::type type ; ///< Metafunction result
- };
-
-
- // *****************************************************************
- // find_option metafunction
- // *****************************************************************
-
- //@cond
- namespace details {
- template <typename What, typename... Options>
- struct find_option;
-
- struct compare_ok;
- struct compare_fail;
-
- template <typename A, typename B>
- struct compare_option
- {
- typedef compare_fail type;
- };
-
- template <template <typename> class Opt, typename A, typename B>
- struct compare_option< Opt<A>, Opt<B> >
- {
- typedef compare_ok type;
- };
-
- // Specializations for integral type of option
-#define CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_( _type ) template <template <_type> class What, _type A, _type B> \
- struct compare_option< What<A>, What<B> > { typedef compare_ok type ; };
-
- // For user-defined enum types
-#define CDS_DECLARE_FIND_OPTION_INTEGRAL_SPECIALIZATION( _type ) namespace cds { namespace opt { namespace details { CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(_type ) }}}
-
- CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(bool)
- CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(char)
- CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(unsigned char)
- CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(signed char)
- CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(short int)
- CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(unsigned short int)
- CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(int)
- CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(unsigned int)
- CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(long)
- CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(unsigned long)
- CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(long long)
- CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(unsigned long long)
-
-
- template <typename CompResult, typename Ok, typename Fail>
- struct select_option
- {
- typedef Fail type;
- };
-
- template <typename Ok, typename Fail>
- struct select_option< compare_ok, Ok, Fail >
- {
- typedef Ok type;
- };
-
- template <typename What>
- struct find_option< What > {
- typedef What type;
- };
-
- template <typename What, typename Opt>
- struct find_option< What, Opt > {
- typedef typename select_option<
- typename compare_option< What, Opt >::type
- ,Opt
- ,What
- >::type type;
- };
-
- template <typename What, typename Opt, typename... Options>
- struct find_option< What, Opt, Options... > {
- typedef typename select_option<
- typename compare_option< What, Opt >::type
- ,Opt
- ,typename find_option< What, Options... >::type
- >::type type;
- };
- } // namespace details
- //@endcond
-
- /// Metafunction to find \p What option in \p Options list
- /** @headerfile cds/opt/options.h
-
- If \p Options contains \p What< Val > option for any \p Val then the result is \p What< Val >
- Otherwise the result is \p What.
-
- Example:
- \code
- #include <cds/opt/options.h>
- namespace co = cds::opt;
-
- struct default_tag;
- struct tag_a;
- struct tag_b;
-
- // Find option co::tag.
-
- // res1 is co::tag< tag_a >
- typedef co::find_option< co::tag< default_tag >, co::gc< cds::gc::HP >, co::tag< tag_a > >::type res1;
-
- // res2 is default co::tag< default_tag >
- typedef co::find_option< co::tag< default_tag >, co::less< x >, co::hash< H > >::type res2;
-
- // Multiple option co::tag. The first option is selected
- // res3 is default co::tag< tag_a >
- typedef co::find_option< co::tag< default_tag >, co::tag< tag_a >, co::tag< tag_b > >::type res3;
-
- \endcode
- */
- template <typename What, typename... Options>
- struct find_option {
- typedef typename details::find_option<What, Options...>::type type ; ///< Metafunction result
- };
-
-
- // *****************************************************************
- // select metafunction
- // *****************************************************************
-
- //@cond
- namespace details {
-
- template <typename What, typename... Pairs>
- struct select;
-
- template <typename What, typename Value>
- struct select< What, What, Value>
- {
- typedef Value type;
- };
-
- template <typename What, typename Tag, typename Value>
- struct select<What, Tag, Value>
- {
- typedef What type;
- };
-
- template <typename What, typename Value, typename... Pairs>
- struct select< What, What, Value, Pairs...>
- {
- typedef Value type;
- };
-
- template <typename What, typename Tag, typename Value, typename... Pairs>
- struct select< What, Tag, Value, Pairs...>
- {
- typedef typename select<What, Pairs...>::type type;
- };
- } // namespace details
- //@endcond
-
- /// Select option metafunction
- /** @headerfile cds/opt/options.h
-
- Pseudocode:
- \code
- select <What, T1, R1, T2, R2, ... Tn, Rn> ::=
- if What == T1 then return R1
- if What == T2 then return R2
- ...
- if What == Tn then return Rn
- else return What
- \endcode
- */
- template <typename What, typename... Pairs>
- struct select {
- typedef typename details::select< What, Pairs...>::type type ; ///< Metafunction result
- };
-
-}} // namespace cds::opt
-
-#endif // #ifndef CDSLIB_OPT_MAKE_OPTIONS_STD_H
}} // namespace cds::opt
-#include <cds/opt/make_options_var.h>
+
+
+// ****************************************************
+// Options metafunctions
+
+namespace cds { namespace opt {
+
+ //@cond
+ namespace details {
+ template <typename OptionList, typename Option>
+ struct do_pack
+ {
+ // Use "pack" member template to pack options
+ typedef typename Option::template pack<OptionList> type;
+ };
+
+ template <typename ...T> class typelist;
+
+ template <typename Typelist> struct typelist_head;
+ template <typename Head, typename ...Tail>
+ struct typelist_head< typelist<Head, Tail...> > {
+ typedef Head type;
+ };
+ template <typename Head>
+ struct typelist_head< typelist<Head> > {
+ typedef Head type;
+ };
+
+ template <typename Typelist> struct typelist_tail;
+ template <typename Head, typename ...Tail>
+ struct typelist_tail< typelist<Head, Tail...> > {
+ typedef typelist<Tail...> type;
+ };
+ template <typename Head>
+ struct typelist_tail< typelist<Head> > {
+ typedef typelist<> type;
+ };
+
+ template <typename OptionList, typename Typelist>
+ struct make_options_impl {
+ typedef typename make_options_impl<
+ typename do_pack<
+ OptionList,
+ typename typelist_head< Typelist >::type
+ >::type,
+ typename typelist_tail<Typelist>::type
+ >::type type;
+ };
+
+ template <typename OptionList>
+ struct make_options_impl<OptionList, typelist<> > {
+ typedef OptionList type;
+ };
+ } // namespace details
+ //@endcond
+
+ /// make_options metafunction
+ /** @headerfile cds/opt/options.h
+
+ The metafunction converts option list \p Options to traits structure.
+ The result of metafunction is \p type.
+
+ Template parameter \p OptionList is default option set (default traits).
+ \p Options is option list.
+ */
+ template <typename OptionList, typename... Options>
+ struct make_options {
+#ifdef CDS_DOXYGEN_INVOKED
+ typedef implementation_defined type ; ///< Result of the metafunction
+#else
+ typedef typename details::make_options_impl< OptionList, details::typelist<Options...> >::type type;
+#endif
+ };
+
+
+ // *****************************************************************
+ // find_type_traits metafunction
+ // *****************************************************************
+
+ //@cond
+ namespace details {
+ template <typename... Options>
+ struct find_type_traits_option;
+
+ template <>
+ struct find_type_traits_option<> {
+ typedef cds::opt::none type;
+ };
+
+ template <typename Any>
+ struct find_type_traits_option< Any > {
+ typedef cds::opt::none type;
+ };
+
+ template <typename Any>
+ struct find_type_traits_option< cds::opt::type_traits< Any > > {
+ typedef Any type;
+ };
+
+ template <typename Any, typename... Options>
+ struct find_type_traits_option< cds::opt::type_traits< Any >, Options... > {
+ typedef Any type;
+ };
+
+ template <typename Any, typename... Options>
+ struct find_type_traits_option< Any, Options... > {
+ typedef typename find_type_traits_option< Options... >::type type;
+ };
+ } // namespace details
+ //@endcond
+
+ /// Metafunction to find opt::type_traits option in \p Options list
+ /** @headerfile cds/opt/options.h
+
+ If \p Options contains opt::type_traits option then it is the metafunction result.
+ Otherwise the result is \p DefaultOptons.
+ */
+ template <typename DefaultOptions, typename... Options>
+ struct find_type_traits {
+ typedef typename select_default< typename details::find_type_traits_option<Options...>::type, DefaultOptions>::type type ; ///< Metafunction result
+ };
+
+
+ // *****************************************************************
+ // find_option metafunction
+ // *****************************************************************
+
+ //@cond
+ namespace details {
+ template <typename What, typename... Options>
+ struct find_option;
+
+ struct compare_ok;
+ struct compare_fail;
+
+ template <typename A, typename B>
+ struct compare_option
+ {
+ typedef compare_fail type;
+ };
+
+ template <template <typename> class Opt, typename A, typename B>
+ struct compare_option< Opt<A>, Opt<B> >
+ {
+ typedef compare_ok type;
+ };
+
+ // Specializations for integral type of option
+#define CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_( _type ) template <template <_type> class What, _type A, _type B> \
+ struct compare_option< What<A>, What<B> > { typedef compare_ok type ; };
+
+ // For user-defined enum types
+#define CDS_DECLARE_FIND_OPTION_INTEGRAL_SPECIALIZATION( _type ) namespace cds { namespace opt { namespace details { CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(_type ) }}}
+
+ CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(bool)
+ CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(char)
+ CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(unsigned char)
+ CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(signed char)
+ CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(short int)
+ CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(unsigned short int)
+ CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(int)
+ CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(unsigned int)
+ CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(long)
+ CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(unsigned long)
+ CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(long long)
+ CDS_FIND_OPTION_INTEGRAL_SPECIALIZATION_(unsigned long long)
+
+
+ template <typename CompResult, typename Ok, typename Fail>
+ struct select_option
+ {
+ typedef Fail type;
+ };
+
+ template <typename Ok, typename Fail>
+ struct select_option< compare_ok, Ok, Fail >
+ {
+ typedef Ok type;
+ };
+
+ template <typename What>
+ struct find_option< What > {
+ typedef What type;
+ };
+
+ template <typename What, typename Opt>
+ struct find_option< What, Opt > {
+ typedef typename select_option<
+ typename compare_option< What, Opt >::type
+ ,Opt
+ ,What
+ >::type type;
+ };
+
+ template <typename What, typename Opt, typename... Options>
+ struct find_option< What, Opt, Options... > {
+ typedef typename select_option<
+ typename compare_option< What, Opt >::type
+ ,Opt
+ ,typename find_option< What, Options... >::type
+ >::type type;
+ };
+ } // namespace details
+ //@endcond
+
+ /// Metafunction to find \p What option in \p Options list
+ /** @headerfile cds/opt/options.h
+
+ If \p Options contains \p What< Val > option for any \p Val then the result is \p What< Val >
+ Otherwise the result is \p What.
+
+ Example:
+ \code
+ #include <cds/opt/options.h>
+ namespace co = cds::opt;
+
+ struct default_tag;
+ struct tag_a;
+ struct tag_b;
+
+ // Find option co::tag.
+
+ // res1 is co::tag< tag_a >
+ typedef co::find_option< co::tag< default_tag >, co::gc< cds::gc::HP >, co::tag< tag_a > >::type res1;
+
+ // res2 is default co::tag< default_tag >
+ typedef co::find_option< co::tag< default_tag >, co::less< x >, co::hash< H > >::type res2;
+
+ // Multiple option co::tag. The first option is selected
+ // res3 is default co::tag< tag_a >
+ typedef co::find_option< co::tag< default_tag >, co::tag< tag_a >, co::tag< tag_b > >::type res3;
+
+ \endcode
+ */
+ template <typename What, typename... Options>
+ struct find_option {
+ typedef typename details::find_option<What, Options...>::type type ; ///< Metafunction result
+ };
+
+
+ // *****************************************************************
+ // select metafunction
+ // *****************************************************************
+
+ //@cond
+ namespace details {
+
+ template <typename What, typename... Pairs>
+ struct select;
+
+ template <typename What, typename Value>
+ struct select< What, What, Value>
+ {
+ typedef Value type;
+ };
+
+ template <typename What, typename Tag, typename Value>
+ struct select<What, Tag, Value>
+ {
+ typedef What type;
+ };
+
+ template <typename What, typename Value, typename... Pairs>
+ struct select< What, What, Value, Pairs...>
+ {
+ typedef Value type;
+ };
+
+ template <typename What, typename Tag, typename Value, typename... Pairs>
+ struct select< What, Tag, Value, Pairs...>
+ {
+ typedef typename select<What, Pairs...>::type type;
+ };
+ } // namespace details
+ //@endcond
+
+ /// Select option metafunction
+ /** @headerfile cds/opt/options.h
+
+ Pseudocode:
+ \code
+ select <What, T1, R1, T2, R2, ... Tn, Rn> ::=
+ if What == T1 then return R1
+ if What == T2 then return R2
+ ...
+ if What == Tn then return Rn
+ else return What
+ \endcode
+ */
+ template <typename What, typename... Pairs>
+ struct select {
+ typedef typename details::select< What, Pairs...>::type type ; ///< Metafunction result
+ };
+
+}} // namespace cds::opt
+
#endif // #ifndef CDSLIB_OPT_OPTIONS_H
<ClInclude Include="..\..\..\cds\opt\buffer.h" />\r
<ClInclude Include="..\..\..\cds\opt\compare.h" />\r
<ClInclude Include="..\..\..\cds\opt\hash.h" />\r
- <ClInclude Include="..\..\..\cds\opt\make_options_var.h" />\r
<ClInclude Include="..\..\..\cds\opt\options.h" />\r
<ClInclude Include="..\..\..\cds\opt\permutation.h" />\r
<ClInclude Include="..\..\..\cds\opt\value_cleaner.h" />\r
<ClInclude Include="..\..\..\cds\opt\hash.h">\r
<Filter>Header Files\cds\opt</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\..\..\cds\opt\make_options_var.h">\r
- <Filter>Header Files\cds\opt</Filter>\r
- </ClInclude>\r
<ClInclude Include="..\..\..\cds\opt\options.h">\r
<Filter>Header Files\cds\opt</Filter>\r
</ClInclude>\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_cuckoo.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_ellentree.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_michael.cpp" />\r
- <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_refinable.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_skip.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_split.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_striped.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_michael.cpp">\r
<Filter>map_insdel_int</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_refinable.cpp">\r
- <Filter>map_insdel_int</Filter>\r
- </ClCompile>\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_skip.cpp">\r
<Filter>map_insdel_int</Filter>\r
</ClCompile>\r
tests/unit/map2/map_insdel_int_ellentree.cpp \
tests/unit/map2/map_insdel_int_bronsonavltree.cpp \
tests/unit/map2/map_insdel_int_striped.cpp \
- tests/unit/map2/map_insdel_int_refinable.cpp \
tests/unit/map2/map_insdel_int_cuckoo.cpp \
tests/unit/map2/map_insdel_item_int.cpp \
tests/unit/map2/map_insdel_item_int_michael.cpp \
MapSize=50000\r
MaxLoadFactor=4\r
PrintGCStateFlag=1\r
+#Cuckoo map properties\r
+CuckooInitialSize=256\r
+CuckooProbesetSize=8\r
+# 0 - use default\r
+CuckooProbesetThreshold=0 \r
\r
[Map_InsDel_func]\r
InsertThreadCount=4\r
MapSize=100000\r
MaxLoadFactor=4\r
PrintGCStateFlag=1\r
+#Cuckoo map properties\r
+CuckooInitialSize=1024\r
+CuckooProbesetSize=16\r
+# 0 - use default\r
+CuckooProbesetThreshold=0 \r
\r
[Map_InsDel_func]\r
InsertThreadCount=4\r
MapSize=1000000\r
MaxLoadFactor=4\r
PrintGCStateFlag=1\r
+#Cuckoo map properties\r
+CuckooInitialSize=1024\r
+CuckooProbesetSize=16\r
+# 0 - use default\r
+CuckooProbesetThreshold=0 \r
\r
[Map_InsDel_func]\r
InsertThreadCount=4\r
map_insdel_int_ellentree.cpp
map_insdel_int_bronsonavltree.cpp
map_insdel_int_striped.cpp
- map_insdel_int_refinable.cpp
map_insdel_int_cuckoo.cpp
map_insdel_item_int.cpp
map_insdel_item_int_michael.cpp
// StripedMap
#define CDSUNIT_DECLARE_StripedMap_common \
- CDSUNIT_DECLARE_TEST(StripedMap_list) \
- CDSUNIT_DECLARE_TEST(StripedMap_map) \
- CDSUNIT_DECLARE_TEST(StripedMap_hashmap) \
- CDSUNIT_DECLARE_TEST(StripedMap_boost_unordered_map)
-
-#define CDSUNIT_DEFINE_StripedMap_common( IMPL, C ) \
- TEST_MAP(IMPL, C, StripedMap_list) \
- TEST_MAP(IMPL, C, StripedMap_map) \
- TEST_MAP(IMPL, C, StripedMap_hashmap) \
- TEST_MAP(IMPL, C, StripedMap_boost_unordered_map)
+ TEST_CASE(tag_StripedMap, StripedMap_list) \
+ TEST_CASE(tag_StripedMap, StripedMap_map) \
+ TEST_CASE(tag_StripedMap, StripedMap_hashmap) \
+ TEST_CASE(tag_StripedMap, StripedMap_boost_unordered_map)
#define CDSUNIT_TEST_StripedMap_common \
CPPUNIT_TEST(StripedMap_list) \
#if BOOST_VERSION >= 104800
# define CDSUNIT_DECLARE_StripedMap_boost_container \
- CDSUNIT_DECLARE_TEST(StripedMap_boost_list) \
- CDSUNIT_DECLARE_TEST(StripedMap_slist) \
- CDSUNIT_DECLARE_TEST(StripedMap_boost_map)
-# define CDSUNIT_DEFINE_StripedMap_boost_container( IMPL, C ) \
- TEST_MAP(IMPL, C, StripedMap_boost_list) \
- TEST_MAP(IMPL, C, StripedMap_slist) \
- TEST_MAP(IMPL, C, StripedMap_boost_map)
+ TEST_CASE(tag_StripedMap, StripedMap_boost_list) \
+ TEST_CASE(tag_StripedMap, StripedMap_slist) \
+ TEST_CASE(tag_StripedMap, StripedMap_boost_map)
+
# define CDSUNIT_TEST_StripedMap_boost_container \
CPPUNIT_TEST(StripedMap_boost_list) \
CPPUNIT_TEST(StripedMap_slist) \
CPPUNIT_TEST(StripedMap_boost_map)
#else
# define CDSUNIT_DECLARE_StripedMap_boost_container
-# define CDSUNIT_DEFINE_StripedMap_boost_container( IMPL, C )
# define CDSUNIT_TEST_StripedMap_boost_container
#endif
#if BOOST_VERSION >= 104800 && defined(CDS_UNIT_MAP_TYPES_ENABLE_BOOST_FLAT_CONTAINERS)
# define CDSUNIT_DECLARE_StripedMap_boost_flat_container \
- CDSUNIT_DECLARE_TEST(StripedMap_boost_flat_map)
-# define CDSUNIT_DEFINE_StripedMap_boost_flat_container( IMPL, C ) \
- TEST_MAP(IMPL, C, StripedMap_boost_flat_map)
+ TEST_CASE(tag_StripedMap, StripedMap_boost_flat_map)
+
# define CDSUNIT_TEST_StripedMap_boost_flat_container \
CPPUNIT_TEST(StripedMap_boost_flat_map)
#else
# define CDSUNIT_DECLARE_StripedMap_boost_flat_container
-# define CDSUNIT_DEFINE_StripedMap_boost_flat_container( IMPL, C )
# define CDSUNIT_TEST_StripedMap_boost_flat_container
#endif
CDSUNIT_DECLARE_StripedMap_common \
CDSUNIT_DECLARE_StripedMap_boost_container \
CDSUNIT_DECLARE_StripedMap_boost_flat_container
-#define CDSUNIT_DEFINE_StripedMap( IMPL, C ) \
- CDSUNIT_DEFINE_StripedMap_common( IMPL, C ) \
- CDSUNIT_DEFINE_StripedMap_boost_container( IMPL, C ) \
- CDSUNIT_DEFINE_StripedMap_boost_flat_container( IMPL, C )
+
#define CDSUNIT_TEST_StripedMap \
CDSUNIT_TEST_StripedMap_common \
CDSUNIT_TEST_StripedMap_boost_container \
// RefinableMap
#define CDSUNIT_DECLARE_RefinableMap_common \
- CDSUNIT_DECLARE_TEST(RefinableMap_list) \
- CDSUNIT_DECLARE_TEST(RefinableMap_map) \
- CDSUNIT_DECLARE_TEST(RefinableMap_hashmap) \
- CDSUNIT_DECLARE_TEST(RefinableMap_boost_unordered_map)
-#define CDSUNIT_DEFINE_RefinableMap_common( IMPL, C ) \
- TEST_MAP(IMPL, C, RefinableMap_list) \
- TEST_MAP(IMPL, C, RefinableMap_map) \
- TEST_MAP(IMPL, C, RefinableMap_hashmap) \
- TEST_MAP(IMPL, C, RefinableMap_boost_unordered_map)
+ TEST_CASE(tag_StripedMap, RefinableMap_list) \
+ TEST_CASE(tag_StripedMap, RefinableMap_map) \
+ TEST_CASE(tag_StripedMap, RefinableMap_hashmap) \
+ TEST_CASE(tag_StripedMap, RefinableMap_boost_unordered_map)
+
#define CDSUNIT_TEST_RefinableMap_common \
CPPUNIT_TEST(RefinableMap_list) \
CPPUNIT_TEST(RefinableMap_map) \
#if BOOST_VERSION >= 104800
# define CDSUNIT_DECLARE_RefinableMap_boost_container \
- CDSUNIT_DECLARE_TEST(RefinableMap_boost_list) \
- CDSUNIT_DECLARE_TEST(RefinableMap_slist) \
- CDSUNIT_DECLARE_TEST(RefinableMap_boost_map)
-# define CDSUNIT_DEFINE_RefinableMap_boost_container( IMPL, C ) \
- TEST_MAP(IMPL, C, RefinableMap_boost_list) \
- TEST_MAP(IMPL, C, RefinableMap_slist) \
- TEST_MAP(IMPL, C, RefinableMap_boost_map)
+ TEST_CASE(tag_StripedMap, RefinableMap_boost_list) \
+ TEST_CASE(tag_StripedMap, RefinableMap_slist) \
+ TEST_CASE(tag_StripedMap, RefinableMap_boost_map)
+
# define CDSUNIT_TEST_RefinableMap_boost_container \
CPPUNIT_TEST(RefinableMap_boost_list) \
CPPUNIT_TEST(RefinableMap_slist) \
CPPUNIT_TEST(RefinableMap_boost_map)
#else
# define CDSUNIT_DECLARE_RefinableMap_boost_container
-# define CDSUNIT_DEFINE_RefinableMap_boost_container( IMPL, C )
# define CDSUNIT_TEST_RefinableMap_boost_container
#endif
#if BOOST_VERSION >= 104800 && defined(CDS_UNIT_MAP_TYPES_ENABLE_BOOST_FLAT_CONTAINERS)
# define CDSUNIT_DECLARE_RefinableMap_boost_flat_container \
- CDSUNIT_DECLARE_TEST(RefinableMap_boost_flat_map)
-# define CDSUNIT_DEFINE_RefinableMap_boost_flat_container( IMPL, C ) \
- TEST_MAP( IMPL, C, RefinableMap_boost_flat_map)
+ TEST_CASE(tag_StripedMap, RefinableMap_boost_flat_map)
+
# define CDSUNIT_TEST_RefinableMap_boost_flat_container \
CPPUNIT_TEST(RefinableMap_boost_flat_map)
#else
# define CDSUNIT_DECLARE_RefinableMap_boost_flat_container
-# define CDSUNIT_DEFINE_RefinableMap_boost_flat_container( IMPL, C )
# define CDSUNIT_TEST_RefinableMap_boost_flat_container
#endif
CDSUNIT_DECLARE_RefinableMap_common \
CDSUNIT_DECLARE_RefinableMap_boost_container \
CDSUNIT_DECLARE_RefinableMap_boost_flat_container
-#define CDSUNIT_DEFINE_RefinableMap( IMPL, C ) \
- CDSUNIT_DEFINE_RefinableMap_common( IMPL, C ) \
- CDSUNIT_DEFINE_RefinableMap_boost_container( IMPL, C ) \
- CDSUNIT_DEFINE_RefinableMap_boost_flat_container( IMPL, C )
+
#define CDSUNIT_TEST_RefinableMap \
CDSUNIT_TEST_RefinableMap_common \
CDSUNIT_TEST_RefinableMap_boost_container \
//CDSUNIT_TEST_MultiLevelHashMap // the test is not suitable
CPPUNIT_TEST_SUITE_END();
+ // Not implemented yet
////CDSUNIT_DECLARE_StripedMap
////CDSUNIT_DECLARE_RefinableMap
////CDSUNIT_DECLARE_StdMap
//$$CDS-header$$
#include "map2/map_insdel_int.h"
+#include <cds/os/topology.h>
namespace map2 {
CPPUNIT_TEST_SUITE_REGISTRATION( Map_InsDel_int );
- size_t Map_InsDel_int::c_nMapSize = 1000000;
- size_t Map_InsDel_int::c_nInsertThreadCount = 4;
- size_t Map_InsDel_int::c_nDeleteThreadCount = 4;
- size_t Map_InsDel_int::c_nThreadPassCount = 4;
- size_t Map_InsDel_int::c_nMaxLoadFactor = 8;
- bool Map_InsDel_int::c_bPrintGCState = true;
-
void Map_InsDel_int::setUpParams( const CppUnitMini::TestCfg& cfg ) {
c_nInsertThreadCount = cfg.getSizeT("InsertThreadCount", c_nInsertThreadCount );
c_nThreadPassCount = cfg.getSizeT("ThreadPassCount", c_nThreadPassCount );
c_nMapSize = cfg.getSizeT("MapSize", c_nMapSize );
c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor );
- c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState );
- }
- void Map_InsDel_int::myRun(const char *in_name, bool invert /*= false*/)
- {
- setUpParams( m_Cfg.get( "Map_InsDel_int" ));
+ c_nCuckooInitialSize = cfg.getULong("CuckooInitialSize", static_cast<unsigned long>(c_nCuckooInitialSize) );
+ c_nCuckooProbesetSize = cfg.getULong("CuckooProbesetSize", static_cast<unsigned long>(c_nCuckooProbesetSize) );
+ c_nCuckooProbesetThreshold = cfg.getULong("CuckooProbesetThreshold", static_cast<unsigned long>(c_nCuckooProbesetThreshold) );
- run_MichaelMap(in_name, invert);
- run_SplitList(in_name, invert);
- run_SkipListMap(in_name, invert);
- run_EllenBinTreeMap(in_name, invert);
- run_BronsonAVLTreeMap(in_name, invert);
- run_StripedMap(in_name, invert);
- run_RefinableMap(in_name, invert);
- run_CuckooMap(in_name, invert);
+ c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState );
+
+ if ( c_nInsertThreadCount == 0 )
+ c_nInsertThreadCount = cds::OS::topology::processor_count();
+ if ( c_nDeleteThreadCount == 0 )
+ c_nDeleteThreadCount = cds::OS::topology::processor_count();
- endTestCase();
+ m_arrValues.clear();
+ m_arrValues.reserve( c_nMapSize );
+ for ( size_t i = 0; i < c_nMapSize; ++i )
+ m_arrValues.push_back( i );
+ shuffle( m_arrValues.begin(), m_arrValues.end() );
}
+
} // namespace map2
namespace map2 {
-# define TEST_MAP(IMPL, C, X) void C::X() { test<map_type<IMPL, key_type, value_type>::X >(); }
-# define TEST_MAP_EXTRACT(IMPL, C, X) TEST_MAP(IMPL, C, X)
-# define TEST_MAP_NOLF(IMPL, C, X) void C::X() { test_nolf<map_type<IMPL, key_type, value_type>::X >(); }
-# define TEST_MAP_NOLF_EXTRACT(IMPL, C, X) TEST_MAP_NOLF(IMPL, C, X)
+# define TEST_CASE(TAG, X) void X();
class Map_InsDel_int: public CppUnitMini::TestCase
{
- static size_t c_nMapSize; // map size
- static size_t c_nInsertThreadCount; // count of insertion thread
- static size_t c_nDeleteThreadCount; // count of deletion thread
- static size_t c_nThreadPassCount; // pass count for each thread
- static size_t c_nMaxLoadFactor; // maximum load factor
- static bool c_bPrintGCState;
+ public:
+ size_t c_nMapSize = 1000000; // map size
+ size_t c_nInsertThreadCount = 4; // count of insertion thread
+ size_t c_nDeleteThreadCount = 4; // count of deletion thread
+ size_t c_nThreadPassCount = 4; // pass count for each thread
+ size_t c_nMaxLoadFactor = 8; // maximum load factor
+ size_t c_nCuckooInitialSize = 1024;// initial size for CuckooMap
+ size_t c_nCuckooProbesetSize = 16; // CuckooMap probeset size (only for list-based probeset)
+ size_t c_nCuckooProbesetThreshold = 0; // CUckooMap probeset threshold (o - use default)
+ bool c_bPrintGCState = true;
+
+ size_t c_nLoadFactor; // current load factor
+
+ private:
typedef CppUnitMini::TestCase Base;
typedef size_t key_type;
typedef size_t value_type;
typedef std::vector<key_type> key_array;
key_array m_arrValues;
- template <class MAP>
+ template <class Map>
class Inserter: public CppUnitMini::TestThread
{
- MAP& m_Map;
+ Map& m_Map;
virtual Inserter * clone()
{
size_t m_nInsertFailed;
public:
- Inserter( CppUnitMini::ThreadPool& pool, MAP& rMap )
+ Inserter( CppUnitMini::ThreadPool& pool, Map& rMap )
: CppUnitMini::TestThread( pool )
, m_Map( rMap )
{}
virtual void test()
{
- MAP& rMap = m_Map;
+ Map& rMap = m_Map;
m_nInsertSuccess =
m_nInsertFailed = 0;
key_array const& arr = getTest().m_arrValues;
+ size_t const nPassCount = getTest().c_nThreadPassCount;
+
if ( m_nThreadNo & 1 ) {
- for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+ for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) {
for ( key_array::const_iterator it = arr.begin(), itEnd = arr.end(); it != itEnd; ++it ) {
if ( rMap.insert( *it, *it * 8 ) )
++m_nInsertSuccess;
}
}
else {
- for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+ for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) {
for ( key_array::const_reverse_iterator it = arr.rbegin(), itEnd = arr.rend(); it != itEnd; ++it ) {
if ( rMap.insert( *it, *it * 8 ) )
++m_nInsertSuccess;
}
};
- template <class MAP>
+ template <class Map>
class Deleter: public CppUnitMini::TestThread
{
- MAP& m_Map;
+ Map& m_Map;
virtual Deleter * clone()
{
size_t m_nDeleteFailed;
public:
- Deleter( CppUnitMini::ThreadPool& pool, MAP& rMap )
+ Deleter( CppUnitMini::ThreadPool& pool, Map& rMap )
: CppUnitMini::TestThread( pool )
, m_Map( rMap )
{}
virtual void test()
{
- MAP& rMap = m_Map;
+ Map& rMap = m_Map;
m_nDeleteSuccess =
m_nDeleteFailed = 0;
key_array const& arr = getTest().m_arrValues;
+ size_t const nPassCount = getTest().c_nThreadPassCount;
+
if ( m_nThreadNo & 1 ) {
- for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+ for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) {
for ( key_array::const_iterator it = arr.begin(), itEnd = arr.end(); it != itEnd; ++it ) {
if ( rMap.erase( *it ) )
++m_nDeleteSuccess;
}
}
else {
- for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+ for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) {
for ( key_array::const_reverse_iterator it = arr.rbegin(), itEnd = arr.rend(); it != itEnd; ++it ) {
if ( rMap.erase( *it ) )
++m_nDeleteSuccess;
};
protected:
- template <class MAP>
- void do_test( MAP& testMap )
+ template <class Map>
+ void do_test( Map& testMap )
{
- typedef Inserter<MAP> InserterThread;
- typedef Deleter<MAP> DeleterThread;
+ typedef Inserter<Map> InserterThread;
+ typedef Deleter<Map> DeleterThread;
cds::OS::Timer timer;
- m_arrValues.clear();
- m_arrValues.reserve( c_nMapSize );
- for ( size_t i = 0; i < c_nMapSize; ++i )
- m_arrValues.push_back( i );
- shuffle( m_arrValues.begin(), m_arrValues.end() );
-
CppUnitMini::ThreadPool pool( *this );
pool.add( new InserterThread( pool, testMap ), c_nInsertThreadCount );
pool.add( new DeleterThread( pool, testMap ), c_nDeleteThreadCount );
additional_cleanup( testMap );
}
- template <class MAP>
- void test()
+ template <class Map>
+ void run_test()
{
CPPUNIT_MSG( "Thread count: insert=" << c_nInsertThreadCount
<< " delete=" << c_nDeleteThreadCount
<< " map size=" << c_nMapSize
);
- for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) {
- CPPUNIT_MSG( "Load factor=" << nLoadFactor );
- MAP testMap( c_nMapSize, nLoadFactor );
+ if ( Map::c_bLoadFactorDepended ) {
+ for ( c_nLoadFactor = 1; c_nLoadFactor <= c_nMaxLoadFactor; c_nLoadFactor *= 2 ) {
+ CPPUNIT_MSG( "Load factor=" << c_nLoadFactor );
+ Map testMap( *this );
+ do_test( testMap );
+ if ( c_bPrintGCState )
+ print_gc_state();
+ }
+ }
+ else {
+ Map testMap( *this );
do_test( testMap );
if ( c_bPrintGCState )
print_gc_state();
}
}
- template <class MAP>
- void test_nolf()
- {
- CPPUNIT_MSG( "Thread count: insert=" << c_nInsertThreadCount
- << " delete=" << c_nDeleteThreadCount
- << " pass count=" << c_nThreadPassCount
- << " map size=" << c_nMapSize
- );
-
- MAP testMap;
- do_test( testMap );
- if ( c_bPrintGCState )
- print_gc_state();
- }
-
void setUpParams( const CppUnitMini::TestCfg& cfg );
- void run_MichaelMap(const char *in_name, bool invert = false);
- void run_SplitList(const char *in_name, bool invert = false);
- void run_StripedMap(const char *in_name, bool invert = false);
- void run_RefinableMap(const char *in_name, bool invert = false);
- void run_CuckooMap(const char *in_name, bool invert = false);
- void run_SkipListMap(const char *in_name, bool invert = false);
- void run_EllenBinTreeMap(const char *in_name, bool invert = false);
- void run_BronsonAVLTreeMap(const char *in_name, bool invert = false);
-
- virtual void myRun(const char *in_name, bool invert = false);
-
-
# include "map2/map_defs.h"
CDSUNIT_DECLARE_MichaelMap
CDSUNIT_DECLARE_SplitList
CDSUNIT_DECLARE_RefinableMap
CDSUNIT_DECLARE_CuckooMap
//CDSUNIT_DECLARE_StdMap
+
+ CPPUNIT_TEST_SUITE(Map_InsDel_int)
+ CDSUNIT_TEST_MichaelMap
+ CDSUNIT_TEST_SplitList
+ CDSUNIT_TEST_SkipListMap
+ CDSUNIT_TEST_EllenBinTreeMap
+ CDSUNIT_TEST_BronsonAVLTreeMap
+ CDSUNIT_TEST_CuckooMap
+ CDSUNIT_TEST_StripedMap
+ CDSUNIT_TEST_RefinableMap
+ //CDSUNIT_TEST_StdMap
+
+ //CDSUNIT_TEST_MultiLevelHashMap // the test is not suitable
+ CPPUNIT_TEST_SUITE_END();
+
};
} // namespace map2
#include "map2/map_insdel_int.h"
#include "map2/map_type_bronson_avltree.h"
-namespace map2 {
- CDSUNIT_DEFINE_BronsonAVLTreeMap( cc::bronson_avltree::implementation_tag, Map_InsDel_int)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsDel_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_BronsonAVLTreeMap )
- CDSUNIT_TEST_BronsonAVLTreeMap
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_BronsonAVLTreeMap
} // namespace map2
#include "map2/map_insdel_int.h"
#include "map2/map_type_cuckoo.h"
-namespace map2 {
- CDSUNIT_DEFINE_CuckooMap(cds::intrusive::cuckoo::implementation_tag, Map_InsDel_int)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsDel_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_CuckooMap )
- CDSUNIT_TEST_CuckooMap
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_CuckooMap
} // namespace map2
#include "map2/map_insdel_int.h"
#include "map2/map_type_ellen_bintree.h"
-namespace map2 {
- CDSUNIT_DEFINE_EllenBinTreeMap( cc::ellen_bintree::implementation_tag, Map_InsDel_int)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsDel_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_EllenBinTreeMap )
- CDSUNIT_TEST_EllenBinTreeMap
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_EllenBinTreeMap
} // namespace map2
#include "map2/map_insdel_int.h"
#include "map2/map_type_michael.h"
-namespace map2 {
- CDSUNIT_DEFINE_MichaelMap( cc::michael_map::implementation_tag, Map_InsDel_int )
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsDel_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_MichaelMap )
- CDSUNIT_TEST_MichaelMap
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_MichaelMap
} // namespace map2
+++ /dev/null
-//$$CDS-header$$
-
-#include "map2/map_insdel_int.h"
-#include "map2/map_type_striped.h"
-
-namespace map2 {
- CDSUNIT_DEFINE_RefinableMap(cc::striped_set::implementation_tag, Map_InsDel_int)
-
- CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_RefinableMap )
- CDSUNIT_TEST_RefinableMap
- CPPUNIT_TEST_SUITE_END_PART()
-} // namespace map2
#include "map2/map_insdel_int.h"
#include "map2/map_type_skip_list.h"
-namespace map2 {
- CDSUNIT_DEFINE_SkipListMap( cc::skip_list::implementation_tag, Map_InsDel_int)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsDel_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_SkipListMap )
- CDSUNIT_TEST_SkipListMap
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_SkipListMap
} // namespace map2
#include "map2/map_insdel_int.h"
#include "map2/map_type_split_list.h"
-namespace map2 {
- CDSUNIT_DEFINE_SplitList( cc::split_list::implementation_tag, Map_InsDel_int )
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsDel_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_SplitList )
- CDSUNIT_TEST_SplitList
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_SplitList
} // namespace map2
#include "map2/map_insdel_int.h"
#include "map2/map_type_striped.h"
-namespace map2 {
- CDSUNIT_DEFINE_StripedMap(cc::striped_set::implementation_tag, Map_InsDel_int)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsDel_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
- CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_StripedMap )
- CDSUNIT_TEST_StripedMap
- CPPUNIT_TEST_SUITE_END_PART()
+namespace map2 {
+ CDSUNIT_DECLARE_StripedMap
+ CDSUNIT_DECLARE_RefinableMap
} // namespace map2
namespace map2 {
+ struct tag_StripedMap;
+
template <typename Key, typename Value>
- struct map_type< cc::striped_set::implementation_tag, Key, Value >: public map_type_base< Key, Value >
+ struct map_type< tag_StripedMap, Key, Value >: public map_type_base< Key, Value >
{
typedef map_type_base< Key, Value > base_class;
typedef typename base_class::compare compare;
resizing_policy_t m_placeHolder;
public:
- StripedHashMap_seq( size_t nCapacity, size_t nLoadFactor )
- : base_class( nCapacity / nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( nLoadFactor )) )
+ template <class Config>
+ StripedHashMap_seq( Config const& cfg )
+ : base_class( cfg.c_nMapSize / cfg.c_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.c_nLoadFactor )) )
{}
+
+ // for testing
+ static CDS_CONSTEXPR bool const c_bExtractSupported = false;
+ static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true;
};
// for non-sequential ordered containers
resizing_policy_t m_placeHolder;
public:
- StripedHashMap_ord( size_t /*nCapacity*/, size_t nLoadFactor )
- : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( nLoadFactor * 1024 )) )
+ template <class Config>
+ StripedHashMap_ord( Config const& cfg )
+ : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.c_nMaxLoadFactor * 1024 )) )
{}
+
+ // for testing
+ static CDS_CONSTEXPR bool const c_bExtractSupported = false;
+ static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
};
resizing_policy_t m_placeHolder;
public:
- RefinableHashMap_seq( size_t nCapacity, size_t nLoadFactor )
- : base_class( nCapacity / nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( nLoadFactor )) )
+ template <class Config>
+ RefinableHashMap_seq( Config const& cfg )
+ : base_class( cfg.c_nMapSize / cfg.c_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.c_nLoadFactor )))
{}
+
+ // for testing
+ static CDS_CONSTEXPR bool const c_bExtractSupported = false;
+ static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true;
};
// for non-sequential ordered containers
resizing_policy_t m_placeHolder;
public:
- RefinableHashMap_ord( size_t /*nCapacity*/, size_t nLoadFactor )
- : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( nLoadFactor * 1024 )) )
+ template <class Config>
+ RefinableHashMap_ord( Config const& cfg )
+ : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.c_nMaxLoadFactor * 1024 )) )
{}
+
+ // for testing
+ static CDS_CONSTEXPR bool const c_bExtractSupported = false;
+ static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
};