X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDebug.cxx;h=f5ffc7df456271af0a18a9bf08fadc5dea305f87;hb=7059f7f1ad9d1466d7b752a40cfeb95ba81aa3d8;hp=fe3a5414c0581fe53085a7040c024a6b979e3d77;hpb=1db4734a7dfefbf5b9e8e3e7b102b36ab68d8243;p=gdcm.git diff --git a/src/gdcmDebug.cxx b/src/gdcmDebug.cxx index fe3a5414..f5ffc7df 100644 --- a/src/gdcmDebug.cxx +++ b/src/gdcmDebug.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDebug.cxx,v $ Language: C++ - Date: $Date: 2004/11/09 22:15:36 $ - Version: $Revision: 1.11 $ + Date: $Date: 2005/01/10 17:17:52 $ + Version: $Revision: 1.16 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -22,103 +22,27 @@ namespace gdcm { +/// warning message level to be displayed +static int DebugFlag = 0; //----------------------------------------------------------------------------- /** - * \brief constructor - * @param level debug level + * \brief Accessor + * @param flag Set the debug flag */ -Debug::Debug(int level) +void Debug::SetDebugFlag (int flag) { - DebugLevel = level; + DebugFlag = flag; } /** * \brief Accessor - * @param level Set the debug level + * @param level Get the debug flag */ -void Debug::SetDebug(int level) -{ - DebugLevel = level; -} - -/** - * \brief Verbose - * @param level level - * @param msg1 first message part - * @param msg2 second message part - */ -void Debug::Verbose(int level, const char * msg1, const char * msg2) +int Debug::GetDebugFlag () { - if (level > DebugLevel) - { - return ; - } - std::cerr << "gdcm::" << msg1 << ' ' << msg2 << std::endl << std::flush; + return DebugFlag; } -/** - * \brief Error - * @param test test - * @param msg1 first message part - * @param msg2 second message part - */ -void Debug::Error(bool test, const char * msg1, const char * msg2) -{ - if (!test) - { - return; - } - std::cerr << "gdcm::" << msg1 << ' ' << msg2 << std::endl << std::flush; - Exit(1); -} - -/** - * \brief Error - * @param msg1 first message part - * @param msg2 second message part - * @param msg3 Third message part - */ -void Debug::Error(const char* msg1, const char* msg2, - const char* msg3) -{ - std::cerr << "gdcm::" << msg1 << ' ' << msg2 << ' ' << msg3 - << std::endl << std::flush; - Exit(1); -} - -/** - * \brief Assert - * @param level level - * @param test test - * @param msg1 first message part - * @param msg2 second message part - */ -void Debug::Assert(int level, bool test, const char * msg1, - const char * msg2) -{ - if (level > DebugLevel) - { - return ; - } - if (!test) - { - std::cerr << "gdcm::" << msg1 << ' ' << msg2 - << std::endl << std::flush; - } -} +} // end namespace gdcm -/** - * \brief Exit - * @param a return code - */ -void Debug::Exit(int a) -{ -#ifdef __GNUC__ - std::exit(a); -#endif -#ifdef _MSC_VER || __BORLANDC__ - exit(a); // Found in #include -#endif -} -} // end namespace gdcm