(svn r10644) -Merge (from NoAI): framework for reference counted objects (pointers).
This commit is contained in:
66
src/misc/countedobj.cpp
Normal file
66
src/misc/countedobj.cpp
Normal file
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user