Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
Go to the documentation of this file. 5 #ifndef CACHEMULTIMAP_H_ 6 #define CACHEMULTIMAP_H_ 20 template<
typename K,
typename V,
typename Size = u
int32_t>
30 typedef typename list_t::iterator
list_it;
32 typedef typename list_t::const_iterator
list_cit;
40 typedef std::map<K, it_map_t>
map_t;
42 typedef typename map_t::iterator
map_it;
44 typedef typename map_t::const_iterator
map_cit;
87 bool Insert(
const K& key,
const V& value)
95 if(mapIt.count(value) > 0) {
113 bool Get(
const K& key, V& value)
const 120 const item_t& item = *(mapIt.begin()->second);
125 bool GetAll(
const K& key, std::vector<V>& vecValues)
131 const it_map_t& mapIt = mit->second;
133 for(
it_map_cit it = mapIt.begin(); it != mapIt.end(); ++it) {
134 const item_t& item = *(it->second);
135 vecValues.push_back(item.
value);
143 vecKeys.push_back(it->first);
155 for(
it_map_it it = mapIt.begin(); it != mapIt.end(); ++it) {
162 void Erase(
const K& key,
const V& value)
171 if(it == mapIt.end()) {
197 template <
typename Stream,
typename Operation>
202 if(ser_action.ForRead()) {
223 mapIt.erase(item.
value);
243 mapIt.emplace(item.
value, lit);
std::map< V, list_it > it_map_t
Map like container that keeps the N most recently added items.
CacheMap< K, V > & operator=(const CacheMap< K, V > &other)
it_map_t::iterator it_map_it
void Erase(const K &key, const V &value)
CacheMultiMap(size_type nMaxSizeIn=0)
std::list< item_t > list_t
bool Get(const K &key, V &value) const
Map like container that keeps the N most recently added items.
bool HasKey(const K &key) const
Serializable structure for key/value items.
const list_t & GetItemList() const
bool GetAll(const K &key, std::vector< V > &vecValues)
void SerializationOp(Stream &s, Operation ser_action)
it_map_t::const_iterator it_map_cit
size_type GetMaxSize() const
size_type GetSize() const
std::map< K, it_map_t > map_t
list_t::const_iterator list_cit
CacheMultiMap(const CacheMap< K, V > &other)
map_t::const_iterator map_cit
void SetMaxSize(size_type nMaxSizeIn)
void GetKeys(std::vector< K > &vecKeys)
bool Insert(const K &key, const V &value)