3 //=============================================================================
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
9 //=============================================================================
14 #include /**/ "ace/pre.h"
16 #include /**/ "ace/ACE_export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
27 * @brief A C++ trace facility that keeps track of which methods are
30 * This class uses C++ constructors and destructors to automate
31 * the ACE_Trace nesting. In addition, thread-specific storage
32 * is used to enable multiple threads to work correctly.
34 class ACE_Export ACE_Trace
37 /// Perform the first part of the trace, which prints out the string
38 /// N, the LINE, and the ACE_FILE as the function is entered.
39 ACE_Trace (const ACE_TCHAR
*n
,
41 const ACE_TCHAR
*file
= ACE_TEXT (""));
43 /// Perform the second part of the trace, which prints out the NAME
44 /// as the function is exited.
47 /// Declare the dynamic allocation hooks.
48 ACE_ALLOC_HOOK_DECLARE
;
50 // = Control the tracing level.
51 /// Determine if tracing is enabled or not
52 static bool is_tracing(void);
54 /// Enable the tracing facility.
55 static void start_tracing (void);
57 /// Disable the tracing facility.
58 static void stop_tracing (void);
60 /// Change the nesting indentation level.
61 static void set_nesting_indent (int indent
);
63 /// Get the nesting indentation level.
64 static int get_nesting_indent (void);
66 /// Dump the state of an object.
67 void dump (void) const;
70 // Keeps track of how deeply the call stack is nested (this is
71 // maintained in thread-specific storage to ensure correctness in
72 // multiple threads of control.
74 /// Name of the method we are in.
75 const ACE_TCHAR
*name_
;
77 /// Keeps track of how far to indent per trace call.
78 static int nesting_indent_
;
80 /// Is tracing enabled?
81 static bool enable_tracing_
;
91 ACE_END_VERSIONED_NAMESPACE_DECL
93 #include /**/ "ace/post.h"
95 #endif /* ACE_TRACE_H */