00001 /* $Id: countedobj.cpp 15060 2009-01-13 15:44:36Z smatz $ */ 00002 00005 #include "../stdafx.h" 00006 00007 #include "countedptr.hpp" 00008 00009 int32 SimpleCountedObject::AddRef() 00010 { 00011 return ++m_ref_cnt; 00012 } 00013 00014 int32 SimpleCountedObject::Release() 00015 { 00016 int32 res = --m_ref_cnt; 00017 assert(res >= 0); 00018 if (res == 0) { 00019 FinalRelease(); 00020 delete this; 00021 } 00022 return res; 00023 }