mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
521 B
31 lines
521 B
#ifndef _REFERENC_H_
|
|
#define _REFERENC_H_
|
|
|
|
class REFCOUNT
|
|
{
|
|
public:
|
|
REFCOUNT();
|
|
virtual ~REFCOUNT();
|
|
DWORD AddRef();
|
|
DWORD Release();
|
|
DWORD Delete();
|
|
void OnStack() {bOnStack = TRUE;};
|
|
private:
|
|
DWORD NumRefs;
|
|
|
|
// Give 2 bits since BOOL is signed
|
|
BOOL bMarkedForDelete : 2;
|
|
BOOL bOnStack : 2;
|
|
};
|
|
|
|
class REFERENCE
|
|
{
|
|
public:
|
|
REFERENCE(REFCOUNT * _pRefCount) : pRefCount(_pRefCount) {pRefCount->AddRef();};
|
|
~REFERENCE() {pRefCount->Release();};
|
|
|
|
private:
|
|
REFCOUNT * pRefCount;
|
|
};
|
|
|
|
#endif // ! _REFERENC_H_
|