True Axis Physics SDK 1.2.0.1 Beta Documentation
www.trueaxis.com

RefCount.h

00001 //---------------------------------------------------------------------------------
00002 // File Name: RefCount.h
00003 // Description: Reference count object base class
00004 //
00005 // Copyright (C) 2004 - 2006 True Axis Pty Ltd, Australia. 
00006 // All Rights Reserved.
00007 //
00008 // History:
00009 //      Created File.
00010 //---------------------------------------------------------------------------------
00011 
00012 #ifndef TA_REFCOUNT_H
00013 #define TA_REFCOUNT_H
00014 
00015 #ifndef TA_DEBUG_H
00016 #include "Debug.h"
00017 #endif // TA_DEBUG_H
00018 
00019 #ifndef TA_MEMORYMGR_H
00020 #include "MemoryMgr.h"
00021 #endif // TA_MEMORYMGR_H
00022 
00023 TA_OBFUSCATION_SKIP_PASS_2
00024 
00025 namespace TA
00026 {
00027 
00028 class TACOMMON_CLASS RefCount
00029 {
00030 public:
00031 TA_OBFUSCATION_RESERVED_ON
00032     RefCount();
00033     virtual ~RefCount();
00034 
00035     void AddRef() const;
00036     void Release() const;
00037 
00038     int GetRefCount() const;
00039 TA_OBFUSCATION_RESERVED_OFF
00040 
00041 private:
00042     mutable int m_nRefCount;
00043 };
00044 
00045 inline RefCount::RefCount() { m_nRefCount = 1; }
00046 inline RefCount::~RefCount() { TA_ASSERT_MSG(m_nRefCount == 0, "RefCount::~RefCount. The reference count is non zero"); }
00047 inline void RefCount::AddRef() const { m_nRefCount++; }
00048 inline int RefCount::GetRefCount() const { return m_nRefCount; }
00049 
00050 };
00051 
00052 #endif // TA_REFCOUNT_H


© Copyright 2004-2006 TRUE AXIS PTY LTD Australia. All rights reserved.