www.pudn.com > zfxcengine-0.1.0.zip > ceRefCount.cpp


// $Id: ceRefCount.cpp,v 1.6 2005/09/03 14:24:14 kimmi Exp $ 
///////////////////////////////////////////////////////////////// 
// 
//  Module:     Core 
//  File:       ceRefCount.cpp 
//  Created:    11.12.2004 
//  Author:     Kim Kulling aka kimmi 
// 
///////////////////////////////////////////////////////////////// 
#include "Core/ceDebug.h" 
#include "Core/ceRefCount.h" 
#include "Core/ceMemManager.h" 
#include  
 
namespace ZFXCE { 
	using namespace std; 
	//////////////////////////////////////////////////////////////////////////////// 
	ceRefCount::ceRefCount() 
	{ 
		Init(); 
	} 
	//////////////////////////////////////////////////////////////////////////////// 
	ceRefCount::~ceRefCount() 
	{ 
		Release(); 
		ce_assert (0 == m_uiReferences); 
	} 
	//////////////////////////////////////////////////////////////////////////////// 
	void ceRefCount::Init() 
	{ 
		m_uiReferences = 0; 
	} 
	//////////////////////////////////////////////////////////////////////////////// 
	void ceRefCount::Release() 
	{ 
		// empty 
	} 
	//////////////////////////////////////////////////////////////////////////////// 
	void ceRefCount::Clear() 
	{ 
		Release(); 
		Init(); 
	} 
	//////////////////////////////////////////////////////////////////////////////// 
	void ceRefCount::IncRef() 
	{ 
		++m_uiReferences; 
	} 
	//////////////////////////////////////////////////////////////////////////////// 
	void ceRefCount::DecRef() 
	{ 
		if (m_uiReferences > 0)  
			--m_uiReferences; 
	} 
	//////////////////////////////////////////////////////////////////////////////// 
	UINT ceRefCount::GetRefs() const 
	{ 
		return m_uiReferences; 
	} 
	//////////////////////////////////////////////////////////////////////////////// 
	ceRefCount &ceRefCount::operator = (const ceRefCount &Inst) 
	{ 
		IncRef(); 
		return *this; 
	} 
	//////////////////////////////////////////////////////////////////////////////// 
} // Namspace ZFXCE