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

#include <hashmap.hpp>

+ Collaboration diagram for HashMap< Key, Value, TAllocator >:

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 Member Functions

void rehash ()
 

Private Attributes

chain ** _table
 
size_t _capacity
 
size_t _size
 

Detailed Description

template<typename Key, typename Value, typename TAllocator = mos::default_allocator>
class mos::HashMap< Key, Value, TAllocator >

Definition at line 19 of file hashmap.hpp.

Member Typedef Documentation

◆ entry_type

template<typename Key, typename Value, typename TAllocator = mos::default_allocator>
typedef std::tuple<const Key, Value> entry_type

Definition at line 22 of file hashmap.hpp.

Constructor & Destructor Documentation

◆ HashMap() [1/3]

template<typename Key, typename Value, typename TAllocator = mos::default_allocator>
HashMap ( )
inlineconstexpr

Definition at line 139 of file hashmap.hpp.

Referenced by HashMap().

◆ HashMap() [2/3]

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

Definition at line 140 of file hashmap.hpp.

+ Here is the call graph for this function:

◆ ~HashMap()

template<typename Key, typename Value, typename TAllocator = mos::default_allocator>
~HashMap ( )
inline

Definition at line 147 of file hashmap.hpp.

◆ HashMap() [3/3]

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

Member Function Documentation

◆ insert() [1/2]

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

Definition at line 246 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, typename TAllocator>
void insert ( const Key & key,
Value && value )

Definition at line 261 of file hashmap.hpp.

+ Here is the call graph for this function:

◆ operator[]()

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

Definition at line 276 of file hashmap.hpp.

+ Here is the call graph for this function:

◆ empty()

template<typename Key, typename Value, typename TAllocator = mos::default_allocator>
bool empty ( )
inline

Definition at line 169 of file hashmap.hpp.

◆ end() [1/2]

template<typename Key, typename Value, typename TAllocator = mos::default_allocator>
iterator end ( )
inline

Definition at line 174 of file hashmap.hpp.

Referenced by find(), and find().

◆ find() [1/2]

template<typename Key, typename Value, typename TAllocator = mos::default_allocator>
iterator find ( const Key & key)
inline

Definition at line 179 of file hashmap.hpp.

+ Here is the call graph for this function:

◆ begin()

template<typename Key, typename Value, typename TAllocator = mos::default_allocator>
iterator begin ( )
inline

Definition at line 194 of file hashmap.hpp.

◆ end() [2/2]

template<typename Key, typename Value, typename TAllocator = mos::default_allocator>
const_iterator end ( ) const
inline

Definition at line 209 of file hashmap.hpp.

◆ find() [2/2]

template<typename Key, typename Value, typename TAllocator = mos::default_allocator>
const_iterator find ( const Key & key) const
inline

Definition at line 214 of file hashmap.hpp.

+ Here is the call graph for this function:

◆ get()

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

Definition at line 307 of file hashmap.hpp.

Referenced by pagecache_flush_or_drop(), and pagecache_get_page_for_read().

◆ remove()

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

Definition at line 324 of file hashmap.hpp.

Referenced by do_flush_and_drop_cached_page().

◆ size()

template<typename Key, typename Value, typename TAllocator = mos::default_allocator>
size_t size ( ) const
inline

Definition at line 232 of file hashmap.hpp.

◆ rehash()

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

Definition at line 354 of file hashmap.hpp.

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

Member Data Documentation

◆ _table

template<typename Key, typename Value, typename TAllocator = mos::default_allocator>
chain** _table
private

◆ _capacity

template<typename Key, typename Value, typename TAllocator = mos::default_allocator>
size_t _capacity
private

◆ _size

template<typename Key, typename Value, typename TAllocator = mos::default_allocator>
size_t _size
private

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