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.

82 lines
1.5 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. object.h
  5. Abstract:
  6. Abstruct object for refrence count and list entry: declaration
  7. Author:
  8. Erez Haba (erezh) 17-Apr-96
  9. Revision History:
  10. --*/
  11. #ifndef __OBJECT_H
  12. #define __OBJECT_H
  13. //---------------------------------------------------------
  14. //
  15. // Class debugging macros
  16. //
  17. //---------------------------------------------------------
  18. #ifdef _DEBUG
  19. #define DEFINE_G_TYPE(c) int c::g_type = 0
  20. #define STATIC_G_TYPE static int g_type
  21. #define STATIC_PVOID_TYPE() static PVOID Type() { return &g_type; }
  22. #define VIRTUAL_BOOL_ISKINDOF()\
  23. virtual BOOL isKindOf(PVOID pType) const\
  24. { return ((Type() == pType) || Inherited::isKindOf(pType)); }
  25. #define CLASS_DEBUG_TYPE()\
  26. public: STATIC_PVOID_TYPE(); VIRTUAL_BOOL_ISKINDOF();\
  27. private: STATIC_G_TYPE;
  28. #define BASE_VIRTUAL_BOOL_ISKINDOF()\
  29. virtual BOOL isKindOf(PVOID) const { return FALSE; }
  30. #define BASE_CLASS_DEBUG_TYPE()\
  31. public: BASE_VIRTUAL_BOOL_ISKINDOF();
  32. #else // _DEBUG
  33. #define DEFINE_G_TYPE(c)
  34. #define CLASS_DEBUG_TYPE()
  35. #define BASE_CLASS_DEBUG_TYPE()
  36. #endif // _DEBUG
  37. //---------------------------------------------------------
  38. //
  39. // class CObject
  40. //
  41. //---------------------------------------------------------
  42. class CObject {
  43. public:
  44. CObject();
  45. virtual ~CObject() = 0;
  46. ULONG Ref() const;
  47. ULONG AddRef();
  48. ULONG Release();
  49. public:
  50. LIST_ENTRY m_link;
  51. ULONG m_ref;
  52. BASE_CLASS_DEBUG_TYPE();
  53. };
  54. #endif // __OBJECT_H