(svn r10644) -Merge (from NoAI): framework for reference counted objects (pointers).
parent
f7682403e3
commit
478e009ac6
@ -0,0 +1,66 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
#include "../stdafx.h"
|
||||||
|
|
||||||
|
#include "countedptr.hpp"
|
||||||
|
|
||||||
|
int32 SimpleCountedObject::AddRef()
|
||||||
|
{
|
||||||
|
return ++m_ref_cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 SimpleCountedObject::Release()
|
||||||
|
{
|
||||||
|
int32 res = --m_ref_cnt;
|
||||||
|
assert(res >= 0);
|
||||||
|
if (res == 0) {
|
||||||
|
FinalRelease();
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
#include "../stdafx.h"
|
||||||
|
|
||||||
|
#include "countedptr.hpp"
|
||||||
|
|
||||||
|
int32 SimpleCountedObject::AddRef()
|
||||||
|
{
|
||||||
|
return ++m_ref_cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 SimpleCountedObject::Release()
|
||||||
|
{
|
||||||
|
int32 res = --m_ref_cnt;
|
||||||
|
assert(res >= 0);
|
||||||
|
if (res == 0) {
|
||||||
|
FinalRelease();
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
#include "../stdafx.h"
|
||||||
|
|
||||||
|
#include "countedptr.hpp"
|
||||||
|
|
||||||
|
int32 SimpleCountedObject::AddRef()
|
||||||
|
{
|
||||||
|
return ++m_ref_cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 SimpleCountedObject::Release()
|
||||||
|
{
|
||||||
|
int32 res = --m_ref_cnt;
|
||||||
|
assert(res >= 0);
|
||||||
|
if (res == 0) {
|
||||||
|
FinalRelease();
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue