aboutsummaryrefslogtreecommitdiff
path: root/src/cachestorenids.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/cachestorenids.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/cachestorenids.h b/src/cachestorenids.h
index ae2b9a2..0d104cf 100644
--- a/src/cachestorenids.h
+++ b/src/cachestorenids.h
@@ -19,16 +19,16 @@
19 19
20namespace Bu 20namespace Bu
21{ 21{
22 template<class obtype, class keytype> 22 template<class keytype, class obtype>
23 keytype __cacheGetKey( const obtype *pObj ); 23 keytype __cacheGetKey( const obtype *pObj );
24 24
25 template<class obtype, class keytype> 25 template<class keytype, class obtype>
26 obtype *__cacheStoreNidsAlloc( const keytype &key ) 26 obtype *__cacheStoreNidsAlloc( const keytype &key )
27 { 27 {
28 return new obtype(); 28 return new obtype();
29 } 29 }
30 30
31 template<class obtype, class keytype> 31 template<class keytype, class obtype>
32 void __cacheStoreNidsStore( Bu::Stream &s, obtype &rObj, 32 void __cacheStoreNidsStore( Bu::Stream &s, obtype &rObj,
33 const keytype & ) 33 const keytype & )
34 { 34 {
@@ -36,17 +36,17 @@ namespace Bu
36 ar << rObj; 36 ar << rObj;
37 } 37 }
38 38
39 template<class obtype, class keytype> 39 template<class keytype, class obtype>
40 obtype *__cacheStoreNidsLoad( Bu::Stream &s, const keytype &key ) 40 obtype *__cacheStoreNidsLoad( Bu::Stream &s, const keytype &key )
41 { 41 {
42 obtype *pObj = __cacheStoreNidsAlloc<obtype, keytype>( key ); 42 obtype *pObj = __cacheStoreNidsAlloc<keytype, obtype>( key );
43 Bu::Archive ar( s, Bu::Archive::load ); 43 Bu::Archive ar( s, Bu::Archive::load );
44 ar >> (*pObj); 44 ar >> (*pObj);
45 return pObj; 45 return pObj;
46 } 46 }
47 47
48 template<class obtype, class keytype> 48 template<class keytype, class obtype>
49 class CacheStoreNids : public CacheStore<obtype, keytype> 49 class CacheStoreNids : public CacheStore<keytype, obtype>
50 { 50 {
51 public: 51 public:
52 CacheStoreNids( Bu::Stream &sArch, 52 CacheStoreNids( Bu::Stream &sArch,
@@ -83,7 +83,7 @@ namespace Bu
83 { 83 {
84 int iStream = hId.get( key ); 84 int iStream = hId.get( key );
85 NidsStream ns = nStore.openStream( iStream ); 85 NidsStream ns = nStore.openStream( iStream );
86 obtype *pOb = __cacheStoreNidsLoad<obtype, keytype>( ns, key ); 86 obtype *pOb = __cacheStoreNidsLoad<keytype, obtype>( ns, key );
87 return pOb; 87 return pOb;
88 } 88 }
89 89
@@ -91,17 +91,17 @@ namespace Bu
91 { 91 {
92 int iStream = hId.get( key ); 92 int iStream = hId.get( key );
93 NidsStream ns = nStore.openStream( iStream ); 93 NidsStream ns = nStore.openStream( iStream );
94 __cacheStoreNidsStore<obtype, keytype>( ns, *pObj, key ); 94 __cacheStoreNidsStore<keytype, obtype>( ns, *pObj, key );
95 delete pObj; 95 delete pObj;
96 } 96 }
97 97
98 virtual keytype create( obtype *pSrc ) 98 virtual keytype create( obtype *pSrc )
99 { 99 {
100 keytype key = __cacheGetKey<obtype,keytype>( pSrc ); 100 keytype key = __cacheGetKey<keytype, obtype>( pSrc );
101 int iStream = nStore.createStream(); 101 int iStream = nStore.createStream();
102 hId.insert( key, iStream ); 102 hId.insert( key, iStream );
103 NidsStream ns = nStore.openStream( iStream ); 103 NidsStream ns = nStore.openStream( iStream );
104 __cacheStoreNidsStore<obtype, keytype>( ns, *pSrc, key ); 104 __cacheStoreNidsStore<keytype, obtype>( ns, *pSrc, key );
105 return key; 105 return key;
106 } 106 }
107 107
@@ -118,7 +118,7 @@ namespace Bu
118 { 118 {
119 int iStream = hId.get( key ); 119 int iStream = hId.get( key );
120 NidsStream ns = nStore.openStream( iStream ); 120 NidsStream ns = nStore.openStream( iStream );
121 __cacheStoreNidsStore<obtype, keytype>( ns, *pSrc, key ); 121 __cacheStoreNidsStore<keytype, obtype>( ns, *pSrc, key );
122 } 122 }
123 123
124 virtual void destroy( obtype *pObj, const keytype &key ) 124 virtual void destroy( obtype *pObj, const keytype &key )