diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2008-12-01 23:10:44 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2008-12-01 23:10:44 +0000 |
| commit | 6f3b85c5af1855e1695885fb28220c34f6a0673f (patch) | |
| tree | 07fc5d4f955bc6c58eb7ad88bcce7a8294c53158 /src/cachestore.h | |
| parent | 350b052cfd866e3b3c7c4626551b49f8b75e55a1 (diff) | |
| download | libbu++-6f3b85c5af1855e1695885fb28220c34f6a0673f.tar.gz libbu++-6f3b85c5af1855e1695885fb28220c34f6a0673f.tar.bz2 libbu++-6f3b85c5af1855e1695885fb28220c34f6a0673f.tar.xz libbu++-6f3b85c5af1855e1695885fb28220c34f6a0673f.zip | |
Wow, that's a lot of changes. You can use anything as a key now, as long as it
can be hashed. And we're about to test actually loading and saving persistant
cache items. Fun.
Diffstat (limited to 'src/cachestore.h')
| -rw-r--r-- | src/cachestore.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/cachestore.h b/src/cachestore.h new file mode 100644 index 0000000..3211b6a --- /dev/null +++ b/src/cachestore.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | #ifndef BU_CACHE_STORE_H | ||
| 2 | #define BU_CACHE_STORE_H | ||
| 3 | |||
| 4 | #include "bu/cptr.h" | ||
| 5 | |||
| 6 | namespace Bu | ||
| 7 | { | ||
| 8 | /** | ||
| 9 | * Handles I/O for data in the cache. This also assigns ID's to the newly | ||
| 10 | * created objects that are requested through this system. | ||
| 11 | */ | ||
| 12 | template<class obtype, class keytype> | ||
| 13 | class CacheStore | ||
| 14 | { | ||
| 15 | public: | ||
| 16 | CacheStore() | ||
| 17 | { | ||
| 18 | } | ||
| 19 | |||
| 20 | virtual ~CacheStore() | ||
| 21 | { | ||
| 22 | } | ||
| 23 | |||
| 24 | typedef Bu::CPtr<obtype, keytype> Ptr; | ||
| 25 | |||
| 26 | virtual obtype *load( const keytype &key )=0; | ||
| 27 | virtual void unload( obtype *pObj )=0; | ||
| 28 | virtual keytype create( obtype *pSrc )=0; | ||
| 29 | virtual void destroy( obtype *pObj, const keytype &key )=0; | ||
| 30 | |||
| 31 | private: | ||
| 32 | }; | ||
| 33 | }; | ||
| 34 | |||
| 35 | #endif | ||
