aboutsummaryrefslogtreecommitdiff
path: root/src/cachestorenids.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cachestorenids.h')
-rw-r--r--src/cachestorenids.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/cachestorenids.h b/src/cachestorenids.h
index 9288008..a5fa402 100644
--- a/src/cachestorenids.h
+++ b/src/cachestorenids.h
@@ -9,14 +9,18 @@
9 9
10#include "bu/file.h" 10#include "bu/file.h"
11 11
12static int iCnt = 0;
13
14namespace Bu 12namespace Bu
15{ 13{
16 template<class obtype, class keytype> 14 template<class obtype, class keytype>
17 keytype __cacheGetKey( const obtype *pObj ); 15 keytype __cacheGetKey( const obtype *pObj );
18 16
19 template<class obtype, class keytype> 17 template<class obtype, class keytype>
18 obtype *__cacheStoreNidsAlloc( const keytype &key )
19 {
20 return new obtype();
21 }
22
23 template<class obtype, class keytype>
20 class CacheStoreNids : public CacheStore<obtype, keytype> 24 class CacheStoreNids : public CacheStore<obtype, keytype>
21 { 25 {
22 public: 26 public:
@@ -55,7 +59,7 @@ namespace Bu
55 int iStream = hId.get( key ); 59 int iStream = hId.get( key );
56 NidsStream ns = nStore.openStream( iStream ); 60 NidsStream ns = nStore.openStream( iStream );
57 Bu::Archive ar( ns, Bu::Archive::load ); 61 Bu::Archive ar( ns, Bu::Archive::load );
58 obtype *pOb = new obtype(); 62 obtype *pOb = __cacheStoreNidsAlloc<obtype, keytype>( key );
59 ar >> (*pOb); 63 ar >> (*pOb);
60 return pOb; 64 return pOb;
61 } 65 }
@@ -76,8 +80,7 @@ namespace Bu
76 hId.insert( key, iStream ); 80 hId.insert( key, iStream );
77 NidsStream ns = nStore.openStream( iStream ); 81 NidsStream ns = nStore.openStream( iStream );
78 Bu::Archive ar( ns, Bu::Archive::save ); 82 Bu::Archive ar( ns, Bu::Archive::save );
79 obtype *pOb = new obtype(); 83 ar << (*pSrc);
80 ar << (*pOb);
81 return key; 84 return key;
82 } 85 }
83 86