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.1.1.1 $ $Name:  $
00012  *  @date $Date: 2005/06/15 21:08:12 $
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 // XXX EAM : the old 'empty' values of (void) 0 are dangerous
00032 # if defined(PS_NO_TRACE)
00033     #   define psTrace(facil, level, ...)   /* do nothing */
00034     #   define p_psTrace(facil, level, ...) /* do nothing */
00035     #   define psTraceSetLevel(facil,level) /* do nothing */
00036     #   define psTraceGetLevel(facil)       /* do nothing */
00037     #   define psTraceReset()               /* do nothing */
00038     #   define psTraceFree()                /* do nothing */
00039     #   define psTracePrintLevels()         /* do nothing */
00040     #   define psTraceSetDestination(fp)    /* do nothing */
00041     #   define psTraceSetDestination()      /* do nothing */
00042     #   define PS_TRACE_ON 0
00043 
00044     # else /* PS_NO_TRACE */
00045         #   define PS_TRACE_ON 1
00046 
00047         /** Basic structure for the component tree.  A component is a string of the
00048             form aaa.bbb.ccc, and may itself contain further subcomponents.  The
00049             Component structure doesn't in fact contain it's full name, but only the
00050             last part. */
00051         typedef struct p_psComponent
00052         {
00053             const char *name;   // last part of name of component
00054             psS32 level;   // trace level for this component
00055             bool p_psSpecified;
00056             psS32 n;    // number of subcomponents
00057             struct p_psComponent* *subcomp;     // next level of subcomponents
00058         }
00059 p_psComponent;
00060 
00061 #ifdef DOXYGEN
00062 void psTrace(const char *facil,        ///< facilty of interest
00063              psS32 myLevel,            ///< desired trace level
00064              ...)                      ///< trace message arguments
00065 ;
00066 #else
00067 /// Send a trace message
00068 void p_psTrace(const char *facil,      ///< facilty of interest
00069                psS32 myLevel,          ///< desired trace level
00070                ...)                    ///< trace message arguments
00071 ;
00072 
00073 #ifndef SWIG
00074 #define psTrace(facil, level, ...) p_psTrace(facil, level, __VA_ARGS__)
00075 #endif /* SWIG */
00076 
00077 #endif /* DOXYGEN */
00078 
00079 /// Set trace level
00080 psBool psTraceSetLevel(const char *facil,     ///< facilty of interest
00081                        psS32 level)     ///< desired trace level
00082 ;
00083 
00084 /// Get the trace level
00085 psS32 psTraceGetLevel(const char *facil) ///< facilty of interest
00086 ;
00087 
00088 /// Set all trace levels to zero (do not free nodes in the component tree).
00089 void psTraceReset();
00090 
00091 /// print trace levels
00092 void psTracePrintLevels(void);
00093 
00094 /// Set the destination of future trace messages.
00095 void psTraceSetDestination(FILE * fp);
00096 
00097 /// Get the current destination for trace messages.
00098 FILE *psTraceGetDestination(void);
00099 
00100 /* \} */// End of SystemGroup Functions
00101 
00102 #endif /* PS_NO_TRACE */
00103 
00104 #endif /* PS_TRACE_H */
00105 

Generated on Wed Jun 15 11:00:57 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.1