MOS Source Code
Loading...
Searching...
No Matches
HashMap< Key, Value > Class Template Reference

#include <hashmap.hpp>

Collaboration diagram for HashMap< Key, Value >:

Classes

struct  chain
class  const_iterator
class  iterator

Public Types

typedef std::tuple< const Key, Value > entry_type

Public Member Functions

constexpr HashMap ()
 HashMap (std::initializer_list< entry_type > init)
 ~HashMap ()
 HashMap (const HashMap &)=delete
void insert (const Key &key, const Value &value)
void insert (const Key &key, Value &&value)
Value & operator[] (const Key &key)
bool empty ()
iterator end ()
iterator find (const Key &key)
iterator begin ()
const_iterator end () const
const_iterator find (const Key &key) const
std::optional< Value > get (const Key &key)
std::optional< Value > remove (const Key &key)
size_t size () const

Private Types

using ChainAllocator = mos::default_allocator<chain *>

Private Member Functions

void rehash ()

Private Attributes

chain ** _table
size_t _capacity
size_t _size

Detailed Description

template<typename Key, typename Value>
class mos::HashMap< Key, Value >

Definition at line 19 of file hashmap.hpp.

Member Typedef Documentation

◆ entry_type

template<typename Key, typename Value>
typedef std::tuple<const Key, Value> entry_type

Definition at line 22 of file hashmap.hpp.

◆ ChainAllocator

template<typename Key, typename Value>
using ChainAllocator = mos::default_allocator<chain *>
private

Definition at line 32 of file hashmap.hpp.

Constructor & Destructor Documentation

◆ HashMap() [1/3]

template<typename Key, typename Value>
HashMap ( )
inlineconstexpr

Definition at line 140 of file hashmap.hpp.

Referenced by HashMap().

◆ HashMap() [2/3]

template<typename Key, typename Value>
HashMap ( std::initializer_list< entry_type > init)
inline

Definition at line 141 of file hashmap.hpp.

Here is the call graph for this function:

◆ ~HashMap()

template<typename Key, typename Value>
~HashMap ( )
inline

Definition at line 148 of file hashmap.hpp.

◆ HashMap() [3/3]

template<typename Key, typename Value>
HashMap ( const HashMap< Key, Value > & )
delete
Here is the call graph for this function:

Member Function Documentation

◆ insert() [1/2]

template<typename Key, typename Value>
void insert ( const Key & key,
const Value & value )

Definition at line 247 of file hashmap.hpp.

Referenced by HashMap(), and pagecache_get_page_for_read().

Here is the call graph for this function:

◆ insert() [2/2]

template<typename Key, typename Value>
void insert ( const Key & key,
Value && value )

Definition at line 262 of file hashmap.hpp.

Here is the call graph for this function:

◆ operator[]()

template<typename Key, typename Value>
Value & operator[] ( const Key & key)

Definition at line 277 of file hashmap.hpp.

Here is the call graph for this function:

◆ empty()

template<typename Key, typename Value>
bool empty ( )
inline

Definition at line 170 of file hashmap.hpp.

◆ end() [1/2]

template<typename Key, typename Value>
iterator end ( )
inline

Definition at line 175 of file hashmap.hpp.

Referenced by find(), and find().

◆ find() [1/2]

template<typename Key, typename Value>
iterator find ( const Key & key)
inline

Definition at line 180 of file hashmap.hpp.

Here is the call graph for this function:

◆ begin()

template<typename Key, typename Value>
iterator begin ( )
inline

Definition at line 195 of file hashmap.hpp.

◆ end() [2/2]

template<typename Key, typename Value>
const_iterator end ( ) const
inline

Definition at line 210 of file hashmap.hpp.

◆ find() [2/2]

template<typename Key, typename Value>
const_iterator find ( const Key & key) const
inline

Definition at line 215 of file hashmap.hpp.

Here is the call graph for this function:

◆ get()

template<typename Key, typename Value>
std::optional< Value > get ( const Key & key)

Definition at line 308 of file hashmap.hpp.

Referenced by pagecache_flush_or_drop(), and pagecache_get_page_for_read().

◆ remove()

template<typename Key, typename Value>
std::optional< Value > remove ( const Key & key)

Definition at line 325 of file hashmap.hpp.

Referenced by do_flush_and_drop_cached_page().

◆ size()

template<typename Key, typename Value>
size_t size ( ) const
inline

Definition at line 233 of file hashmap.hpp.

◆ rehash()

template<typename Key, typename Value>
void rehash ( )
private

Definition at line 355 of file hashmap.hpp.

Referenced by insert(), insert(), and operator[]().

Member Data Documentation

◆ _table

template<typename Key, typename Value>
chain** _table
private

◆ _capacity

◆ _size

template<typename Key, typename Value>
size_t _size
private

The documentation for this class was generated from the following file: