ReferenceCounter.cpp 325 B

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