2
0

daeRefCountedObj.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright 2006 Sony Computer Entertainment Inc.
  3. *
  4. * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this
  5. * file except in compliance with the License. You may obtain a copy of the License at:
  6. * http://research.scea.com/scea_shared_source_license.html
  7. *
  8. * Unless required by applicable law or agreed to in writing, software distributed under the License
  9. * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  10. * implied. See the License for the specific language governing permissions and limitations under the
  11. * License.
  12. */
  13. #ifndef daeRefCountedObj_h
  14. #define daeRefCountedObj_h
  15. #include <dae/daeTypes.h>
  16. #include <dae/daePlatform.h>
  17. class DLLSPEC daeRefCountedObj {
  18. protected:
  19. mutable daeInt _refCount;
  20. public:
  21. daeRefCountedObj();
  22. virtual ~daeRefCountedObj();
  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. * Increments the reference count of this element.
  31. * @note Should not be used externally if daeSmartRefs are being used, they call it
  32. * automatically.
  33. */
  34. void ref() const;
  35. };
  36. void DLLSPEC checkedRelease(const daeRefCountedObj* obj);
  37. void DLLSPEC checkedRef(const daeRefCountedObj* obj);
  38. #endif