11 ,
typename HomNodeMapType
26 void clear (
bool keepstats =
false) {
43 std::pair<bool,HomNodeMapType>
44 insert(
const MLHomType& hom,
const NodeType& node)
50 found =
cache_.
find ( access, std::make_pair(hom,node));
52 return std::make_pair(
false, access->second);
56 HomNodeMapType result = hom.eval(node);
59 bool insertion =
cache_.
insert ( access, std::make_pair(hom,node));
62 access->second = result;
64 return std::make_pair(insertion,result);
68 std::map<std::string, size_t> get_hits()
const {
return cache_.get_hits(); }
69 std::map<std::string, size_t> get_misses()
const {
return cache_.get_misses(); }
70 std::map<std::string, size_t> get_bounces()
const {
return cache_.get_bounces(); }
Definition: MLCache.hh:14
void clear(bool keepstats=false)
clear the cache, discarding all values.
Definition: MLCache.hh:26
hash_map cache_
Definition: MLCache.hh:20
size_t peak_
Definition: MLCache.hh:16
size_t peak() const
Definition: MLCache.hh:31
MLCache()
Definition: MLCache.hh:23
size_t size() const
Definition: MLCache.hh:39
std::pair< bool, HomNodeMapType > insert(const MLHomType &hom, const NodeType &node)
Definition: MLCache.hh:44
hash_map< std::pair< MLHomType, NodeType >, HomNodeMapType >::type hash_map
Definition: MLCache.hh:19
Definition: ext_hash_map.hh:96
Definition: ext_hash_map.hh:38
Definition: ext_hash_map.hh:21
size_type size() const
Definition: ext_hash_map.hh:199
bool find(accessor &result, const Key &key)
Definition: ext_hash_map.hh:217
bool insert(accessor &result, const Key &key)
Definition: ext_hash_map.hh:235
void clear()
Definition: ext_hash_map.hh:211