Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

Map like container that keeps the N most recently added items. More...

#include <cachemap.h>

Public Types

typedef Size size_type
 
typedef CacheItem< K, V > item_t
 
typedef std::list< item_tlist_t
 
typedef list_t::iterator list_it
 
typedef list_t::const_iterator list_cit
 
typedef std::map< K, list_itmap_t
 
typedef map_t::iterator map_it
 
typedef map_t::const_iterator map_cit
 

Public Member Functions

 CacheMap (size_type nMaxSizeIn=0)
 
 CacheMap (const CacheMap< K, V > &other)
 
void Clear ()
 
void SetMaxSize (size_type nMaxSizeIn)
 
size_type GetMaxSize () const
 
size_type GetSize () const
 
bool Insert (const K &key, const V &value)
 
bool HasKey (const K &key) const
 
bool Get (const K &key, V &value) const
 
void Erase (const K &key)
 
const list_tGetItemList () const
 
CacheMap< K, V > & operator= (const CacheMap< K, V > &other)
 
template<typename Stream , typename Operation >
void SerializationOp (Stream &s, Operation ser_action)
 

Public Attributes

 ADD_SERIALIZE_METHODS
 

Private Member Functions

void PruneLast ()
 
void RebuildIndex ()
 

Private Attributes

size_type nMaxSize
 
list_t listItems
 
map_t mapIndex
 

Detailed Description

template<typename K, typename V, typename Size = uint32_t>
class CacheMap< K, V, Size >

Map like container that keeps the N most recently added items.

Definition at line 46 of file cachemap.h.

Member Typedef Documentation

◆ item_t

template<typename K, typename V, typename Size = uint32_t>
typedef CacheItem<K,V> CacheMap< K, V, Size >::item_t

Definition at line 51 of file cachemap.h.

◆ list_cit

template<typename K, typename V, typename Size = uint32_t>
typedef list_t::const_iterator CacheMap< K, V, Size >::list_cit

Definition at line 57 of file cachemap.h.

◆ list_it

template<typename K, typename V, typename Size = uint32_t>
typedef list_t::iterator CacheMap< K, V, Size >::list_it

Definition at line 55 of file cachemap.h.

◆ list_t

template<typename K, typename V, typename Size = uint32_t>
typedef std::list<item_t> CacheMap< K, V, Size >::list_t

Definition at line 53 of file cachemap.h.

◆ map_cit

template<typename K, typename V, typename Size = uint32_t>
typedef map_t::const_iterator CacheMap< K, V, Size >::map_cit

Definition at line 63 of file cachemap.h.

◆ map_it

template<typename K, typename V, typename Size = uint32_t>
typedef map_t::iterator CacheMap< K, V, Size >::map_it

Definition at line 61 of file cachemap.h.

◆ map_t

template<typename K, typename V, typename Size = uint32_t>
typedef std::map<K, list_it> CacheMap< K, V, Size >::map_t

Definition at line 59 of file cachemap.h.

◆ size_type

template<typename K, typename V, typename Size = uint32_t>
typedef Size CacheMap< K, V, Size >::size_type

Definition at line 49 of file cachemap.h.

Constructor & Destructor Documentation

◆ CacheMap() [1/2]

template<typename K, typename V, typename Size = uint32_t>
CacheMap< K, V, Size >::CacheMap ( size_type  nMaxSizeIn = 0)
inlineexplicit

Definition at line 73 of file cachemap.h.

◆ CacheMap() [2/2]

template<typename K, typename V, typename Size = uint32_t>
CacheMap< K, V, Size >::CacheMap ( const CacheMap< K, V > &  other)
inline

Definition at line 79 of file cachemap.h.

Member Function Documentation

◆ Clear()

template<typename K, typename V, typename Size = uint32_t>
void CacheMap< K, V, Size >::Clear ( )
inline

Definition at line 87 of file cachemap.h.

Referenced by CGovernanceManager::Clear(), and CGovernanceManager::RebuildIndexes().

◆ Erase()

template<typename K, typename V, typename Size = uint32_t>
void CacheMap< K, V, Size >::Erase ( const K &  key)
inline

◆ Get()

template<typename K, typename V, typename Size = uint32_t>
bool CacheMap< K, V, Size >::Get ( const K &  key,
V &  value 
) const
inline

◆ GetItemList()

template<typename K, typename V, typename Size = uint32_t>
const list_t& CacheMap< K, V, Size >::GetItemList ( ) const
inline

Definition at line 145 of file cachemap.h.

Referenced by CGovernanceManager::UpdateCachesAndClean().

◆ GetMaxSize()

template<typename K, typename V, typename Size = uint32_t>
size_type CacheMap< K, V, Size >::GetMaxSize ( ) const
inline

Definition at line 98 of file cachemap.h.

◆ GetSize()

template<typename K, typename V, typename Size = uint32_t>
size_type CacheMap< K, V, Size >::GetSize ( ) const
inline

◆ HasKey()

template<typename K, typename V, typename Size = uint32_t>
bool CacheMap< K, V, Size >::HasKey ( const K &  key) const
inline

◆ Insert()

template<typename K, typename V, typename Size = uint32_t>
bool CacheMap< K, V, Size >::Insert ( const K &  key,
const V &  value 
)
inline

◆ operator=()

template<typename K, typename V, typename Size = uint32_t>
CacheMap<K,V>& CacheMap< K, V, Size >::operator= ( const CacheMap< K, V > &  other)
inline

Definition at line 149 of file cachemap.h.

◆ PruneLast()

template<typename K, typename V, typename Size = uint32_t>
void CacheMap< K, V, Size >::PruneLast ( )
inlineprivate

Definition at line 170 of file cachemap.h.

Referenced by CacheMap< uint256, CGovernanceVote >::Insert().

◆ RebuildIndex()

template<typename K, typename V, typename Size = uint32_t>
void CacheMap< K, V, Size >::RebuildIndex ( )
inlineprivate

◆ SerializationOp()

template<typename K, typename V, typename Size = uint32_t>
template<typename Stream , typename Operation >
void CacheMap< K, V, Size >::SerializationOp ( Stream &  s,
Operation  ser_action 
)
inline

Definition at line 160 of file cachemap.h.

◆ SetMaxSize()

template<typename K, typename V, typename Size = uint32_t>
void CacheMap< K, V, Size >::SetMaxSize ( size_type  nMaxSizeIn)
inline

Definition at line 93 of file cachemap.h.

Member Data Documentation

◆ ADD_SERIALIZE_METHODS

template<typename K, typename V, typename Size = uint32_t>
CacheMap< K, V, Size >::ADD_SERIALIZE_METHODS

Definition at line 157 of file cachemap.h.

◆ listItems

◆ mapIndex

◆ nMaxSize


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