IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ticket #379: psTrace.h

File psTrace.h, 3.2 KB (added by eugene, 21 years ago)

psTrace.h to match psTrace.c

Line 
1/** @file psTrace.h
2 * \brief basic run-time trace facilities
3 * \ingroup LogTrace
4 *
5 * This file will hold the prototypes for defining procedures to insert
6 * trace messages into the code.
7 *
8 * @author Robert Lupton, Princeton University
9 * @author GLG, MHPCC
10 *
11 * @version $Revision: 1.31 $ $Name: $
12 * @date $Date: 2005/02/17 19:26:24 $
13 *
14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
15 */
16#if !defined(PS_TRACE_H)
17#define PS_TRACE_H 1
18
19#define PS_UNKNOWN_TRACE_LEVEL -9999 // we don't know this name's level
20#define PS_DEFAULT_TRACE_LEVEL -1
21#define PS_THE_OTHER_DEFAULT_TRACE_LEVEL 0
22
23/** \addtogroup LogTrace
24 * \{
25 */
26
27/** Functions **************************************************************/
28
29//#define PS_NO_TRACE 1 ///< to turn off all tracing
30
31// XXX EAM : the old 'empty' values of (void) 0 are dangerous
32# if defined(PS_NO_TRACE)
33# define psTrace(facil, level, ...) /* do nothing */
34# define p_psTrace(facil, level, ...) /* do nothing */
35# define psTraceSetLevel(facil,level) /* do nothing */
36# define psTraceGetLevel(facil) /* do nothing */
37# define psTraceReset() /* do nothing */
38# define psTraceFree() /* do nothing */
39# define psTracePrintLevels() /* do nothing */
40# define psTraceSetDestination(fp) /* do nothing */
41# define psTraceSetDestination() /* do nothing */
42# define PS_TRACE_ON 0
43
44# else /* PS_NO_TRACE */
45# define PS_TRACE_ON 1
46
47/** Basic structure for the component tree. A component is a string of the
48 form aaa.bbb.ccc, and may itself contain further subcomponents. The
49 Component structure doesn't in fact contain it's full name, but only the
50 last part. */
51typedef struct p_psComponent
52{
53 const char *name; // last part of name of component
54 psS32 level; // trace level for this component
55 bool p_psSpecified;
56 psS32 n; // number of subcomponents
57 struct p_psComponent* *subcomp; // next level of subcomponents
58}
59p_psComponent;
60
61#ifdef DOXYGEN
62void psTrace(const char *facil, ///< facilty of interest
63 psS32 myLevel, ///< desired trace level
64 ...) ///< trace message arguments
65;
66#else
67/// Send a trace message
68void p_psTrace(const char *facil, ///< facilty of interest
69 psS32 myLevel, ///< desired trace level
70 ...) ///< trace message arguments
71;
72
73#ifndef SWIG
74#define psTrace(facil, level, ...) p_psTrace(facil, level, __VA_ARGS__)
75#endif /* SWIG */
76
77#endif /* DOXYGEN */
78
79/// Set trace level
80psBool psTraceSetLevel(const char *facil, ///< facilty of interest
81 psS32 level) ///< desired trace level
82;
83
84/// Get the trace level
85psS32 psTraceGetLevel(const char *facil) ///< facilty of interest
86;
87
88/// Set all trace levels to zero (do not free nodes in the component tree).
89void psTraceReset();
90
91/// print trace levels
92void psTracePrintLevels(void);
93
94/// Set the destination of future trace messages.
95void psTraceSetDestination(FILE * fp);
96
97/// Get the current destination for trace messages.
98FILE *psTraceGetDestination(void);
99
100/* \} */// End of SystemGroup Functions
101
102#endif /* PS_NO_TRACE */
103
104#endif /* PS_TRACE_H */
105