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.

111 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. dbgtrace.hxx
  6. Abstract:
  7. Debug tracer routines. Tracer routines are used to
  8. display a debugging message on entry and exit of
  9. a subroutine call. Note this class relies on the
  10. debug message class. A user must use and initialize
  11. the debug messages for tracer to work.
  12. Author:
  13. Steve Kiraly (SteveKi) 7-Apr-1996
  14. Revision History:
  15. --*/
  16. #ifndef _DBGTRACE_HXX_
  17. #define _DBGTRACE_HXX_
  18. DEBUG_NS_BEGIN
  19. /********************************************************************
  20. Tracer class
  21. ********************************************************************/
  22. class TDebugTracer
  23. {
  24. public:
  25. explicit
  26. TDebugTracer::
  27. TDebugTracer(
  28. IN LPCWSTR pszMessage
  29. );
  30. explicit
  31. TDebugTracer::
  32. TDebugTracer(
  33. IN LPCSTR pszMessage
  34. );
  35. TDebugTracer::
  36. ~TDebugTracer(
  37. VOID
  38. );
  39. protected:
  40. //
  41. // Copying and assignment are not defined.
  42. //
  43. TDebugTracer::
  44. TDebugTracer(
  45. const TDebugTracer &rhs
  46. );
  47. const TDebugTracer &
  48. TDebugTracer::
  49. operator=(
  50. const TDebugTracer &rhs
  51. );
  52. private:
  53. //
  54. // Used to eliminate casts
  55. //
  56. union StringTrait
  57. {
  58. LPCWSTR pszWide; // Wide const string
  59. LPCSTR pszNarrow; // Narrow const string
  60. };
  61. StringTrait m_strMsg; // Message unicode or ansi
  62. BOOL m_bAnsi; // Message is ansi flag
  63. static UINT m_uLev; // Current nesting level
  64. };
  65. /********************************************************************
  66. Macro for declaring a tracer class.
  67. ********************************************************************/
  68. #if DBG
  69. #define DBG_TRACER( Message ) \
  70. DEBUG_NS::TDebugTracer TDebugTracerClass ( Message )
  71. #else
  72. #define DBG_TRACER( Message ) // Empty
  73. #endif
  74. DEBUG_NS_END
  75. #endif // _DBGTRACE_HXX_