Main MRPT website > C++ reference for MRPT 1.9.9
Classes | Namespaces | Functions | Variables
ts_hash_map.h File Reference
#include <mrpt/core/integer_select.h>
#include <mrpt/core/common.h>
#include <array>
#include <stdexcept>
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
 This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
 
 mrpt::containers
 

Functions

void mrpt::containers::reduced_hash (const std::string &value, uint8_t &hash)
 hash function used by ts_hash_map. More...
 
void mrpt::containers::reduced_hash (const std::string &value, uint16_t &hash)
 hash function used by ts_hash_map. More...
 
void mrpt::containers::reduced_hash (const std::string &value, uint32_t &hash)
 hash function used by ts_hash_map. More...
 
void mrpt::containers::reduced_hash (const std::string &value, uint64_t &hash)
 hash function used by ts_hash_map. More...
 
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), m_idx_outer(0), m_idx_inner(0) { } 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& 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>
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...
 
iteratormrpt::containers::operator++ ()
 
Constructors, read/write access and other operations
 mrpt::containers::ts_hash_map ()
 < Default constructor *‍/ More...
 
void mrpt::containers::clear ()
 Clear the contents of this container. More...
 
bool mrpt::containers::empty () const
 
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
 
Constructors, read/write access and other operations
 mrpt::containers::ts_hash_map ()
 < Default constructor *‍/ More...
 
void mrpt::containers::clear ()
 Clear the contents of this container. More...
 
bool mrpt::containers::empty () const
 
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
 Number of elements accessed with write access so far. More...
 



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST