00001 /* 00002 * 00003 * Copyright (C) 1994-2005, OFFIS 00004 * 00005 * This software and supporting documentation were developed by 00006 * 00007 * Kuratorium OFFIS e.V. 00008 * Healthcare Information and Communication Systems 00009 * Escherweg 2 00010 * D-26121 Oldenburg, Germany 00011 * 00012 * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY 00013 * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR 00014 * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR 00015 * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND 00016 * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. 00017 * 00018 * Module: dcmdata 00019 * 00020 * Author: Gerd Ehlers 00021 * 00022 * Purpose: Print debug information 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:28:04 $ 00026 * CVS/RCS Revision: $Revision: 1.13 $ 00027 * Status: $State: Exp $ 00028 * 00029 * CVS/RCS Log at end of file 00030 * 00031 */ 00032 00033 #ifndef DCDEBUG_H 00034 #define DCDEBUG_H 00035 00036 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00037 #include "dcmtk/ofstd/ofstream.h" 00038 #include "dcmtk/ofstd/ofglobal.h" 00039 00040 extern OFGlobal<int> DcmDebugLevel; /* default 0 */ 00041 00042 #ifdef DEBUG 00043 00044 void DCM_dcmdata_debug_print(const char* text, ... ); 00045 00046 // Set the debug level 00047 #define SetDebugLevel(level) DcmDebugLevel.set(level); 00048 00049 // debug prints a debug message in param if lev <= DcmDebugLevel. param has the 00050 // format of the printf parameters (with round brackets)! 00051 #define DCM_dcmdataDebug(lev, param) \ 00052 { \ 00053 if ((lev) <= DcmDebugLevel.get()) \ 00054 { \ 00055 ofConsole.lockCerr() << __FILE__ << ", LINE " << __LINE__ << ":"; \ 00056 DCM_dcmdata_debug_print param ; \ 00057 ofConsole.unlockCerr(); \ 00058 } \ 00059 } 00060 00061 // Cdebug does the same as debug but only if a condition cond is OFTrue 00062 #define DCM_dcmdataCDebug(lev, cond, param) \ 00063 { \ 00064 if ((lev) <= DcmDebugLevel.get() && (cond)) \ 00065 { \ 00066 ofConsole.lockCerr() << __FILE__ << ", LINE " << __LINE__ << ":"; \ 00067 DCM_dcmdata_debug_print param ; \ 00068 ofConsole.unlockCerr(); \ 00069 } \ 00070 } 00071 00072 #else // DEBUG 00073 00074 #define SetDebugLevel(param) 00075 #define DCM_dcmdataDebug(lev, param) 00076 #define DCM_dcmdataCDebug(lev, cond, param) 00077 00078 #endif // DEBUG 00079 00080 #endif // DCDEBUG_H 00081 00082 00083 /* 00084 * CVS/RCS Log: 00085 * $Log: dcdebug.h,v $ 00086 * Revision 1.13 2005/12/08 16:28:04 meichel 00087 * Changed include path schema for all DCMTK header files 00088 * 00089 * Revision 1.12 2005/11/28 15:53:16 meichel 00090 * Renamed macros in dcdebug.h 00091 * 00092 * Revision 1.11 2004/01/16 14:06:32 joergr 00093 * Removed acknowledgements with e-mail addresses from CVS log. 00094 * 00095 * Revision 1.10 2002/04/16 13:41:43 joergr 00096 * Added configurable support for C++ ANSI standard includes (e.g. streams). 00097 * 00098 * Revision 1.9 2001/06/01 15:48:35 meichel 00099 * Updated copyright header 00100 * 00101 * Revision 1.8 2000/04/14 15:45:30 meichel 00102 * Dcmdata debug facility now uses ofConsole for output. 00103 * 00104 * Revision 1.7 2000/03/08 16:26:12 meichel 00105 * Updated copyright header. 00106 * 00107 * Revision 1.6 2000/03/03 14:05:22 meichel 00108 * Implemented library support for redirecting error messages into memory 00109 * instead of printing them to stdout/stderr for GUI applications. 00110 * 00111 * Revision 1.5 1999/03/31 09:24:33 meichel 00112 * Updated copyright header in module dcmdata 00113 * 00114 * 00115 */