DASH
0.3.0
|
Usage examples: More...
#include <UnorderedMap.h>
Public Types | |
typedef Key | key_type |
typedef Mapped | mapped_type |
typedef Hash | hasher |
typedef Pred | key_equal |
typedef dash::default_index_t | index_type |
typedef dash::default_index_t | difference_type |
typedef dash::default_size_t | size_type |
typedef std::pair< const key_type, mapped_type > | value_type |
typedef dash::container_traits< self_type >::local_type | local_type |
typedef GlobHeapPtr< value_type, glob_mem_type > | pointer |
typedef GlobHeapPtr< const value_type, glob_mem_type > | const_pointer |
typedef GlobSharedRef< value_type, GlobHeapPtr< value_type, glob_mem_type > > | reference |
typedef GlobSharedRef< value_type const, GlobHeapPtr< value_type, glob_mem_type > > | const_reference |
typedef reference::template rebind< mapped_type >::other | mapped_type_reference |
typedef const_reference::template rebind< mapped_type >::other | const_mapped_type_reference |
typedef glob_mem_type::global_iterator | node_iterator |
typedef glob_mem_type::const_global_iterator | const_node_iterator |
typedef glob_mem_type::local_iterator | local_node_iterator |
typedef glob_mem_type::const_local_iterator | const_local_node_iterator |
typedef glob_mem_type::reverse_global_iterator | reverse_node_iterator |
typedef glob_mem_type::const_reverse_global_iterator | const_reverse_node_iterator |
typedef glob_mem_type::reverse_local_iterator | reverse_local_node_iterator |
typedef glob_mem_type::const_reverse_local_iterator | const_reverse_local_node_iterator |
typedef glob_mem_type::local_iterator | local_node_pointer |
typedef glob_mem_type::const_local_iterator | const_local_node_pointer |
typedef UnorderedMapGlobIter< Key, Mapped, Hash, Pred, glob_mem_type > | iterator |
typedef UnorderedMapGlobIter< Key, Mapped, Hash, Pred, glob_mem_type > | const_iterator |
typedef std::reverse_iterator< iterator > | reverse_iterator |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
typedef UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LocalMemType > | local_pointer |
typedef UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LocalMemType > | const_local_pointer |
typedef UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LocalMemType > | local_iterator |
typedef UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LocalMemType > | const_local_iterator |
typedef std::reverse_iterator< local_iterator > | reverse_local_iterator |
typedef std::reverse_iterator< const_local_iterator > | const_reverse_local_iterator |
typedef glob_mem_type::local_reference | local_reference |
typedef glob_mem_type::const_local_reference | const_local_reference |
typedef dash::Array< size_type, int, dash::CSRPattern< 1, dash::ROW_MAJOR, int > > | local_sizes_map |
Public Member Functions | |
constexpr Team & | team () const noexcept |
The team containing all units accessing this map. More... | |
const glob_mem_type & | globmem () const |
Reference to instance of DashGlobalMemoryConcept used for underlying memory management of this container instance. More... | |
void | barrier () |
Synchronize changes on local and global memory space of the map since initialization or the last call of its barrier method with global memory. More... | |
bool | allocate (size_type nelem=0, dash::Team &team=dash::Team::All()) |
Allocate memory for this container in global memory. More... | |
void | deallocate () |
Free global memory allocated by this container instance. More... | |
iterator & | begin () noexcept |
Global iterator to the beginning of the map. More... | |
const_iterator & | begin () const noexcept |
Global const iterator to the beginning of the map. More... | |
const_iterator & | cbegin () const noexcept |
Global const iterator to the beginning of the map. More... | |
iterator & | end () noexcept |
Global iterator to the end of the map. More... | |
const_iterator & | end () const noexcept |
Global const iterator to the end of the map. More... | |
const_iterator & | cend () const noexcept |
Global const iterator to the end of the map. More... | |
local_iterator & | lbegin () noexcept |
Local iterator to the local beginning of the map. More... | |
const_local_iterator & | lbegin () const noexcept |
Const local iterator to the local beginning of the map. More... | |
const_local_iterator & | clbegin () const noexcept |
Const local iterator to the local beginning of the map. More... | |
local_iterator & | lend () noexcept |
Local iterator to the local end of the map. More... | |
const_local_iterator & | lend () const noexcept |
Local const iterator to the local end of the map. More... | |
const_local_iterator & | clend () const noexcept |
Local const iterator to the local end of the map. More... | |
constexpr size_type | max_size () const noexcept |
Maximum number of elements a map container can hold, e.g. More... | |
size_type | size () const noexcept |
The size of the map. More... | |
size_type | capacity () const noexcept |
The number of elements that can be held in currently allocated storage of the map. More... | |
bool | empty () const noexcept |
Whether the map is empty. More... | |
size_type | lsize () const noexcept |
The number of elements in the local part of the map. More... | |
size_type | lcapacity () const noexcept |
The capacity of the local part of the map. More... | |
mapped_type_reference | operator[] (const key_type &key) |
If key matches the key of an element in the container, returns a reference to its mapped value. More... | |
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. More... | |
mapped_type_reference | at (const key_type &key) |
If key matches the key of an element in the container, returns a reference to its mapped value. More... | |
size_type | count (const key_type &key) const |
Count elements with a specific key. More... | |
iterator | find (const key_type &key) |
Get iterator to element with specified key. More... | |
const_iterator | find (const key_type &key) const |
Get const_iterator to element with specified key. More... | |
std::pair< iterator, bool > | insert (const value_type &value) |
Insert a new element as key-value pair, increasing the container size by 1. More... | |
iterator | insert (const_iterator hint, const value_type &value) |
inserts value, using hint as a non-binding suggestion to where the search should start. More... | |
template<class InputIterator > | |
void | insert (InputIterator first, InputIterator last) |
Insert elements in iterator range of key-value pairs, increasing the container size by the number of elements in the range. More... | |
iterator | erase (const_iterator position) |
Removes and destroys single element referenced by given iterator from the container, decreasing the container size by 1. More... | |
size_type | erase (const key_type &key) |
Removes and destroys elements referenced by the given key from the container, decreasing the container size by the number of elements removed. More... | |
iterator | erase (const_iterator first, const_iterator last) |
Removes and destroys elements in the given range from the container, decreasing the container size by the number of elements removed. More... | |
size_type | bucket (const key_type &key) const |
Returns the index of the bucket for a specified key. More... | |
size_type | bucket_size (size_type bucket_index) const |
The number of elements in a specified bucket. More... | |
key_equal | key_eq () const |
Returns the function that compares keys for equality. More... | |
hasher | hash_function () const |
Returns the function that hashes the keys. More... | |
Public Attributes | |
local_type | local |
Local proxy object, allows use in range-based for loops. More... | |
Usage examples:
A dynamic map container with support for workload balancing.
Definition at line 33 of file UnorderedMapGlobIter.h.
bool dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::allocate | ( | size_type | nelem = 0 , |
dash::Team & | team = dash::Team::All() |
||
) |
Allocate memory for this container in global memory.
Calls implicit barrier on the team associated with the container instance.
nelem | Initial global capacity of the container. |
team | Team containing all units associated with the container. |
const_mapped_type_reference dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::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.
Throws an exception if key
does not match the key of any element in the container.
Member function operator[]()
has the same behavior when an element with the key exists, but does not throw an exception when it does not.
key
. mapped_type_reference dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::at | ( | const key_type & | key | ) |
If key
matches the key of an element in the container, returns a reference to its mapped value.
Throws an exception if key
does not match the key of any element in the container.
Member function operator[]()
has the same behavior when an element with the key exists, but does not throw an exception when it does not.
key
. void dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::barrier | ( | ) |
Synchronize changes on local and global memory space of the map since initialization or the last call of its barrier
method with global memory.
Referenced by MyHash< Key >::MyHash().
|
noexcept |
Global iterator to the beginning of the map.
After inserting and removing elements, begin and end iterators may differ between units until the next call of commit()
.
Referenced by MyHash< Key >::MyHash().
|
noexcept |
Global const iterator to the beginning of the map.
After inserting and removing elements, begin and end iterators may differ between units until the next call of commit()
.
size_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::bucket | ( | const key_type & | key | ) | const |
Returns the index of the bucket for a specified key.
Elements with keys equivalent to the specified key are always found in this bucket.
key | The value of the key to examine |
size_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::bucket_size | ( | size_type | bucket_index | ) | const |
The number of elements in a specified bucket.
bucket_index | The index of the bucket to examine |
|
noexcept |
The number of elements that can be held in currently allocated storage of the map.
|
noexcept |
Global const iterator to the beginning of the map.
After inserting and removing elements, begin and end iterators may differ between units until the next call of commit()
.
|
noexcept |
Global const iterator to the end of the map.
After inserting and removing elements, begin and end iterators may differ between units until the next call of commit()
.
|
noexcept |
Const local iterator to the local beginning of the map.
After inserting and removing elements, begin and end iterators may differ between units until the next call of commit()
.
|
noexcept |
Local const iterator to the local end of the map.
After inserting and removing elements, begin and end iterators may differ between units until the next call of commit()
.
size_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::count | ( | const key_type & | key | ) | const |
Count elements with a specific key.
Searches the container for elements with specified key and returns the number of elements found. As maps do not allow for duplicate keys, either 1 or 0 elements are matched.
Referenced by MyHash< Key >::MyHash().
void dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::deallocate | ( | ) |
Free global memory allocated by this container instance.
Calls implicit barrier on the team associated with the container instance.
|
noexcept |
Whether the map is empty.
size()
is 0, otherwise false
|
noexcept |
Global iterator to the end of the map.
After inserting and removing elements, begin and end iterators may differ between units until the next call of commit()
.
Referenced by MyHash< Key >::MyHash().
|
noexcept |
Global const iterator to the end of the map.
After inserting and removing elements, begin and end iterators may differ between units until the next call of commit()
.
iterator dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::erase | ( | const_iterator | position | ) |
Removes and destroys single element referenced by given iterator from the container, decreasing the container size by 1.
References and iterators to the erased elements are invalidated. Other iterators and references are not invalidated.
end()
if the last element was removed. size_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::erase | ( | const key_type & | key | ) |
Removes and destroys elements referenced by the given key from the container, decreasing the container size by the number of elements removed.
References and iterators to the erased elements are invalidated. Other iterators and references are not invalidated.
key | Key of the container element to remove. |
iterator dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::erase | ( | const_iterator | first, |
const_iterator | last | ||
) |
Removes and destroys elements in the given range from the container, decreasing the container size by the number of elements removed.
References and iterators to the erased elements are invalidated. Other iterators and references are not invalidated.
end()
if the last element was removed. first | Iterator at first element to remove. |
last | Iterator past the last element to remove. |
iterator dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::find | ( | const key_type & | key | ) |
Get iterator to element with specified key.
The mapped value can also be accessed directly by using member functions at
or operator
[].
Referenced by MyHash< Key >::MyHash().
const_iterator dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::find | ( | const key_type & | key | ) | const |
Get const_iterator to element with specified key.
The mapped value can also be accessed directly by using member functions at
or operator
[].
const glob_mem_type& dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::globmem | ( | ) | const |
Reference to instance of DashGlobalMemoryConcept
used for underlying memory management of this container instance.
Referenced by dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::dart_gptr(), dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::operator pointer(), and dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::operator*().
hasher dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::hash_function | ( | ) | const |
Returns the function that hashes the keys.
std::pair<iterator, bool> dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::insert | ( | const value_type & | value | ) |
Insert a new element as key-value pair, increasing the container size by 1.
Iterator validity:
operator
[]value | The element to insert. |
Referenced by MyHash< Key >::MyHash().
iterator dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::insert | ( | const_iterator | hint, |
const value_type & | value | ||
) |
inserts value, using hint as a non-binding suggestion to where the search should start.
Iterator validity:
void dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::insert | ( | InputIterator | first, |
InputIterator | last | ||
) |
Insert elements in iterator range of key-value pairs, increasing the container size by the number of elements in the range.
Iterator validity:
key_equal dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::key_eq | ( | ) | const |
Returns the function that compares keys for equality.
|
noexcept |
Local iterator to the local beginning of the map.
After inserting and removing elements, begin and end iterators may differ between units until the next call of commit()
.
|
noexcept |
Const local iterator to the local beginning of the map.
After inserting and removing elements, begin and end iterators may differ between units until the next call of commit()
.
|
noexcept |
The capacity of the local part of the map.
|
noexcept |
Local iterator to the local end of the map.
After inserting and removing elements, begin and end iterators may differ between units until the next call of commit()
.
|
noexcept |
Local const iterator to the local end of the map.
After inserting and removing elements, begin and end iterators may differ between units until the next call of commit()
.
|
noexcept |
The number of elements in the local part of the map.
Referenced by MyHash< Key >::MyHash().
|
noexcept |
Maximum number of elements a map container can hold, e.g.
due to system limitations. The maximum size is not guaranteed.
mapped_type_reference dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::operator[] | ( | const key_type & | key | ) |
If key
matches the key of an element in the container, returns a reference to its mapped value.
If key
does not match the key of any element in the container, inserts a new element with that key and returns a reference to its mapped value. Notice that this always increases the container size by one, even if no mapped value is assigned to the element. The element is then constructed using its default constructor.
Equivalent to:
Member function at()
has the same behavior when an element with the key exists, but throws an exception when it does not.
key
.
|
noexcept |
The size of the map.
Referenced by MyHash< Key >::MyHash().
|
noexcept |
The team containing all units accessing this map.
local_type dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::local |
Local proxy object, allows use in range-based for loops.
Definition at line 232 of file UnorderedMap.h.