CohereSim: A Bus-based Cache Simulator  v3.3
A tool for education in computing - learn about coherence protocols, replacement policies, and SMP vs DSM
Data Structures | Macros
replacement_policy.h File Reference

Declaration of the replacement policy base class. More...

#include "cache_abc.h"
Include dependency graph for replacement_policy.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  ReplacementPolicy
 The base class for replacement policies. More...
 

Macros

#define ADD_REPLACER_TO_CMD_LINE(rep_pol)
 Create a mapping in 'replacement_map' from a string containing the class name to a factory method for the class. More...
 

Detailed Description

Declaration of the replacement policy base class.

Macro Definition Documentation

◆ ADD_REPLACER_TO_CMD_LINE

#define ADD_REPLACER_TO_CMD_LINE (   rep_pol)
Value:
static int register_replacement = []() { \
if (replacement_map == nullptr) replacement_map = new std::map<std::string, rep_factory_t, ci_less>(); \
(*replacement_map)[#rep_pol] = [](CacheABC& cache, uint32_t num_sets, uint32_t assoc) \
{ return new rep_pol(cache, num_sets, assoc); }; return 0; }()
std::map< std::string, rep_factory_t, ci_less > * replacement_map
A map from replacement policy names to their factory functions.
Definition: main.cc:21
Comparator functor for strings, case insensitive.
Definition: typedefs.h:182
std::function< ReplacementPolicy *(CacheABC &, uint32_t, uint32_t)> rep_factory_t
Replacement policy factory function signature.
Definition: typedefs.h:205

Create a mapping in 'replacement_map' from a string containing the class name to a factory method for the class.

Parameters
rep_polThe replacement policy type