summaryrefslogtreecommitdiff
path: root/src/cptr.h
blob: 138ace853f38cd8908f53f02f52d8795bf340280 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef BU_C_PTR_H
#define BU_C_PTR_H

namespace Bu
{
	template<class obtype> class Cache;

	template<class obtype>
	class CPtr
	{
	friend class Bu::Cache<obtype>;
	private:
		CPtr( Cache<obtype> &rCache, obtype *pData ) :
			rCache( rCache ),
			pData( pData )
		{
			rCache.incRef( pData );
		}

	public:
		virtual ~CPtr()
		{
			rCache.decRef( pData );
		}

	private:
		Bu::Cache<obtype> &rCache;
		obtype *pData;
	};
};

#endif