1 #ifndef DASH__UNORDERED_MAP_H__INCLUDED 2 #define DASH__UNORDERED_MAP_H__INCLUDED 4 #include <dash/Types.h> 5 #include <dash/GlobRef.h> 7 #include <dash/Array.h> 8 #include <dash/memory/GlobHeapMem.h> 9 #include <dash/Allocator.h> 11 #include <dash/atomic/GlobAtomicRef.h> 137 typename Pred = std::equal_to<Key>,
138 typename LocalMemType = HostSpace >
141 typedef UnorderedMap<Key, Mapped, Hash, Pred, LocalMemType> self_type;
144 std::pair<const Key, Mapped>,
151 typedef Key key_type;
152 typedef Mapped mapped_type;
154 typedef Pred key_equal;
159 typedef std::pair<const key_type, mapped_type> value_type;
161 typedef typename dash::container_traits<self_type>::local_type local_type;
163 typedef GlobHeapPtr<value_type, glob_mem_type> pointer;
164 typedef GlobHeapPtr<const value_type, glob_mem_type> const_pointer;
166 typedef GlobSharedRef<value_type, GlobHeapPtr<value_type, glob_mem_type>>
169 typedef GlobSharedRef<value_type const, GlobHeapPtr<value_type, glob_mem_type>>
172 typedef typename reference::template rebind<mapped_type>::other
173 mapped_type_reference;
174 typedef typename const_reference::template rebind<mapped_type>::other
175 const_mapped_type_reference;
177 typedef typename glob_mem_type::global_iterator
179 typedef typename glob_mem_type::const_global_iterator
181 typedef typename glob_mem_type::local_iterator
183 typedef typename glob_mem_type::const_local_iterator
184 const_local_node_iterator;
185 typedef typename glob_mem_type::reverse_global_iterator
186 reverse_node_iterator;
187 typedef typename glob_mem_type::const_reverse_global_iterator
188 const_reverse_node_iterator;
189 typedef typename glob_mem_type::reverse_local_iterator
190 reverse_local_node_iterator;
191 typedef typename glob_mem_type::const_reverse_local_iterator
192 const_reverse_local_node_iterator;
194 typedef typename glob_mem_type::local_iterator
196 typedef typename glob_mem_type::const_local_iterator
197 const_local_node_pointer;
199 typedef UnorderedMapGlobIter<Key, Mapped, Hash, Pred, glob_mem_type>
201 typedef UnorderedMapGlobIter<Key, Mapped, Hash, Pred, glob_mem_type>
203 typedef typename std::reverse_iterator<iterator>
205 typedef typename std::reverse_iterator<const_iterator>
206 const_reverse_iterator;
208 typedef UnorderedMapLocalIter<Key, Mapped, Hash, Pred, LocalMemType>
210 typedef UnorderedMapLocalIter<Key, Mapped, Hash, Pred, LocalMemType>
212 typedef UnorderedMapLocalIter<Key, Mapped, Hash, Pred, LocalMemType>
214 typedef UnorderedMapLocalIter<Key, Mapped, Hash, Pred, LocalMemType>
215 const_local_iterator;
216 typedef typename std::reverse_iterator<local_iterator>
217 reverse_local_iterator;
218 typedef typename std::reverse_iterator<const_local_iterator>
219 const_reverse_local_iterator;
221 typedef typename glob_mem_type::local_reference
223 typedef typename glob_mem_type::const_local_reference
224 const_local_reference;
227 size_type, int, dash::CSRPattern<1, dash::ROW_MAJOR, int> >
244 constexpr
Team &
team() const noexcept;
292 iterator &
begin() noexcept;
299 const_iterator &
begin() const noexcept;
306 const_iterator &
cbegin() const noexcept;
313 iterator &
end() noexcept;
320 const_iterator &
end() const noexcept;
327 const_iterator &
cend() const noexcept;
338 local_iterator &
lbegin() noexcept;
345 const_local_iterator &
lbegin() const noexcept;
352 const_local_iterator &
clbegin() const noexcept;
359 local_iterator &
lend() noexcept;
366 const_local_iterator &
lend() const noexcept;
373 const_local_iterator &
clend() const noexcept;
384 constexpr size_type
max_size() const noexcept;
391 size_type
size() const noexcept;
399 size_type
capacity() const noexcept;
406 bool empty() const noexcept;
414 size_type
lsize() const noexcept;
454 mapped_type_reference operator[](const key_type & key);
469 const_mapped_type_reference
at(const key_type & key) const;
484 mapped_type_reference
at(const key_type & key);
500 size_type
count(const key_type & key) const;
514 iterator
find(const key_type & key);
529 const_iterator
find(const key_type & key) const;
560 const value_type & value);
582 const value_type & value);
598 template<class InputIterator>
616 const_iterator position);
630 const key_type & key);
644 const_iterator first,
646 const_iterator last);
661 const key_type & key) const;
670 size_type bucket_index) const;
690 #endif // ifdef DOXYGEN 692 #include <dash/map/UnorderedMap.h> 694 #endif // DASH__UNORDERED_MAP_H__INCLUDED size_type lcapacity() const noexcept
The capacity of the local part of the map.
const_iterator & cend() const noexcept
Global const iterator to the end of the map.
internal::default_unsigned_index default_size_t
Unsigned integer type used as default for size values.
size_type size() const noexcept
The size of the map.
This class is a simple memory pool which holds allocates elements of size ValueType.
const glob_mem_type & globmem() const
Reference to instance of DashGlobalMemoryConcept used for underlying memory management of this contai...
const_iterator & cbegin() const noexcept
Global const iterator to the beginning of the map.
const_mapped_type_reference at(const key_type &key) const
If key matches the key of an element in the container, returns a const reference to its mapped value...
size_type lsize() const noexcept
The number of elements in the local part of the map.
iterator erase(const_iterator position)
Removes and destroys single element referenced by given iterator from the container, decreasing the container size by 1.
key_equal key_eq() const
Returns the function that compares keys for equality.
size_type bucket_size(size_type bucket_index) const
The number of elements in a specified bucket.
Global memory region with dynamic size.
internal::default_signed_index default_index_t
Signed integer type used as default for index values.
A Team instance specifies a subset of all available units.
all units allocate invdividually in local memory and synchronize in epochs
constexpr size_type max_size() const noexcept
Maximum number of elements a map container can hold, e.g.
size_type bucket(const key_type &key) const
Returns the index of the bucket for a specified key.
void deallocate()
Free global memory allocated by this container instance.
iterator & begin() noexcept
Global iterator to the beginning of the map.
constexpr Team & team() const noexcept
The team containing all units accessing this map.
size_type capacity() const noexcept
The number of elements that can be held in currently allocated storage of the map.
iterator & end() noexcept
Global iterator to the end of the map.
hasher hash_function() const
Returns the function that hashes the keys.
const_local_iterator & clbegin() const noexcept
Const local iterator to the local beginning of the map.
local_type local
Local proxy object, allows use in range-based for loops.
bool allocate(size_type nelem=0, dash::Team &team=dash::Team::All())
Allocate memory for this container in global memory.
local_iterator & lbegin() noexcept
Local iterator to the local beginning of the map.
void barrier()
Synchronize changes on local and global memory space of the map since initialization or the last call...
see https://en.cppreference.com/w/cpp/feature_test for recommended feature tests
iterator find(const key_type &key)
Get iterator to element with specified key.
std::pair< iterator, bool > insert(const value_type &value)
Insert a new element as key-value pair, increasing the container size by 1.
const_local_iterator & clend() const noexcept
Local const iterator to the local end of the map.
size_type count(const key_type &key) const
Count elements with a specific key.
local_iterator & lend() noexcept
Local iterator to the local end of the map.
bool empty() const noexcept
Whether the map is empty.