blob: c3556839ce966f0177b9e112f11a74394bd27645 (
plain) (
blame)
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
33
34
35
36
37
|
#pragma once
#include "cChunk.h"
class ptr_cChunk
{
public:
ptr_cChunk( cChunk* a_Ptr )
: m_Ptr( a_Ptr )
{
if( m_Ptr ) m_Ptr->AddReference();
}
ptr_cChunk( const ptr_cChunk& a_Clone )
: m_Ptr( a_Clone.m_Ptr )
{
if( m_Ptr ) m_Ptr->AddReference();
}
~ptr_cChunk()
{
if( m_Ptr ) m_Ptr->RemoveReference();
}
cChunk* operator-> ()
{
return m_Ptr;
}
cChunk& operator* () { return *m_Ptr; }
bool operator!() { return !m_Ptr; }
bool operator==( const ptr_cChunk& a_Other ) { return m_Ptr == a_Other.m_Ptr; }
operator bool() { return m_Ptr != 0; }
operator cChunk*() { return m_Ptr; }
private:
cChunk* m_Ptr;
};
|