-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStrategy.cpp
More file actions
79 lines (63 loc) · 1.34 KB
/
Strategy.cpp
File metadata and controls
79 lines (63 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <iostream>
#include <stdint.h>
namespace SM
{
template <class T>
class CachableElement
{
public:
CachableElement() {};
~CachableElement() {};
CachableElement(CachableElement&) {};
CachableElement& operator=(const CachableElement&) {};
T key() {} = 0;
};
class CacheStrategy
{
public:
CacheStrategy() {};
~CacheStrategy() {};
private:
CacheStrategy(CacheStrategy&);
CacheStrategy& operator=(const CacheStrategy&);
};
template <class Strategy>
class Cache
{
public:
Cache(const uint32_t cacheSizeLocations) {};
~Cache() {};
void setCacheStrategy(CacheStrategy& newStrategy);
private:
Cache(Cache&);
Cache& operator=(const Cache&);
Strategy m_defaultStrategy;
CacheStrategy& m_masterStrategy;
};
class CacheStrategyLRU : public CacheStrategy
{
public:
CacheStrategyLRU() {};
~CacheStrategyLRU() {};
private:
CacheStrategyLRU(CacheStrategyLRU&);
CacheStrategyLRU& operator=(const CacheStrategyLRU&);
};
class CacheClient
{
public:
CacheClient();
~CacheClient();
private:
CacheClient(CacheClient&);
CacheClient& operator=(const CacheClient&);
};
};
int main(int argc, char* argv[])
{
SM::Cache<int> myCache;
//SM::Cache<SM::CacheStrategyLRU> myCache;
(argc);
(argv);
return 0;
}