daeRefCountedObj.h 993 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #ifndef daeRefCountedObj_h
  9. #define daeRefCountedObj_h
  10. #include <dae/daeTypes.h>
  11. #include <dae/daePlatform.h>
  12. class DLLSPEC daeRefCountedObj {
  13. protected:
  14. mutable daeInt _refCount;
  15. public:
  16. daeRefCountedObj();
  17. virtual ~daeRefCountedObj();
  18. /**
  19. * Decrements the reference count and deletes the object if reference count is zero.
  20. * @note Should not be used externally if daeSmartRefs are being used, they call it
  21. * automatically.
  22. */
  23. void release() const;
  24. /**
  25. * Increments the reference count of this element.
  26. * @note Should not be used externally if daeSmartRefs are being used, they call it
  27. * automatically.
  28. */
  29. void ref() const;
  30. };
  31. void DLLSPEC checkedRelease(const daeRefCountedObj* obj);
  32. void DLLSPEC checkedRef(const daeRefCountedObj* obj);
  33. #endif