MRPT  2.0.4
Classes | Namespaces | Functions | Variables
ts_hash_map.h File Reference
#include <mrpt/core/common.h>
#include <mrpt/core/integer_select.h>
#include <array>
#include <stdexcept>
#include <string_view>
Include dependency graph for ts_hash_map.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mrpt::containers::ts_map_entry< KEY, VALUE >
 

Namespaces

 mrpt::containers
 

Functions

void mrpt::containers::reduced_hash (const std::string_view &value, uint8_t &hash)
 hash function used by ts_hash_map. More...
 
void mrpt::containers::reduced_hash (const std::string_view &value, uint16_t &hash)
 
void mrpt::containers::reduced_hash (const std::string_view &value, uint32_t &hash)
 
void mrpt::containers::reduced_hash (const std::string_view &value, uint64_t &hash)
 
template<typename KEY , typename VALUE , unsigned int NUM_BYTES_HASH_TABLE = 1, unsigned int NUM_HAS_TABLE_COLLISIONS_ALLOWED = 5, typename VECTOR_T = std::array< std::array<ts_map_entry<KEY, VALUE>, NUM_HAS_TABLE_COLLISIONS_ALLOWED>, 1u << (8 * NUM_BYTES_HASH_TABLE)>>class ts_hash_map{ public: using self_t = ts_hash_map< KEY, VALUE, NUM_BYTES_HASH_TABLE, NUM_HAS_TABLE_COLLISIONS_ALLOWED, VECTOR_T>; using key_type = KEY; using value_type = ts_map_entry<KEY, VALUE>; using vec_t = VECTOR_T; struct iterator; struct const_iterator { public: const_iterator() : m_vec(nullptr), m_parent(nullptr) {} const_iterator( const VECTOR_T& vec, const self_t& parent, int idx_outer, int idx_inner) : m_vec(const_cast<VECTOR_T*>(&vec)), m_parent(const_cast<self_t*>(&parent)), m_idx_outer(idx_outer), m_idx_inner(idx_inner) { } const_iterator(const const_iterator& o) { *this = o; } const_iterator& operator=(const const_iterator& o) { m_vec = o.m_vec; m_idx_outer = o.m_idx_outer; m_idx_inner = o.m_idx_inner; return *this; } bool operator==(const const_iterator& o) const { return m_vec == o.m_vec && m_idx_outer == o.m_idx_outer && m_idx_inner == o.m_idx_inner; } bool operator!=(const const_iterator& o) const { return !(*this == o); } const value_type& operator*() const { return (*m_vec)[m_idx_outer][m_idx_inner]; } const value_type* operator->() const { return &(*m_vec)[m_idx_outer][m_idx_inner]; } inline const_iterator operator++(int) { const_iterator aux = *this; ++(*this); return aux; } inline const_iterator& operator++() { incr(); return *this; } protected: VECTOR_T* m_vec; self_t* m_parent; int m_idx_outer{0}>
iterator mrpt::containers::operator++ (int)
 A thread-safe (ts) container which minimally emulates a std::map<>'s [] and find() methods but which is implemented as a linear vector indexed by a hash of KEY. More...
 
iterator & mrpt::containers::operator++ ()
 
Constructors, read/write access and other operations
 mrpt::containers::ts_hash_map ()=default
 < Default constructor */ More...
 
void mrpt::containers::clear ()
 Clear the contents of this container. More...
 
bool mrpt::containers::empty () const
 
VALUE * mrpt::containers::find_or_alloc (const KEY &key) noexcept
 noexcept version of operator[], returns nullptr upon failure More...
 
VALUE & mrpt::containers::operator[] (const KEY &key)
 Write/read via [i] operator, that creates an element if it didn't exist already. More...
 
const_iterator mrpt::containers::find (const KEY &key) const
 
const_iterator mrpt::containers::begin () const
 
const_iterator mrpt::containers::end () const
 

Variables

vec_t mrpt::containers::m_vec
 The actual container. More...
 
size_t mrpt::containers::m_size {0}
 Number of elements accessed with write access so far. More...
 



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020