X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDebug.cxx;h=ee7216641d0ae583c9742a2a6f49da76c793c88f;hb=9d913797d3bf5a18625f4d8d8b42c8f5c8c10d99;hp=6bff5c2b828c18efcd3f26921f22fa9b9b119367;hpb=e8cd982edb78da16b0ca42d09a5a7943e48587ef;p=gdcm.git diff --git a/src/gdcmDebug.cxx b/src/gdcmDebug.cxx index 6bff5c2b..ee721664 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:30:43 $ - Version: $Revision: 1.12 $ + Date: $Date: 2005/01/07 19:20:38 $ + Version: $Revision: 1.15 $ 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 - */ -Debug::Debug(int level) -{ - DebugLevel = level; -} - /** * \brief Accessor * @param level Set the debug level */ -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) +void Debug::SetDebugFlag (int flag) { - if (level > DebugLevel) - { - return ; - } - std::cerr << "gdcm::" << msg1 << ' ' << msg2 << std::endl << std::flush; + DebugFlag = flag; } /** - * \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) + * \brief Accessor + * @param level Get the debug level + */ +int Debug::GetDebugFlag () { - std::cerr << "gdcm::" << msg1 << ' ' << msg2 << ' ' << msg3 - << std::endl << std::flush; - Exit(1); + return DebugFlag; } -/** - * \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 -#if defined(_MSC_VER) || defined(__BORLANDC__) - exit(a); // Found in #include -#endif -} -} // end namespace gdcm