Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

psTrace.h

Go to the documentation of this file.
00001 /** @file psTrace.h
00002  *  \brief basic run-time trace facilities
00003  *  \ingroup LogTrace
00004  *
00005  *  This file will hold the prototypes for defining procedures to insert
00006  *  trace messages into the code.
00007  *
00008  *  @author Robert Lupton, Princeton University
00009  *  @author GLG, MHPCC
00010  *
00011  *  @version $Revision: 1.31 $ $Name: rel5_0 $
00012  *  @date $Date: 2005/02/17 19:26:24 $
00013  *
00014  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00015  */
00016 #if !defined(PS_TRACE_H)
00017 #define PS_TRACE_H 1
00018 
00019 #define PS_UNKNOWN_TRACE_LEVEL -9999   // we don't know this name's level
00020 #define PS_DEFAULT_TRACE_LEVEL -1
00021 #define PS_THE_OTHER_DEFAULT_TRACE_LEVEL 0
00022 
00023 /** \addtogroup LogTrace
00024  *  \{
00025  */
00026 
00027 /** Functions **************************************************************/
00028 
00029 //#define PS_NO_TRACE 1   ///< to turn off all tracing
00030 
00031 #if defined(PS_NO_TRACE)
00032 #        define psTrace(facil, level, ...) (void)0
00033 /* do nothing */
00034 #        define p_psTrace(facil, level, ...)  (void)0
00035 /* do nothing */
00036 #        define psTraceSetLevel(facil,level) 0
00037 #        define psTraceGetLevel(facil) 0
00038 #        define psTraceReset() (void)0     /* do nothing */
00039 #        define psTraceFree() (void)0      /* do nothing */
00040 #        define psTracePrintLevels() (void)0
00041 /* do nothing */
00042 #        define psTraceSetDestination(fp) (void)0
00043 /* do nothing */
00044 #    else
00045 
00046     /** Basic structure for the component tree.  A component is a string of the
00047         form aaa.bbb.ccc, and may itself contain further subcomponents.  The
00048         Component structure doesn't in fact contain it's full name, but only the
00049         last part. */
00050     typedef struct p_psComponent
00051     {
00052         const char *name;           // last part of name of component
00053         psS32 level;                  // trace level for this component
00054         bool p_psSpecified;
00055         psS32 n;                      // number of subcomponents
00056         struct p_psComponent* *subcomp;     // next level of subcomponents
00057     }
00058 p_psComponent;
00059 
00060 #ifdef DOXYGEN
00061 void psTrace(const char *facil,        ///< facilty of interest
00062              psS32 myLevel,            ///< desired trace level
00063              ...)                      ///< trace message arguments
00064 ;
00065 #else
00066 /// Send a trace message
00067 void p_psTrace(const char *facil,      ///< facilty of interest
00068                psS32 myLevel,          ///< desired trace level
00069                ...)                    ///< trace message arguments
00070 ;
00071 
00072 #ifndef SWIG
00073 #define psTrace(facil, level, ...) p_psTrace(facil, level, __VA_ARGS__)
00074 #endif
00075 
00076 #endif
00077 
00078 /// Set trace level
00079 psBool psTraceSetLevel(const char *facil,     ///< facilty of interest
00080                        psS32 level)     ///< desired trace level
00081 ;
00082 
00083 /// Get the trace level
00084 psS32 psTraceGetLevel(const char *facil)     ///< facilty of interest
00085 ;
00086 
00087 /// Set all trace levels to zero (do not free nodes in the component tree).
00088 void psTraceReset();
00089 
00090 /// print trace levels
00091 void psTracePrintLevels(void);
00092 
00093 /// Set the destination of future trace messages.
00094 void psTraceSetDestination(FILE * fp);
00095 
00096 /* \} */// End of SystemGroup Functions
00097 
00098 #endif
00099 
00100 #endif

Generated on Mon Apr 4 18:24:45 2005 for Pan-STARRS Foundation Library by  doxygen 1.3.9.1