#include <Trace.h>
Public Member Functions | |
| ACE_Trace (const ACE_TCHAR *n, int line=0, const ACE_TCHAR *file=ACE_TEXT("")) | |
| ~ACE_Trace (void) | |
| void | dump (void) const | 
| Dump the state of an object.   | |
Static Public Member Functions | |
| int | is_tracing (void) | 
| Determine if tracing is enabled (return == 1) or not (== 0).   | |
| void | start_tracing (void) | 
| Enable the tracing facility.   | |
| void | stop_tracing (void) | 
| Disable the tracing facility.   | |
| void | set_nesting_indent (int indent) | 
| Change the nesting indentation level.   | |
| int | get_nesting_indent (void) | 
| Get the nesting indentation level.   | |
Private Types | |
| enum | { DEFAULT_INDENT = 3, DEFAULT_TRACING = 1 } | 
| Default values.  More... | |
Private Attributes | |
| const ACE_TCHAR * | name_ | 
| Name of the method we are in.   | |
Static Private Attributes | |
| int | nesting_indent_ | 
| Keeps track of how far to indent per trace call.   | |
| int | enable_tracing_ | 
| Is tracing enabled?   | |
This class uses C++ constructors and destructors to automate the ACE_Trace nesting. In addition, thread-specific storage is used to enable multiple threads to work correctly.
Definition at line 36 of file Trace.h.
      
  | 
  
| 
 Default values. 
 Definition at line 85 of file Trace.h. 
 00086   {
00087     DEFAULT_INDENT  = 3,
00088     DEFAULT_TRACING = 1
00089   };
 | 
  
      
  | 
  ||||||||||||||||
| 
 Perform the first part of the trace, which prints out the string N, the LINE, and the ACE_FILE as the function is entered. Definition at line 81 of file Trace.cpp. References ACE_DEBUG, ACE_LOG_MSG, ACE_TCHAR, ACE_TEXT, enable_tracing_, ACE_Log_Msg::inc(), LM_TRACE, nesting_indent_, ACE_OS_Object_Manager::starting_up(), ACE_Log_Msg::trace_active(), and ACE_Log_Msg::tracing_enabled(). 
 00084 {
00085 #if defined (ACE_NLOGGING)
00086   ACE_UNUSED_ARG (line);
00087   ACE_UNUSED_ARG (file);
00088 #endif /* ACE_NLOGGING */
00089 
00090   this->name_ = n;
00091 
00092   // If ACE has not yet been initialized, don't try to trace... there's
00093   // too much stuff not yet initialized.
00094   if (ACE_Trace::enable_tracing_ && !ACE_OS_Object_Manager::starting_up ())
00095     {
00096       ACE_Log_Msg *lm = ACE_LOG_MSG;
00097       if (lm->tracing_enabled ()
00098           && lm->trace_active () == 0)
00099         {
00100           lm->trace_active (1);
00101           ACE_DEBUG ((LM_TRACE,
00102                       ACE_TEXT ("%*s(%t) calling %s in file `%s' on line %d\n"),
00103                       ACE_Trace::nesting_indent_ * lm->inc (),
00104                       ACE_TEXT (""),
00105                       this->name_,
00106                       file,
00107                       line));
00108           lm->trace_active (0);
00109         }
00110     }
00111 }
 | 
  
      
  | 
  
| 
 Perform the second part of the trace, which prints out the NAME as the function is exited. Definition at line 116 of file Trace.cpp. References ACE_DEBUG, ACE_LOG_MSG, ACE_TEXT, ACE_Log_Msg::dec(), enable_tracing_, LM_TRACE, nesting_indent_, ACE_OS_Object_Manager::starting_up(), ACE_Log_Msg::trace_active(), and ACE_Log_Msg::tracing_enabled(). 
 00117 {
00118   // If ACE has not yet been initialized, don't try to trace... there's
00119   // too much stuff not yet initialized.
00120   if (ACE_Trace::enable_tracing_ && !ACE_OS_Object_Manager::starting_up ())
00121     {
00122       ACE_Log_Msg *lm = ACE_LOG_MSG;
00123       if (lm->tracing_enabled ()
00124           && lm->trace_active () == 0)
00125         {
00126           lm->trace_active (1);
00127           ACE_DEBUG ((LM_TRACE,
00128                       ACE_TEXT ("%*s(%t) leaving %s\n"),
00129                       ACE_Trace::nesting_indent_ * lm->dec (),
00130                       ACE_TEXT (""),
00131                       this->name_));
00132           lm->trace_active (0);
00133         }
00134     }
00135 }
 | 
  
      
  | 
  
| 
 Dump the state of an object. 
 Definition at line 32 of file Trace.cpp. 
 00033 {
00034 #if defined (ACE_HAS_DUMP)
00035 #endif /* ACE_HAS_DUMP */
00036 }
 | 
  
      
  | 
  
| 
 Get the nesting indentation level. 
 Definition at line 73 of file Trace.cpp. References nesting_indent_. Referenced by ACE_Log_Msg::log(). 
 00074 {
00075   return ACE_Trace::nesting_indent_;
00076 }
 | 
  
      
  | 
  
| 
 Determine if tracing is enabled (return == 1) or not (== 0). 
 Definition at line 41 of file Trace.cpp. References enable_tracing_. 
 00042 {
00043   return ACE_Trace::enable_tracing_;
00044 }
 | 
  
      
  | 
  
| 
 Change the nesting indentation level. 
 Definition at line 65 of file Trace.cpp. References nesting_indent_. 
 00066 {
00067   ACE_Trace::nesting_indent_ = indent;
00068 }
 | 
  
      
  | 
  
| 
 Enable the tracing facility. 
 Definition at line 49 of file Trace.cpp. References enable_tracing_. Referenced by ACE_Object_Manager::init(), and ACE_Name_Options::parse_args(). 
 00050 {
00051   ACE_Trace::enable_tracing_ = 1;
00052 }
 | 
  
      
  | 
  
| 
 Disable the tracing facility. 
 Definition at line 57 of file Trace.cpp. References enable_tracing_. Referenced by ACE_Object_Manager::fini(), and ACE_Name_Options::parse_args(). 
 00058 {
00059   ACE_Trace::enable_tracing_ = 0;
00060 }
 | 
  
      
  | 
  
| 
 Is tracing enabled? 
 Definition at line 82 of file Trace.h. Referenced by ACE_Trace(), is_tracing(), start_tracing(), stop_tracing(), and ~ACE_Trace().  | 
  
      
  | 
  
| 
 Name of the method we are in. 
  | 
  
      
  | 
  
| 
 Keeps track of how far to indent per trace call. 
 Definition at line 79 of file Trace.h. Referenced by ACE_Trace(), get_nesting_indent(), set_nesting_indent(), and ~ACE_Trace().  | 
  
 
1.3.6