1 /* 2 * Copyright 2006 Sony Computer Entertainment Inc. 3 * 4 * Licensed under the MIT Open Source License, for details please see license.txt or the website 5 * http://www.opensource.org/licenses/mit-license.php 6 * 7 */ 8 9 #ifndef daeRefCountedObj_h 10 #define daeRefCountedObj_h 11 12 #include <dae/daeTypes.h> 13 #include <dae/daePlatform.h> 14 15 class DLLSPEC daeRefCountedObj { 16 protected: 17 mutable daeInt _refCount; 18 19 public: 20 daeRefCountedObj(); 21 virtual ~daeRefCountedObj(); 22 23 /** 24 * Decrements the reference count and deletes the object if reference count is zero. 25 * @note Should not be used externally if daeSmartRefs are being used, they call it 26 * automatically. 27 */ 28 void release() const; 29 30 /** 31 * Increments the reference count of this element. 32 * @note Should not be used externally if daeSmartRefs are being used, they call it 33 * automatically. 34 */ 35 void ref() const; 36 }; 37 38 void DLLSPEC checkedRelease(const daeRefCountedObj* obj); 39 void DLLSPEC checkedRef(const daeRefCountedObj* obj); 40 41 #endif 42