xrpld
Loading...
Searching...
No Matches
xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc > Class Template Reference

#include <partitioned_unordered_map.h>

Collaboration diagram for xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >:

Classes

struct  Iterator
struct  ConstIterator

Public Types

using key_type = Key
using mapped_type = Value
using value_type = std::pair<Key const, mapped_type>
using size_type = std::size_t
using difference_type = std::size_t
using hasher = Hash
using key_equal = Pred
using allocator_type = Alloc
using reference = value_type&
using const_reference = value_type const&
using pointer = value_type*
using const_pointer = value_type const*
using map_type = std::unordered_map<key_type, mapped_type, hasher, key_equal, allocator_type>
using partition_map_type = std::vector<map_type>

Public Member Functions

 PartitionedUnorderedMap (std::optional< std::size_t > partitions=std::nullopt)
std::size_t partitions () const
partition_map_typemap ()
Iterator begin ()
ConstIterator cbegin () const
ConstIterator begin () const
Iterator end ()
ConstIterator cend () const
ConstIterator end () const
Iterator find (key_type const &key)
ConstIterator find (key_type const &key) const
template<class T, class U>
std::pair< Iterator, bool > emplace (std::piecewise_construct_t const &, T &&keyTuple, U &&valueTuple)
template<class T, class U>
std::pair< Iterator, bool > emplace (T &&key, U &&val)
void clear ()
Iterator erase (ConstIterator position)
std::size_t size () const
Value & operator[] (Key const &key)

Private Member Functions

std::size_t partitioner (Key const &key) const
template<class T>
void find (key_type const &key, T &it) const

Static Private Member Functions

template<class T>
static void end (T &it)
template<class T>
static void begin (T &it)

Private Attributes

std::size_t partitions_
partition_map_type map_ {}

Detailed Description

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
class xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >

Definition at line 36 of file partitioned_unordered_map.h.

Member Typedef Documentation

◆ key_type

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
using xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::key_type = Key

Definition at line 41 of file partitioned_unordered_map.h.

◆ mapped_type

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
using xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::mapped_type = Value

Definition at line 42 of file partitioned_unordered_map.h.

◆ value_type

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
using xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::value_type = std::pair<Key const, mapped_type>

Definition at line 43 of file partitioned_unordered_map.h.

◆ size_type

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
using xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::size_type = std::size_t

Definition at line 44 of file partitioned_unordered_map.h.

◆ difference_type

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
using xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::difference_type = std::size_t

Definition at line 45 of file partitioned_unordered_map.h.

◆ hasher

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
using xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::hasher = Hash

Definition at line 46 of file partitioned_unordered_map.h.

◆ key_equal

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
using xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::key_equal = Pred

Definition at line 47 of file partitioned_unordered_map.h.

◆ allocator_type

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
using xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::allocator_type = Alloc

Definition at line 48 of file partitioned_unordered_map.h.

◆ reference

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
using xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::reference = value_type&

Definition at line 49 of file partitioned_unordered_map.h.

◆ const_reference

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
using xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::const_reference = value_type const&

Definition at line 50 of file partitioned_unordered_map.h.

◆ pointer

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
using xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::pointer = value_type*

Definition at line 51 of file partitioned_unordered_map.h.

◆ const_pointer

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
using xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::const_pointer = value_type const*

Definition at line 52 of file partitioned_unordered_map.h.

◆ map_type

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
using xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::map_type = std::unordered_map<key_type, mapped_type, hasher, key_equal, allocator_type>

Definition at line 53 of file partitioned_unordered_map.h.

◆ partition_map_type

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
using xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::partition_map_type = std::vector<map_type>

Definition at line 54 of file partitioned_unordered_map.h.

Constructor & Destructor Documentation

◆ PartitionedUnorderedMap()

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::PartitionedUnorderedMap ( std::optional< std::size_t > partitions = std::nullopt)

Definition at line 230 of file partitioned_unordered_map.h.

Member Function Documentation

◆ partitioner()

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
std::size_t xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::partitioner ( Key const & key) const
private

Definition at line 202 of file partitioned_unordered_map.h.

◆ end() [1/3]

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
template<class T>
void xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::end ( T & it)
staticprivate

Definition at line 209 of file partitioned_unordered_map.h.

◆ begin() [1/3]

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
template<class T>
void xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::begin ( T & it)
staticprivate

Definition at line 217 of file partitioned_unordered_map.h.

◆ partitions()

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
std::size_t xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::partitions ( ) const

Definition at line 244 of file partitioned_unordered_map.h.

◆ map()

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
partition_map_type & xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::map ( )

Definition at line 250 of file partitioned_unordered_map.h.

◆ begin() [2/3]

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
Iterator xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::begin ( )

Definition at line 256 of file partitioned_unordered_map.h.

◆ cbegin()

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
ConstIterator xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::cbegin ( ) const

Definition at line 264 of file partitioned_unordered_map.h.

◆ begin() [3/3]

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
ConstIterator xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::begin ( ) const

Definition at line 272 of file partitioned_unordered_map.h.

◆ end() [2/3]

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
Iterator xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::end ( )

Definition at line 278 of file partitioned_unordered_map.h.

◆ cend()

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
ConstIterator xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::cend ( ) const

Definition at line 286 of file partitioned_unordered_map.h.

◆ end() [3/3]

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
ConstIterator xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::end ( ) const

Definition at line 294 of file partitioned_unordered_map.h.

◆ find() [1/3]

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
template<class T>
void xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::find ( key_type const & key,
T & it ) const
private

Definition at line 302 of file partitioned_unordered_map.h.

◆ find() [2/3]

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
Iterator xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::find ( key_type const & key)

Definition at line 312 of file partitioned_unordered_map.h.

◆ find() [3/3]

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
ConstIterator xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::find ( key_type const & key) const

Definition at line 320 of file partitioned_unordered_map.h.

◆ emplace() [1/2]

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
template<class T, class U>
std::pair< Iterator, bool > xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::emplace ( std::piecewise_construct_t const & ,
T && keyTuple,
U && valueTuple )

Definition at line 329 of file partitioned_unordered_map.h.

◆ emplace() [2/2]

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
template<class T, class U>
std::pair< Iterator, bool > xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::emplace ( T && key,
U && val )

Definition at line 342 of file partitioned_unordered_map.h.

◆ clear()

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
void xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::clear ( )

Definition at line 352 of file partitioned_unordered_map.h.

◆ erase()

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
Iterator xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::erase ( ConstIterator position)

Definition at line 359 of file partitioned_unordered_map.h.

◆ size()

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
std::size_t xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::size ( ) const

Definition at line 377 of file partitioned_unordered_map.h.

◆ operator[]()

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
Value & xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::operator[] ( Key const & key)

Definition at line 386 of file partitioned_unordered_map.h.

Member Data Documentation

◆ partitions_

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
std::size_t xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::partitions_
private

Definition at line 38 of file partitioned_unordered_map.h.

◆ map_

template<typename Key, typename Value, typename Hash, typename Pred = std::equal_to<Key>, typename Alloc = std::allocator<std::pair<Key const, Value>>>
partition_map_type xrpl::PartitionedUnorderedMap< Key, Value, Hash, Pred, Alloc >::map_ {}
mutableprivate

Definition at line 392 of file partitioned_unordered_map.h.