From 45047706a3b35c8ba3a09e032fa2bf25d4075793 Mon Sep 17 00:00:00 2001 From: malaterre Date: Fri, 7 Jan 2005 20:31:36 +0000 Subject: [PATCH] ENH: update comments. Rename variable with more complexe name to avoid collision. --- src/gdcmDebug.h | 69 +++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/src/gdcmDebug.h b/src/gdcmDebug.h index a173a811..a46a60bb 100644 --- a/src/gdcmDebug.h +++ b/src/gdcmDebug.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDebug.h,v $ Language: C++ - Date: $Date: 2005/01/07 19:20:38 $ - Version: $Revision: 1.13 $ + Date: $Date: 2005/01/07 20:31:36 $ + Version: $Revision: 1.14 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -29,12 +29,13 @@ namespace gdcm * \ingroup Debug * \brief Debug is an object for debugging in program. * It has 2 debugging modes : - * - error : for bad library use - * - debug : for debugging messages + * - error : for bad library use, seriously wrong DICOM + * - debug : for information/debug messages + * - warning : for warning about DICOM quality (kosher) * - * A debugging message has a level of priority and is - * Shown only when the debug level is higher than the - * message level. + * A debugging message is only show if the flag is on (DebugFlag) + * This is static var and can be set at begining of code: + * gdcm::Debug::SetDebugOn(); */ class GDCM_EXPORT Debug { @@ -55,60 +56,55 @@ public: // You cannot use function unless you use vnsprintf ... // __FUNCTION is not always defined by preprocessor -#ifndef __FUNCTION__ -# define __FUNCTION__ "" +// In c++ we should use __PRETTY_FUNCTION__ instead... +#ifndef __GNUC__ +# define __FUNCTION__ "" #endif /** - * \brief Verbose - * @param level level - * @param msg1 first message part - * @param msg2 second message part + * \brief Debug + * @param msg message part */ -#define gdcmDebugMacro(x) \ +#define gdcmDebugMacro(msg) \ { \ if( gdcm::Debug::GetDebugFlag() ) \ { \ std::ostringstream osmacro; \ osmacro << "Debug: In " __FILE__ ", line " << __LINE__ \ - << ", function " << __FUNCTION__ << '\n' \ - << x << "\n\n"; \ + << ", function " << __FUNCTION__ << '\n' \ + << msg << "\n\n"; \ std::cerr << osmacro.str() << std::endl; \ } \ } /** * \brief Verbose - * @param level level - * @param msg1 first message part - * @param msg2 second message part + * @param msg message part */ -#define gdcmVerboseMacro(x) \ +#define gdcmVerboseMacro(msg) \ { \ if( gdcm::Debug::GetDebugFlag() ) \ { \ std::ostringstream osmacro; \ osmacro << "Verbose: In " __FILE__ ", line " << __LINE__ \ - << ", function " __FUNCTION__ "\n" \ - << x << "\n\n"; \ + << ", function " << __FUNCTION__ << "\n" \ + << msg << "\n\n"; \ std::cerr << osmacro.str() << std::endl; \ } \ } /** * \brief Error - * @param test test - * @param msg1 first message part - * @param msg2 second message part + * @param msg second message part */ -#define gdcmErrorMacro(x) \ +#define gdcmErrorMacro(msg) \ { \ if( gdcm::Debug::GetDebugFlag() ) \ { \ std::ostringstream osmacro; \ osmacro << "Error: In " __FILE__ ", line " << __LINE__ \ - << ", function " << __FUNCTION__ << '\n' \ - << x << "\n\n"; \ + << ", function " << __FUNCTION__ << '\n' \ + << msg << "\n\n"; \ std::cerr << osmacro.str() << std::endl; \ exit(1); \ } \ @@ -116,21 +112,20 @@ public: /** * \brief Assert - * @param level level - * @param test test - * @param msg1 first message part - * @param msg2 second message part + * @param arg argument to test + * An easy solution to pass also a message is to do: + * gdcmAssertMacro( "my message" && 2 < 3 ) */ -#define gdcmAssertMacro(x) \ +#define gdcmAssertMacro(arg) \ { \ - if( x ) \ + if( arg ) \ { \ std::ostringstream osmacro; \ osmacro << "Assert: In " __FILE__ ", line " << __LINE__ \ - << ", function " << __FUNCTION__ \ - << "\n\n"; \ + << ", function " << __FUNCTION__ \ + << "\n\n"; \ std::cerr << osmacro.str() << std::endl; \ - assert ( x ); \ + assert ( arg ); \ } \ } -- 2.48.1