PMDK C++ bindings  1.10
This is the C++ bindings documentation for PMDK's libpmemobj.
concurrent_map.hpp
1 // SPDX-License-Identifier: BSD-3-Clause
2 /* Copyright 2019-2020, Intel Corporation */
3 
4 #ifndef PMEMOBJ_CONCURRENT_MAP_HPP
5 #define PMEMOBJ_CONCURRENT_MAP_HPP
6 
8 #include <libpmemobj++/container/detail/concurrent_skip_list_impl.hpp>
9 #include <libpmemobj++/detail/pair.hpp>
10 
11 namespace pmem
12 {
13 namespace obj
14 {
15 namespace experimental
16 {
43 template <typename Key, typename Value, typename Comp = std::less<Key>,
44  typename Allocator =
45  pmem::obj::allocator<detail::pair<const Key, Value>>>
47  : public detail::concurrent_skip_list<detail::map_traits<
48  Key, Value, Comp, detail::default_random_generator, Allocator,
49  false, 64>> {
50  using traits_type = detail::map_traits<Key, Value, Comp,
51  detail::default_random_generator,
52  Allocator, false, 64>;
54 
55 public:
56  using key_type = typename base_type::key_type;
57  using mapped_type = typename base_type::mapped_type;
58  using value_type = typename base_type::value_type;
59  using size_type = typename base_type::size_type;
60  using difference_type = typename base_type::difference_type;
61  using key_compare = Comp;
62  using allocator_type = Allocator;
63  using reference = typename base_type::reference;
64  using const_reference = typename base_type::const_reference;
65  using pointer = typename base_type::pointer;
66  using const_pointer = typename base_type::const_pointer;
67  using iterator = typename base_type::iterator;
68  using const_iterator = typename base_type::const_iterator;
69  using reverse_iterator = typename base_type::reverse_iterator;
70  using const_reverse_iterator =
71  typename base_type::const_reverse_iterator;
72 
76  concurrent_map() = default;
77 
81  concurrent_map(const concurrent_map &table) : base_type(table)
82  {
83  }
84 
88  concurrent_map(concurrent_map &&table) : base_type(std::move(table))
89  {
90  }
91 
95  template <class InputIt>
96  concurrent_map(InputIt first, InputIt last,
97  const key_compare &comp = Comp(),
98  const allocator_type &alloc = allocator_type())
99  : base_type(first, last, comp, alloc)
100  {
101  }
102 
106  concurrent_map(std::initializer_list<value_type> ilist)
107  : base_type(ilist.begin(), ilist.end())
108  {
109  }
110 
115  operator=(const concurrent_map &other)
116  {
117  return static_cast<concurrent_map &>(
118  base_type::operator=(other));
119  }
120 
126  {
127  return static_cast<concurrent_map &>(
128  base_type::operator=(std::move(other)));
129  }
130 
135  operator=(std::initializer_list<value_type> ilist)
136  {
137  return static_cast<concurrent_map &>(
138  base_type::operator=(ilist));
139  }
140 };
141 
142 } /* namespace experimental */
143 } /* namespace obj */
144 } /* namespace pmem */
145 #endif /* PMEMOBJ_CONCURRENT_MAP_HPP */
pmem::obj::experimental::concurrent_map::concurrent_map
concurrent_map(std::initializer_list< value_type > ilist)
Constructs the map with initializer list.
Definition: concurrent_map.hpp:106
pmem
Persistent memory namespace.
Definition: allocation_flag.hpp:15
pmem::obj::experimental::concurrent_map::concurrent_map
concurrent_map(InputIt first, InputIt last, const key_compare &comp=Comp(), const allocator_type &alloc=allocator_type())
Constructs the map with the contents of the range [first, last).
Definition: concurrent_map.hpp:96
pmem::obj::begin
pmem::obj::array< T, N >::iterator begin(pmem::obj::array< T, N > &a)
Non-member begin.
Definition: array.hpp:804
pmem::obj::experimental::concurrent_map::concurrent_map
concurrent_map(concurrent_map &&table)
Move constructor.
Definition: concurrent_map.hpp:88
pmem::detail::concurrent_skip_list::operator=
concurrent_skip_list & operator=(const concurrent_skip_list &other)
Copy assignment operator.
Definition: concurrent_skip_list_impl.hpp:810
pmem::detail::concurrent_skip_list
Persistent memory aware implementation of the concurrent skip list.
Definition: concurrent_skip_list_impl.hpp:491
pmem::obj::experimental::concurrent_map::operator=
concurrent_map & operator=(concurrent_map &&other)
Move-assignment operator.
Definition: concurrent_map.hpp:125
allocator.hpp
Persistent memory aware allocator.
pmem::obj::experimental::concurrent_map::concurrent_map
concurrent_map(const concurrent_map &table)
Copy constructor.
Definition: concurrent_map.hpp:81
pmem::obj::experimental::concurrent_map::operator=
concurrent_map & operator=(const concurrent_map &other)
Assignment operator.
Definition: concurrent_map.hpp:115
pmem::obj::end
pmem::obj::array< T, N >::iterator end(pmem::obj::array< T, N > &a)
Non-member end.
Definition: array.hpp:824
pmem::obj::experimental::concurrent_map::concurrent_map
concurrent_map()=default
Default constructor.
pmem::obj::experimental::concurrent_map
Persistent memory aware implementation of Intel TBB concurrent_map.
Definition: concurrent_map.hpp:49