Bitcoin Core  0.15.99
P2P Digital Currency
Public Types | Public Member Functions | Protected Types | Protected Attributes | List of all members
limitedmap< K, V > 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::map< K, V >::const_iterator const_iterator
 
typedef std::map< K, V >::size_type size_type
 

Public Member Functions

 limitedmap (size_type nMaxSizeIn)
 
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 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 s)
 

Protected Types

typedef std::map< K, V >::iterator iterator
 
typedef std::multimap< V, iterator >::iterator rmap_iterator
 

Protected Attributes

std::map< K, V > map
 
std::multimap< V, iteratorrmap
 
size_type nMaxSize
 

Detailed Description

template<typename K, typename V>
class limitedmap< K, V >

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

Definition at line 13 of file limitedmap.h.

Member Typedef Documentation

template<typename K, typename V>
typedef std::map<K, V>::const_iterator limitedmap< K, V >::const_iterator

Definition at line 19 of file limitedmap.h.

template<typename K, typename V>
typedef std::map<K, V>::iterator limitedmap< K, V >::iterator
protected

Definition at line 24 of file limitedmap.h.

template<typename K, typename V>
typedef K limitedmap< K, V >::key_type

Definition at line 16 of file limitedmap.h.

template<typename K, typename V>
typedef V limitedmap< K, V >::mapped_type

Definition at line 17 of file limitedmap.h.

template<typename K, typename V>
typedef std::multimap<V, iterator>::iterator limitedmap< K, V >::rmap_iterator
protected

Definition at line 26 of file limitedmap.h.

template<typename K, typename V>
typedef std::map<K, V>::size_type limitedmap< K, V >::size_type

Definition at line 20 of file limitedmap.h.

template<typename K, typename V>
typedef std::pair<const key_type, mapped_type> limitedmap< K, V >::value_type

Definition at line 18 of file limitedmap.h.

Constructor & Destructor Documentation

template<typename K, typename V>
limitedmap< K, V >::limitedmap ( size_type  nMaxSizeIn)
inlineexplicit

Definition at line 30 of file limitedmap.h.

Member Function Documentation

template<typename K, typename V>
const_iterator limitedmap< K, V >::begin ( ) const
inline

Definition at line 35 of file limitedmap.h.

template<typename K, typename V>
size_type limitedmap< K, V >::count ( const key_type k) const
inline

Definition at line 40 of file limitedmap.h.

template<typename K, typename V>
bool limitedmap< K, V >::empty ( ) const
inline

Definition at line 38 of file limitedmap.h.

template<typename K, typename V>
const_iterator limitedmap< K, V >::end ( ) const
inline

Definition at line 36 of file limitedmap.h.

template<typename K, typename V>
void limitedmap< K, V >::erase ( const key_type k)
inline

Definition at line 52 of file limitedmap.h.

template<typename K, typename V>
const_iterator limitedmap< K, V >::find ( const key_type k) const
inline

Definition at line 39 of file limitedmap.h.

template<typename K, typename V>
void limitedmap< K, V >::insert ( const value_type x)
inline

Definition at line 41 of file limitedmap.h.

template<typename K, typename V>
size_type limitedmap< K, V >::max_size ( ) const
inline

Definition at line 87 of file limitedmap.h.

template<typename K, typename V>
size_type limitedmap< K, V >::max_size ( size_type  s)
inline

Definition at line 88 of file limitedmap.h.

template<typename K, typename V>
size_type limitedmap< K, V >::size ( ) const
inline

Definition at line 37 of file limitedmap.h.

template<typename K, typename V>
void limitedmap< K, V >::update ( const_iterator  itIn,
const mapped_type v 
)
inline

Definition at line 67 of file limitedmap.h.

Member Data Documentation

template<typename K, typename V>
std::map<K, V> limitedmap< K, V >::map
protected

Definition at line 23 of file limitedmap.h.

template<typename K, typename V>
size_type limitedmap< K, V >::nMaxSize
protected

Definition at line 27 of file limitedmap.h.

template<typename K, typename V>
std::multimap<V, iterator> limitedmap< K, V >::rmap
protected

Definition at line 25 of file limitedmap.h.


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