home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / YellowBox / Kits / MiscTableScroll-138.1 / Palettes / MiscTableScroll / Framework / MiscTracer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-31  |  1.9 KB  |  66 lines

  1. #ifndef __MiscTracer_h
  2. #define __MiscTracer_h
  3. #ifdef __GNUC__
  4. #pragma interface
  5. #endif
  6. //=============================================================================
  7. //
  8. //    Copyright (C) 1997,1998 by Paul S. McCarthy and Eric Sunshine.
  9. //        Written by Paul S. McCarthy and Eric Sunshine.
  10. //                All Rights Reserved.
  11. //
  12. //    This notice may not be removed from this source code.
  13. //
  14. //    This object is included in the MiscKit by permission from the authors
  15. //    and its use is governed by the MiscKit license, found in the file
  16. //    "License.rtf" in the MiscKit distribution.  Please refer to that file
  17. //    for a list of all applicable permissions and restrictions.
  18. //    
  19. //=============================================================================
  20. //-----------------------------------------------------------------------------
  21. // MiscTracer.h
  22. //
  23. //    Simple C++ class that helps generate function enter/exit
  24. //    trace messages.
  25. //
  26. //-----------------------------------------------------------------------------
  27. //-----------------------------------------------------------------------------
  28. // $Id: MiscTracer.h,v 1.2 98/03/23 07:48:27 sunshine Exp $
  29. // $Log:    MiscTracer.h,v $
  30. //  Revision 1.2  98/03/23  07:48:27  sunshine
  31. //  v134.1: Ported from NEXTSTEP to OPENSTEP/Rhapsody.
  32. //  
  33. //  Revision 1.1  97/12/22  22:00:23  zarnuk
  34. //  v134: Utility class to create function enter/exit messages.
  35. //-----------------------------------------------------------------------------
  36.  
  37. class MiscTracer
  38.     {
  39. private:
  40. static    int TRACE_DEPTH;
  41.     char const* msg;
  42.     void dump( char const* ) const;
  43. public:
  44.     MiscTracer( char const* s ): msg(s)
  45.         {
  46.         dump( "->" );
  47.         TRACE_DEPTH += 2;
  48.         }
  49.     ~MiscTracer()
  50.         {
  51.         TRACE_DEPTH -= 2;
  52.         dump( "<-" );
  53.         }
  54.     void foo() const {}    // compiler muffler
  55. static    int get_depth()        { return TRACE_DEPTH; }
  56.     };
  57.  
  58.  
  59. #ifdef TRACE_ON
  60. #define    TRACE(X)    MiscTracer mcgh_tracer(X); mcgh_tracer.foo();
  61. #else
  62. #define    TRACE(X)
  63. #endif
  64.  
  65. #endif // __MiscTracer_h
  66.