From 4808617ef54d40efcf1a3ed30525898defb74e10 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 9 Oct 2008 20:20:34 +0000 Subject: More cache development. I'm going to have to switch from template functions to functors. I like template functions a little more, but functors can be at least as fast. It won't be much of a change. --- src/cptr.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/cptr.h') 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 @@ #ifndef BU_C_PTR_H #define BU_C_PTR_H -#include "bu/cache.h" - namespace Bu { + template class Cache; + template class CPtr { friend class Bu::Cache; private: - CPtr( Cache &rCache, obtype &rData ) + CPtr( Cache &rCache, obtype *pData ) : + rCache( rCache ), + pData( pData ) { + rCache.incRef( pData ); } public: virtual ~CPtr() { + rCache.decRef( pData ); } + + private: + Bu::Cache &rCache; + obtype *pData; }; }; -- cgit v1.2.3