IMP logo
IMP Reference Guide  develop.27926d84dc,2024/04/18
The Integrative Modeling Platform
IMP::Memoizer< Generator, Checker > Class Template Reference

Helper class for writing memoizers. More...

#include <IMP/cache.h>

Detailed Description

template<class Generator, class Checker = std::equal_to<typename Generator::result_type>>
class IMP::Memoizer< Generator, Checker >

Helper class for writing memoizers.

A memoizer stores the results of a computation to look up later. The result type must support

  • operator=
  • operator==
  • default construction

Definition at line 40 of file cache.h.

Public Types

typedef Generator::argument_type Key
 
typedef Generator::result_type Value
 

Public Member Functions

 Memoizer (const Generator &gen, const Checker &checker=Checker())
 
Generator & access_generator ()
 
const Value & get () const
 
const Generator & get_generator () const
 
double get_hit_rate () const
 
void reset ()
 
void set (const Value &v) const
 Update the stored result manually. More...
 

Member Function Documentation

template<class Generator , class Checker = std::equal_to<typename Generator::result_type>>
void IMP::Memoizer< Generator, Checker >::set ( const Value &  v) const

Update the stored result manually.

Definition at line 75 of file cache.h.


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