3 #include "map/hdr_striped_map.h"
5 #include <boost/version.hpp>
6 #include <cds/details/defs.h>
7 #if CDS_COMPILER == CDS_COMPILER_MSVC && CDS_COMPILER_VERSION == CDS_COMPILER_MSVC12 && BOOST_VERSION <= 105500
9 void StripedMapHdrTest::Striped_boost_list()
11 CPPUNIT_MESSAGE("Skipped; for Microsoft Visual C++ 2013 and boost::container::list you should use boost version 1.56 or above");
15 #elif BOOST_VERSION >= 104800
17 #include <cds/container/striped_map/boost_list.h>
18 #include <cds/container/striped_map.h>
19 #include <cds/sync/spinlock.h>
24 typedef boost::container::list< StripedMapHdrTest::pair_type > sequence_t;
26 struct my_copy_policy {
27 typedef sequence_t::iterator iterator;
29 void operator()( sequence_t& list, iterator itInsert, iterator itWhat )
31 list.insert( itInsert, std::make_pair(itWhat->first, itWhat->second ));
36 void StripedMapHdrTest::Striped_boost_list()
38 CPPUNIT_MESSAGE( "cmp");
39 typedef cc::StripedMap< sequence_t
40 , co::hash< hash_int >
42 ,co::mutex_policy< cc::striped_set::striping<> >
44 test_striped2< map_cmp >();
46 CPPUNIT_MESSAGE( "less");
47 typedef cc::StripedMap< sequence_t
48 , co::hash< hash_int >
51 test_striped2< map_less >();
53 CPPUNIT_MESSAGE( "cmpmix");
54 typedef cc::StripedMap< sequence_t
55 , co::hash< hash_int >
59 test_striped2< map_cmpmix >();
61 // Spinlock as lock policy
62 CPPUNIT_MESSAGE( "spinlock");
63 typedef cc::StripedMap< sequence_t
64 , co::hash< hash_int >
66 , co::mutex_policy< cc::striped_set::striping<cds::sync::spin> >
68 test_striped2< map_spin >();
71 CPPUNIT_MESSAGE( "load_factor_resizing<0>(8)");
73 typedef cc::StripedMap< sequence_t
74 , co::hash< hash_int >
76 , co::resizing_policy< cc::striped_set::load_factor_resizing<0> >
77 > pair_type_less_resizing_lf;
78 pair_type_less_resizing_lf m(30, cc::striped_set::load_factor_resizing<0>(8) );
82 CPPUNIT_MESSAGE( "load_factor_resizing<4>");
83 typedef cc::StripedMap< sequence_t
84 , co::hash< hash_int >
86 , co::resizing_policy< cc::striped_set::load_factor_resizing<4> >
87 > map_less_resizing_lf16;
88 test_striped2< map_less_resizing_lf16 >();
91 CPPUNIT_MESSAGE( "single_bucket_size_threshold<0>(8)");
92 typedef cc::StripedMap< sequence_t
93 , co::hash< hash_int >
95 , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<0> >
96 > map_less_resizing_sbt;
97 map_less_resizing_sbt m(30, cc::striped_set::single_bucket_size_threshold<0>(8));
101 CPPUNIT_MESSAGE( "single_bucket_size_threshold<6>");
102 typedef cc::StripedMap< sequence_t
103 , co::hash< hash_int >
105 , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<6> >
106 > map_less_resizing_sbt16;
107 test_striped2< map_less_resizing_sbt16 >();
110 CPPUNIT_MESSAGE( "copy_item");
111 typedef cc::StripedMap< sequence_t
112 , co::hash< hash_int >
114 , co::copy_policy< cc::striped_set::copy_item >
116 test_striped2< set_copy_item >();
118 CPPUNIT_MESSAGE( "swap_item");
119 typedef cc::StripedMap< sequence_t
120 , co::hash< hash_int >
122 , co::copy_policy< cc::striped_set::swap_item >
124 test_striped2< set_swap_item >();
126 CPPUNIT_MESSAGE( "move_item");
127 typedef cc::StripedMap< sequence_t
128 , co::hash< hash_int >
130 , co::copy_policy< cc::striped_set::move_item >
132 test_striped2< set_move_item >();
134 CPPUNIT_MESSAGE( "special copy_item");
135 typedef cc::StripedMap< sequence_t
136 , co::hash< hash_int >
138 , co::copy_policy< my_copy_policy >
139 > set_special_copy_item;
140 test_striped2< set_special_copy_item >();
146 #else // BOOST_VERSION < 104800
149 void StripedMapHdrTest::Striped_boost_list()
151 CPPUNIT_MESSAGE( "Skipped; for boost::container::list you should use boost version 1.48 or above" );
154 #endif // BOOST_VERSION