src/misc/countedobj.cpp
author rubidium
Tue, 28 Oct 2008 15:47:42 +0000
changeset 10300 e336f1784ba4
parent 9111 48ce04029fe4
permissions -rw-r--r--
(svn r14541) -Fix (r14540): mingw didn't like it :(
/* $Id$ */

/** @file countedobj.cpp Support for reference counted objects. */

#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;
}