27 #ifndef API_CDS_SPLIT_MAP_H_
28 #define API_CDS_SPLIT_MAP_H_
32 #include <cds/gc/hp.h>
33 #include <cds/opt/hash.h>
34 #include <cds/container/michael_kvlist_hp.h>
35 #include <cds/container/michael_map.h>
37 template<
class Key,
class Value>
40 struct less_s : std::binary_function <T,T,bool> {
42 return (memcmp(&x, &y,
sizeof(T)) < 0);
48 struct list_traits:
public cds::container::michael_list::type_traits {
53 typedef typename cds::container::MichaelKVList< cds::gc::HP, Key, Value, list_traits>
Key2Value_list;
55 struct map_traits:
public cds::container::michael_map::type_traits {
59 char *temp = (
char *)(&k);
60 for (
int i = 0; i <
sizeof(Key); i++) {
69 typedef typename cds::container::MichaelHashMap<cds::gc::HP,
Key2Value_list,
77 curr_value = pair.second;
94 void operator ()(
bool bNew, std::pair<Key const, Value >& item) {
98 std::atomic<Value> * address = (std::atomic<Value> *)&(item.second);
99 res = address->compare_exchange_strong(value_expected, value_new);
117 const int t = test_michael_map;
118 return "CDS MICHAEL Map(" + std::to_string(t) +
")";
129 return ef.getValue(value);
141 uf.value_expected = value_expected;
142 uf.value_new = value_new;
146 return uf.getValue(value_expected);
149 bool remove(Key key) {
161 #endif //API_CDS_SPLIT_MAP_H_
void detach_thread()
Definition: cds_michael_map.h:124
Value value_new
Definition: cds_michael_map.h:90
bool insert(Key key, Value value)
Definition: cds_michael_map.h:135
Definition: cds_michael_map.h:40
size_t operator()(const Key &k) const
Definition: cds_michael_map.h:57
Value curr_value
Definition: cds_michael_map.h:74
bool getValue(Value &val)
Definition: cds_michael_map.h:103
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
Definition: cds_michael_map.h:89
cds::container::MichaelHashMap< cds::gc::HP, Key2Value_list, map_traits > hash_t
Definition: cds_michael_map.h:70
Definition: cds_michael_map.h:48
void attach_thread()
Definition: cds_michael_map.h:121
hash_t * test_container
Definition: cds_michael_map.h:158
Definition: cds_michael_map.h:72
Value value_expected
Definition: cds_michael_map.h:91
Definition: cds_michael_map.h:56
bool update(Key key, Value &value_expected, Value value_new)
Definition: cds_michael_map.h:139
uint64_t Value
Definition: testObject.h:59
size_t size()
Definition: cds_michael_map.h:153
bool res
Definition: cds_michael_map.h:75
bool find(Key key, Value &value)
Definition: cds_michael_map.h:126
void operator()(std::pair< Key, Value > pair)
Definition: cds_michael_map.h:76
cds::container::MichaelKVList< cds::gc::HP, Key, Value, list_traits > Key2Value_list
Definition: cds_michael_map.h:53
bool res
Definition: cds_michael_map.h:92
Definition: blank_api.h:31
TestClass(size_t num_threads, size_t capacity)
Definition: cds_michael_map.h:112
Definition: cds_michael_map.h:55
std::string toString()
Definition: cds_michael_map.h:116
bool getValue(Value &val)
Definition: cds_michael_map.h:81