event.h 418 B

123456789101112131415161718192021222324252627282930
  1. class RefCountedBase {
  2. protected:
  3. bool derefBase()
  4. {
  5. return true;
  6. }
  7. };
  8. template<typename T> class RefCounted : public RefCountedBase {
  9. public:
  10. void deref()
  11. {
  12. if (derefBase())
  13. delete static_cast<T*>(this);
  14. }
  15. protected:
  16. // RefCounted() { }
  17. ~RefCounted()
  18. {
  19. }
  20. };
  21. class Event : public RefCounted<Event> {
  22. public:
  23. Event();
  24. virtual ~Event();
  25. };