Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

unordered_limitedmap< K, V, Hash > Class Template Reference

STL-like map container that only keeps the N elements with the highest value. More...

#include <limitedmap.h>

Public Types

typedef K key_type
 
typedef V mapped_type
 
typedef std::pair< const key_type, mapped_typevalue_type
 
typedef std::unordered_map< K, V, Hash >::const_iterator const_iterator
 
typedef std::unordered_map< K, V, Hash >::size_type size_type
 

Public Member Functions

 unordered_limitedmap (size_type nMaxSizeIn, size_type nPruneAfterSizeIn=0)
 
const_iterator begin () const
 
const_iterator end () const
 
size_type size () const
 
bool empty () const
 
const_iterator find (const key_type &k) const
 
size_type count (const key_type &k) const
 
void insert (const value_type &x)
 
void insert_or_update (const value_type &x)
 
void erase (const key_type &k)
 
void update (const_iterator itIn, const mapped_type &v)
 
size_type max_size () const
 
size_type max_size (size_type nMaxSizeIn, size_type nPruneAfterSizeIn=0)
 
void prune ()
 

Protected Types

typedef std::unordered_map< K, V, Hash >::iterator iterator
 

Protected Attributes

std::unordered_map< K, V, Hashmap
 
size_type nMaxSize
 
size_type nPruneAfterSize
 

Detailed Description

template<typename K, typename V, typename Hash = std::hash<K>>
class unordered_limitedmap< K, V, Hash >

STL-like map container that only keeps the N elements with the highest value.

Definition at line 18 of file limitedmap.h.

Member Typedef Documentation

◆ const_iterator

template<typename K, typename V, typename Hash = std::hash<K>>
typedef std::unordered_map<K, V, Hash>::const_iterator unordered_limitedmap< K, V, Hash >::const_iterator

Definition at line 24 of file limitedmap.h.

◆ iterator

template<typename K, typename V, typename Hash = std::hash<K>>
typedef std::unordered_map<K, V, Hash>::iterator unordered_limitedmap< K, V, Hash >::iterator
protected

Definition at line 29 of file limitedmap.h.

◆ key_type

template<typename K, typename V, typename Hash = std::hash<K>>
typedef K unordered_limitedmap< K, V, Hash >::key_type

Definition at line 21 of file limitedmap.h.

◆ mapped_type

template<typename K, typename V, typename Hash = std::hash<K>>
typedef V unordered_limitedmap< K, V, Hash >::mapped_type

Definition at line 22 of file limitedmap.h.

◆ size_type

template<typename K, typename V, typename Hash = std::hash<K>>
typedef std::unordered_map<K, V, Hash>::size_type unordered_limitedmap< K, V, Hash >::size_type

Definition at line 25 of file limitedmap.h.

◆ value_type

template<typename K, typename V, typename Hash = std::hash<K>>
typedef std::pair<const key_type, mapped_type> unordered_limitedmap< K, V, Hash >::value_type

Definition at line 23 of file limitedmap.h.

Constructor & Destructor Documentation

◆ unordered_limitedmap()

template<typename K, typename V, typename Hash = std::hash<K>>
unordered_limitedmap< K, V, Hash >::unordered_limitedmap ( size_type  nMaxSizeIn,
size_type  nPruneAfterSizeIn = 0 
)
inlineexplicit

Definition at line 34 of file limitedmap.h.

Member Function Documentation

◆ begin()

template<typename K, typename V, typename Hash = std::hash<K>>
const_iterator unordered_limitedmap< K, V, Hash >::begin ( ) const
inline

Definition at line 45 of file limitedmap.h.

◆ count()

template<typename K, typename V, typename Hash = std::hash<K>>
size_type unordered_limitedmap< K, V, Hash >::count ( const key_type k) const
inline

Definition at line 50 of file limitedmap.h.

◆ empty()

template<typename K, typename V, typename Hash = std::hash<K>>
bool unordered_limitedmap< K, V, Hash >::empty ( ) const
inline

Definition at line 48 of file limitedmap.h.

◆ end()

template<typename K, typename V, typename Hash = std::hash<K>>
const_iterator unordered_limitedmap< K, V, Hash >::end ( ) const
inline

Definition at line 46 of file limitedmap.h.

Referenced by CBlockTreeDB::HasTxIndex().

◆ erase()

template<typename K, typename V, typename Hash = std::hash<K>>
void unordered_limitedmap< K, V, Hash >::erase ( const key_type k)
inline

Definition at line 65 of file limitedmap.h.

◆ find()

template<typename K, typename V, typename Hash = std::hash<K>>
const_iterator unordered_limitedmap< K, V, Hash >::find ( const key_type k) const
inline

Definition at line 49 of file limitedmap.h.

Referenced by CBlockTreeDB::HasTxIndex().

◆ insert()

template<typename K, typename V, typename Hash = std::hash<K>>
void unordered_limitedmap< K, V, Hash >::insert ( const value_type x)
inline

Definition at line 51 of file limitedmap.h.

Referenced by CBlockTreeDB::HasTxIndex().

◆ insert_or_update()

template<typename K, typename V, typename Hash = std::hash<K>>
void unordered_limitedmap< K, V, Hash >::insert_or_update ( const value_type x)
inline

Definition at line 57 of file limitedmap.h.

Referenced by CBlockTreeDB::ReadTxIndex(), and CBlockTreeDB::WriteTxIndex().

◆ max_size() [1/2]

template<typename K, typename V, typename Hash = std::hash<K>>
size_type unordered_limitedmap< K, V, Hash >::max_size ( ) const
inline

Definition at line 79 of file limitedmap.h.

◆ max_size() [2/2]

template<typename K, typename V, typename Hash = std::hash<K>>
size_type unordered_limitedmap< K, V, Hash >::max_size ( size_type  nMaxSizeIn,
size_type  nPruneAfterSizeIn = 0 
)
inline

Definition at line 80 of file limitedmap.h.

◆ prune()

template<typename K, typename V, typename Hash = std::hash<K>>
void unordered_limitedmap< K, V, Hash >::prune ( )
inline

◆ size()

template<typename K, typename V, typename Hash = std::hash<K>>
size_type unordered_limitedmap< K, V, Hash >::size ( ) const
inline

Definition at line 47 of file limitedmap.h.

◆ update()

template<typename K, typename V, typename Hash = std::hash<K>>
void unordered_limitedmap< K, V, Hash >::update ( const_iterator  itIn,
const mapped_type v 
)
inline

Definition at line 69 of file limitedmap.h.

Member Data Documentation

◆ map

◆ nMaxSize

template<typename K, typename V, typename Hash = std::hash<K>>
size_type unordered_limitedmap< K, V, Hash >::nMaxSize
protected

◆ nPruneAfterSize

template<typename K, typename V, typename Hash = std::hash<K>>
size_type unordered_limitedmap< K, V, Hash >::nPruneAfterSize
protected

The documentation for this class was generated from the following file:
Released under the MIT license