]> Creatis software - gdcm.git/blobdiff - src/gdcmDebug.cxx
ENH: Remove any possible leaks with the dictionary. Now there is no /new/ anymore...
[gdcm.git] / src / gdcmDebug.cxx
index ebcc95c2fca9198e711e2f47de5ac7c9ec18819e..787c529cc98d5880043d853804f6f673891f0021 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDebug.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/09/27 08:39:05 $
-  Version:   $Revision: 1.7 $
+  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
 #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