Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
790 B

  1. /*
  2. * refcount.hpp - RefCount class description.
  3. *
  4. * Taken from URL code by ChrisPi 9-11-95
  5. *
  6. */
  7. #ifndef _REFCOUNT_HPP_
  8. #define _REFCOUNT_HPP_
  9. /* Types
  10. ********/
  11. // RefCount destructor callback function
  12. typedef void (*OBJECTDESTROYEDPROC)(void);
  13. /* Classes
  14. **********/
  15. class RefCount
  16. {
  17. private:
  18. ULONG m_ulcRef;
  19. OBJECTDESTROYEDPROC m_ObjectDestroyed;
  20. public:
  21. RefCount(OBJECTDESTROYEDPROC ObjectDestroyed);
  22. // Virtual destructor defers to destructor of derived class.
  23. virtual ~RefCount(void);
  24. // IUnknown methods
  25. ULONG STDMETHODCALLTYPE AddRef(void);
  26. ULONG STDMETHODCALLTYPE Release(void);
  27. // friends
  28. #ifdef DEBUG
  29. friend BOOL IsValidPCRefCount(const RefCount *pcrefcnt);
  30. #endif
  31. };
  32. DECLARE_STANDARD_TYPES(RefCount);
  33. #endif // _REFCOUNT_HPP_