]> Creatis software - gdcm.git/blobdiff - src/gdcmDebug.cxx
Coding Style + Doxygenation
[gdcm.git] / src / gdcmDebug.cxx
index ebcc95c2fca9198e711e2f47de5ac7c9ec18819e..d301a9bf69297b1e0129ffb682fcdc4e54f7ee2f 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: 2005/01/06 20:03:26 $
+  Version:   $Revision: 1.13 $
                                                                                 
   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,
-                      const char* msg3) 
+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,8 +93,8 @@ 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, 
-                       const char * msg2) 
+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,12 +111,14 @@ 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);
 #endif
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__BORLANDC__)
    exit(a);    // Found in #include <stdlib.h>
 #endif
 }
+
+} // end namespace gdcm