00001 // Copyright (C) 2002-2018 Nikolaus Gebhardt 00002 // This file is part of the "irrKlang" library. 00003 // For conditions of distribution and use, see copyright notice in irrKlang.h 00004 00005 #ifndef __I_IRRKLANG_IREFERENCE_COUNTED_H_INCLUDED__ 00006 #define __I_IRRKLANG_IREFERENCE_COUNTED_H_INCLUDED__ 00007 00008 #include "ik_irrKlangTypes.h" 00009 00010 namespace irrklang 00011 { 00013 00041 class IRefCounted 00042 { 00043 public: 00044 00046 IRefCounted() 00047 : ReferenceCounter(1) 00048 { 00049 } 00050 00052 virtual ~IRefCounted() 00053 { 00054 } 00055 00080 void grab() { ++ReferenceCounter; } 00081 00098 bool drop() 00099 { 00100 --ReferenceCounter; 00101 00102 if (!ReferenceCounter) 00103 { 00104 delete this; 00105 return true; 00106 } 00107 00108 return false; 00109 } 00110 00111 private: 00112 00113 ik_s32 ReferenceCounter; 00114 }; 00115 00116 } // end namespace irr 00117 00118 #endif 00119
The irrKlang
Engine Documentation © 2003-2018 by Nikolaus Gebhardt. Generated
by Doxygen
(1.6.1) |