From d96fe229e79f9b1947cbd24ff52d6bf7bb9bf80d Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 5 Jan 2009 15:58:22 +0000 Subject: I mergered Bu::CPtr into Bu::Cache as Bu::Cache::Ptr. This makes more sense to me, is much less messy, and makes the syntax work a little better for me as well. What the hell was a CPtr? Who knows, but a Cache::Ptr, that makes sense. Also, fewer includes to deal with now, just need Cache and you're set. Oh, also, made Cache::Ptr behave much more like a regular pointer, they can be assigned now, as well as created empty (NULL). --- src/cptr.h | 55 ------------------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 src/cptr.h (limited to 'src/cptr.h') diff --git a/src/cptr.h b/src/cptr.h deleted file mode 100644 index 97f5e17..0000000 --- a/src/cptr.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef BU_C_PTR_H -#define BU_C_PTR_H - -namespace Bu -{ - template class Cache; - - /** - * Cache Pointer - Provides access to data that is held within the cache. - * This provides safe, refcounting access to data stored in the cache, with - * support for lazy loading. - */ - template - class CPtr - { - friend class Bu::Cache; - private: - CPtr( Cache &rCache, obtype *pData, - const keytype &kId ) : - rCache( rCache ), - pData( pData ), - kId( kId ) - { - rCache.incRef( kId ); - } - - public: - virtual ~CPtr() - { - rCache.decRef( kId ); - } - - obtype &operator*() - { - return *pData; - } - - obtype *operator->() - { - return pData; - } - - const keytype &getKey() - { - return kId; - } - - private: - Bu::Cache &rCache; - obtype *pData; - keytype kId; - }; -}; - -#endif -- cgit v1.2.3