summaryrefslogtreecommitdiff
path: root/src/cachecalc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cachecalc.h')
-rw-r--r--src/cachecalc.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/cachecalc.h b/src/cachecalc.h
index 289c4ac..dd9712f 100644
--- a/src/cachecalc.h
+++ b/src/cachecalc.h
@@ -1,25 +1,49 @@
1#ifndef BU_CACHE_CALC_H 1#ifndef BU_CACHE_CALC_H
2#define BU_CACHE_CALC_H 2#define BU_CACHE_CALC_H
3 3
4#include "bu/trace.h"
5
4namespace Bu 6namespace Bu
5{ 7{
8 template<class obtype, class keytype> class Cache;
9
6 template<class obtype, class keytype> 10 template<class obtype, class keytype>
7 class CacheCalc 11 class CacheCalc
8 { 12 {
13 friend class Cache<obtype, keytype>;
14 private:
15 typedef Cache<obtype, keytype> MyCache;
9 public: 16 public:
10 CacheCalc() 17 CacheCalc() :
18 pCache( (MyCache *)0 )
11 { 19 {
20 TRACE();
12 } 21 }
13 22
14 virtual ~CacheCalc() 23 virtual ~CacheCalc()
15 { 24 {
25 TRACE();
16 } 26 }
17 27
18 virtual void onLoad( obtype *pSrc, const keytype &key )=0; 28 virtual void onLoad( obtype *pSrc, const keytype &key )=0;
19 virtual void onUnload( obtype *pSrc, const keytype &key )=0; 29 virtual void onUnload( obtype *pSrc, const keytype &key )=0;
20 virtual void onTick() { }; 30 virtual void onTick() { };
21 31
32 protected:
33 MyCache *getCache()
34 {
35 TRACE();
36 return pCache;
37 }
38
22 private: 39 private:
40 void setCache( MyCache *pCache )
41 {
42 TRACE();
43 this->pCache = pCache;
44 }
45
46 MyCache *pCache;
23 }; 47 };
24}; 48};
25 49