diff options
author | Mike Buland <eichlan@xagasoft.com> | 2008-12-20 02:01:44 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2008-12-20 02:01:44 +0000 |
commit | b7a687b08e32adafbb609bec7aa79b54f161ee4c (patch) | |
tree | 9c0214eb7fa5c69619bb4226cb292d19445b92df /src/cachecalc.h | |
parent | 5db154c3fb36a677c551e39c3c6661207eb51778 (diff) | |
download | libbu++-b7a687b08e32adafbb609bec7aa79b54f161ee4c.tar.gz libbu++-b7a687b08e32adafbb609bec7aa79b54f161ee4c.tar.bz2 libbu++-b7a687b08e32adafbb609bec7aa79b54f161ee4c.tar.xz libbu++-b7a687b08e32adafbb609bec7aa79b54f161ee4c.zip |
All of the basic, core workings of the Cache are complete, and tested. Even
added some more tests and whatnot. A lot happened, but I can't remember
everything.
Also, Bu::File reports errors in more error cases.
Diffstat (limited to 'src/cachecalc.h')
-rw-r--r-- | src/cachecalc.h | 26 |
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 | |||
4 | namespace Bu | 6 | namespace 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 | ||