]> Creatis software - gdcm.git/blobdiff - src/gdcmDebug.cxx
BUG: Previous code did not compile with all (=busted) compilers
[gdcm.git] / src / gdcmDebug.cxx
index baa6a433ed5cbbfd6485ee12c738db29327da39a..787c529cc98d5880043d853804f6f673891f0021 100644 (file)
@@ -3,12 +3,12 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDebug.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/09/24 03:34:27 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2004/10/15 10:43:27 $
+  Version:   $Revision: 1.10 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
-  http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
+  http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
                                                                                 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 #include <iostream>
 #include "gdcmDebug.h"
 
+namespace gdcm 
+{
+
 //-----------------------------------------------------------------------------
 /**
  * \brief   constructor
  * @param level debug level
  */ 
-gdcmDebug::gdcmDebug(int level) 
+Debug::Debug(int level) 
 {
    DebugLevel = level;
 }
@@ -33,7 +36,7 @@ gdcmDebug::gdcmDebug(int level)
  * \brief   Accessor
  * @param   level Set the debug level
  */ 
-void gdcmDebug::SetDebug(int level) 
+void Debug::SetDebug(int level) 
 {
    DebugLevel = level;
 }
@@ -44,13 +47,13 @@ void gdcmDebug::SetDebug(int level)
  * @param msg1 first message part
  * @param msg2 second message part 
  */
-void gdcmDebug::Verbose(int level, const char * msg1, const char * msg2) 
+void Debug::Verbose(int level, const char * msg1, const char * msg2) 
 {
    if (level > DebugLevel)
    {
       return ;
    }
-   std::cerr << msg1 << ' ' << msg2 << std::endl;
+   std::cerr << "gdcm::" << msg1 << ' ' << msg2 << std::endl << std::flush;
 }
 
 /**
@@ -59,13 +62,13 @@ void gdcmDebug::Verbose(int level, const char * msg1, const char * msg2)
  * @param msg1 first message part
  * @param msg2 second message part 
  */
-void gdcmDebug::Error(bool test, const char * msg1, const char * msg2) 
+void Debug::Error(bool test, const char * msg1, const char * msg2) 
 {
    if (!test)
    {
       return;
    }
-   std::cerr << msg1 << ' ' << msg2 << std::endl;
+   std::cerr << "gdcm::" << msg1 << ' ' << msg2 << std::endl << std::flush;
    Exit(1);
 }
 
@@ -75,10 +78,11 @@ void gdcmDebug::Error(bool test, const char * msg1, const char * msg2)
  * @param msg2 second message part
  * @param msg3 Third message part  
  */
-void gdcmDebug::Error(const char* msg1, const char* msg2,
+void Debug::Error(const char* msg1, const char* msg2,
                       const char* msg3) 
 {
-   std::cerr << msg1 << ' ' << msg2 << ' ' << msg3 << std::endl;
+   std::cerr << "gdcm::" << msg1 << ' ' << msg2 << ' ' << msg3
+             << std::endl << std::flush;
    Exit(1);
 }
 
@@ -89,7 +93,7 @@ void gdcmDebug::Error(const char* msg1, const char* msg2,
  * @param msg1 first message part
  * @param msg2 second message part
  */
-void gdcmDebug::Assert(int level, bool test, const char * msg1, 
+void Debug::Assert(int level, bool test, const char * msg1, 
                        const char * msg2) 
 {
    if (level > DebugLevel)
@@ -98,7 +102,8 @@ void gdcmDebug::Assert(int level, bool test, const char * msg1,
    }
    if (!test)
    {
-      std::cerr << msg1 << ' ' << msg2 << std::endl;
+      std::cerr << "gdcm::" <<  msg1 << ' ' << msg2
+                << std::endl << std::flush;
    }
 }
 
@@ -106,7 +111,7 @@ void gdcmDebug::Assert(int level, bool test, const char * msg1,
  * \brief   Exit 
  * @param a return code 
  */
-void gdcmDebug::Exit(int a) 
+void Debug::Exit(int a) 
 {
 #ifdef __GNUC__
    std::exit(a);
@@ -115,3 +120,5 @@ void gdcmDebug::Exit(int a)
    exit(a);    // Found in #include <stdlib.h>
 #endif
 }
+
+} // end namespace gdcm