00001 /* $Id: countedobj.cpp 10645 2007-07-21 12:39:46Z KUDr $ */ 00002 00003 #include "../stdafx.h" 00004 00005 #include "countedptr.hpp" 00006 00007 int32 SimpleCountedObject::AddRef() 00008 { 00009 return ++m_ref_cnt; 00010 } 00011 00012 int32 SimpleCountedObject::Release() 00013 { 00014 int32 res = --m_ref_cnt; 00015 assert(res >= 0); 00016 if (res == 0) { 00017 FinalRelease(); 00018 delete this; 00019 } 00020 return res; 00021 }