ReferenceCounter.cpp 384 B

123456789101112131415161718192021222324252627
  1. #include "ReferenceCounter.h"
  2. using namespace Framework;
  3. ReferenceCounter::ReferenceCounter()
  4. {
  5. ref = 1;
  6. }
  7. ReferenceCounter::~ReferenceCounter() {}
  8. int ReferenceCounter::getReferenceCount() const
  9. {
  10. return ref;
  11. }
  12. ReferenceCounter* ReferenceCounter::getThis()
  13. {
  14. ref++;
  15. return this;
  16. }
  17. void* ReferenceCounter::release()
  18. {
  19. if (!--ref) delete this;
  20. return 0;
  21. }