aboutsummaryrefslogtreecommitdiff
path: root/src/cptr.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/cptr.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/cptr.h b/src/cptr.h
index 1f8c43d..138ace8 100644
--- a/src/cptr.h
+++ b/src/cptr.h
@@ -1,23 +1,31 @@
1#ifndef BU_C_PTR_H 1#ifndef BU_C_PTR_H
2#define BU_C_PTR_H 2#define BU_C_PTR_H
3 3
4#include "bu/cache.h"
5
6namespace Bu 4namespace Bu
7{ 5{
6 template<class obtype> class Cache;
7
8 template<class obtype> 8 template<class obtype>
9 class CPtr 9 class CPtr
10 { 10 {
11 friend class Bu::Cache<obtype>; 11 friend class Bu::Cache<obtype>;
12 private: 12 private:
13 CPtr( Cache<obtype> &rCache, obtype &rData ) 13 CPtr( Cache<obtype> &rCache, obtype *pData ) :
14 rCache( rCache ),
15 pData( pData )
14 { 16 {
17 rCache.incRef( pData );
15 } 18 }
16 19
17 public: 20 public:
18 virtual ~CPtr() 21 virtual ~CPtr()
19 { 22 {
23 rCache.decRef( pData );
20 } 24 }
25
26 private:
27 Bu::Cache<obtype> &rCache;
28 obtype *pData;
21 }; 29 };
22}; 30};
23 31