27 #ifndef API_CDS_SPLIT_MAP_H_
28 #define API_CDS_SPLIT_MAP_H_
30 #include <cds/gc/hp.h>
31 #include <cds/opt/hash.h>
32 #include <cds/container/michael_list_hp.h>
33 #include <cds/container/split_list_map.h>
37 template<
class Key,
class Value>
40 struct s_hash :
public std::unary_function<T, std::size_t> {
43 char * temp = (
char *)(&k);
44 for (
int i = 0; i <
sizeof(T); i++) {
52 template <
class T>
struct less_s : std::binary_function <T,T,bool> {
55 return (memcmp(&x, &y,
sizeof(T)) < 0);
72 typedef typename cds::container::SplitListMap< cds::gc::HP, Key, Value, foo_set_traits>
hash_t ;
79 curr_value = pair.second;
96 void operator ()(
bool bNew, std::pair<Key const, Value >& item) {
100 std::atomic<Value> * address = (std::atomic<Value> *)&(item.second);
101 res = address->compare_exchange_strong(value_expected, value_new);
119 const int t = test_splitlist;
120 return "CDS Split Map(" + std::to_string(t) +
")";
131 return ef.getValue(value);
143 uf.value_expected = value_expected;
144 uf.value_new = value_new;
148 return uf.getValue(value_expected);
151 bool remove(Key key) {
163 #endif //API_CDS_SPLIT_MAP_H_
cds::container::michael_list_tag ordered_list
Definition: cds_split_map.h:63
void detach_thread()
Definition: cds_split_map.h:126
Value value_new
Definition: cds_michael_map.h:90
bool insert(Key key, Value value)
Definition: cds_split_map.h:137
Definition: cds_michael_map.h:40
Value curr_value
Definition: cds_michael_map.h:74
bool getValue(Value &val)
Definition: cds_split_map.h:105
void operator()(bool bNew, std::pair< Key const, Value > &item)
Definition: cds_michael_map.h:94
bool operator()(const T &x, const T &y) const
Definition: cds_michael_map.h:41
cds::container::MichaelHashMap< cds::gc::HP, Key2Value_list, map_traits > hash_t
Definition: cds_michael_map.h:70
void attach_thread()
Definition: cds_split_map.h:123
hash_t * test_container
Definition: cds_michael_map.h:158
Definition: cds_split_map.h:61
Value value_expected
Definition: cds_michael_map.h:91
bool update(Key key, Value &value_expected, Value value_new)
Definition: cds_split_map.h:141
Definition: cds_split_map.h:40
cds::container::SplitListMap< cds::gc::HP, Key, Value, foo_set_traits > hash_t
Definition: cds_split_map.h:72
uint64_t Value
Definition: testObject.h:59
Definition: cds_split_map.h:66
size_t size()
Definition: cds_split_map.h:155
bool res
Definition: cds_michael_map.h:75
bool find(Key key, Value &value)
Definition: cds_split_map.h:128
void operator()(std::pair< Key, Value > pair)
Definition: cds_michael_map.h:76
bool res
Definition: cds_michael_map.h:92
Definition: blank_api.h:31
TestClass(size_t num_threads, size_t capacity)
Definition: cds_split_map.h:114
std::size_t operator()(T const &k) const
Definition: cds_split_map.h:41
std::string toString()
Definition: cds_split_map.h:118
bool getValue(Value &val)
Definition: cds_split_map.h:83