]> Creatis software - gdcm.git/commitdiff
* src/gdcmUtil.[cxx|h] split in two. Additional file gdcmDebug.[cxx|h]
authorfrog <frog>
Fri, 26 Mar 2004 13:33:52 +0000 (13:33 +0000)
committerfrog <frog>
Fri, 26 Mar 2004 13:33:52 +0000 (13:33 +0000)
       now contains all the Debug related code.
     * minor clean-up of includes in src/*.cxx

24 files changed:
ChangeLog
src/Makefile.am
src/gdcm.h
src/gdcmCommon.h
src/gdcmDebug.cxx [new file with mode: 0644]
src/gdcmDebug.h [new file with mode: 0644]
src/gdcmDicomDir.cxx
src/gdcmDicomDirElement.cxx
src/gdcmDicomDirPatient.cxx
src/gdcmDicomDirSerie.cxx
src/gdcmDict.cxx
src/gdcmDictEntry.cxx
src/gdcmDictSet.cxx
src/gdcmFile.cxx
src/gdcmHeader.cxx
src/gdcmHeaderHelper.cxx
src/gdcmObject.cxx
src/gdcmParsePixels.cxx
src/gdcmParser.cxx
src/gdcmTS.cxx
src/gdcmUtil.cxx
src/gdcmUtil.h
src/gdcmVR.cxx
src/win32/gdcmdll.dsp

index 270348ae0f3ec74c4f8adaa5cf06172ab5fbb3bd..ebcadc3ce40a06d7873930d8a7e5782844be93f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,13 +1,18 @@
+2004-03-26  Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
+     * src/gdcmUtil.[cxx|h] split in two. Additional file gdcmDebug.[cxx|h]
+       now contains all the Debug related code.
+     * minor clean-up of includes in src/*.cxx
+
 2004-03-24  Jean-Pierre Roux
      * FIX a lot of little surface modifications to be doxygen 1.3.6 compliant
-     
+
 2004-03-23  Jean-Pierre Roux
      * FIX Now gdcmFile::SwapZone doesn't seg faults any longer for 
            big endian made volumes
      * ENH Now gdcmParser constructor and destructor are protected to forbid 
            end user to instanciate class gdcmParser
-          (only gdcmHeader and gdcmDicomDir are meaningfull)
-                  
+          (only gdcmHeader and gdcmDicomDir are meaningfull)
+
 2004-03-22 Benoit Regrain
      * FIX : src/gdcmDicomDir.cxx : make windows compilable
      * FIX : gdcmPython/gdcm.i : change gdcmStudy to gdcmDicomDirStudy and
index 26911da7a79a25f8af40d03541e3046ac82eb71c..3a0be1cb0086db213c26b60dd17578d6961aa10a 100644 (file)
@@ -13,6 +13,7 @@ libgdcm_la_LIBADD = \
    $(top_builddir)/src/jpeg/ljpg/libgdcmjpg.la
 
 libgdcm_la_SOURCES=                \
+   gdcmDebug.cxx                   \
    gdcmDicomDir.cxx                \
    gdcmDicomDirElement.cxx         \
    gdcmDicomDirImage.cxx           \
@@ -42,29 +43,30 @@ libgdcm_la_SOURCES=                \
 
 
 libgdcmincludedir = $(includedir)
-libgdcminclude_HEADERS =                \
-       gdcmCommon.h                    \
-       gdcmDicomDir.h                  \
-        gdcmDicomDirElement.h           \
-       gdcmDicomDirImage.h             \
-        gdcmDicomDirMeta.h              \
-       gdcmDicomDirPatient.h           \
-       gdcmDicomDirSerie.h             \
-       gdcmDicomDirStudy.h             \
-        gdcmDictEntry.h                 \
-       gdcmDict.h                      \
-       gdcmDictSet.h                   \
-       gdcmDirList.h                   \
-       gdcmException.h                 \
-       gdcmFile.h                      \
-       gdcm.h                          \
-       gdcmHeaderEntry.h               \
-       gdcmHeader.h                    \
-       gdcmHeaderHelper.h              \
-       gdcmObject.h                    \
-       gdcmParser.h                    \
-       gdcmVR.h                        \
-       gdcmTS.h
+libgdcminclude_HEADERS =           \
+   gdcmCommon.h                    \
+   gdcmDebug.h                     \
+   gdcmDicomDir.h                  \
+   gdcmDicomDirElement.h           \
+   gdcmDicomDirImage.h             \
+   gdcmDicomDirMeta.h              \
+   gdcmDicomDirPatient.h           \
+   gdcmDicomDirSerie.h             \
+   gdcmDicomDirStudy.h             \
+   gdcmDictEntry.h                 \
+   gdcmDict.h                      \
+   gdcmDictSet.h                   \
+   gdcmDirList.h                   \
+   gdcmException.h                 \
+   gdcmFile.h                      \
+   gdcm.h                          \
+   gdcmHeaderEntry.h               \
+   gdcmHeader.h                    \
+   gdcmHeaderHelper.h              \
+   gdcmObject.h                    \
+   gdcmParser.h                    \
+   gdcmVR.h                        \
+   gdcmTS.h
 
 EXTRA_DIST =   \
        gdcmUtil.h
index 997001a0ff0e575e7730026e1dc6e1c9dd70a7f5..bae51665f76ae44ed824521fd8d5cca66861acd0 100644 (file)
@@ -3,7 +3,7 @@
 #ifndef GDCM_H
 #define GDCM_H
 
-////////////////////////////////////////////////////////////////////////////
+//-----------------------------------------------------------------------------
 // Tag based hash tables.
 // We shall use as keys the strings (as the C++ type) obtained by
 // concatenating the group value and the element value (both of type
@@ -31,4 +31,4 @@
 #include "gdcmUtil.h"
 
 //-----------------------------------------------------------------------------
-#endif // #ifndef GDCM_H
+#endif
index ea48792d6961e1620a582a6d0002c915b6c2ce70..97a3ea99e3da93b81e2b2459af1f35901d8aa9f3 100644 (file)
@@ -3,9 +3,6 @@
 #ifndef GDCMCOMMON_H
 #define GDCMCOMMON_H
 
-//-----------------------------------------------------------------------------
-#define GDCM_DEBUG -1
-
 //-----------------------------------------------------------------------------
 //This is needed when compiling in debug mode
 #ifdef _MSC_VER
 // return type for 'identifier' is '' (ie; not a UDT or reference to UDT. Will
 // produce errors if applied using infix notation
 #pragma warning ( disable : 4284 )
+// 'type' : forcing value to bool 'true' or 'false' (performance warning)
+// //#pragma warning ( disable : 4800 )
 #endif //_MSC_VER
 
-// Mmmmmm !
-// It reminds me the formerly well known LibIDO's idproto.h
-
 //-----------------------------------------------------------------------------
 #ifdef __GNUC__
 #ifndef HAVE_NO_STDINT_H
diff --git a/src/gdcmDebug.cxx b/src/gdcmDebug.cxx
new file mode 100644 (file)
index 0000000..9963df5
--- /dev/null
@@ -0,0 +1,96 @@
+#include <iostream>
+#include "gdcmDebug.h"
+
+/**
+ * \ingroup Globals
+ * \brief   Instance of debugging utility.
+ */
+gdcmDebug dbg;
+
+/**
+ * \ingroup gdcmDebug
+ * \brief   constructor
+ * @param level debug level
+ */ 
+gdcmDebug::gdcmDebug(int level) {
+   DebugLevel = level;
+}
+
+/**
+ * \ingroup gdcmDebug
+ * \brief   Accessor
+ * @param   level Set the debug level
+ */ 
+void gdcmDebug::SetDebug(int level) {
+   DebugLevel = level;
+}
+
+/**
+ * \ingroup gdcmDebug
+ * \brief   Verbose 
+ * @param Level level
+ * @param Msg1 first message part
+ * @param Msg2 second message part 
+ */
+void gdcmDebug::Verbose(int Level, const char * Msg1, const char * Msg2) {
+   if (Level > DebugLevel)
+      return ;
+   std::cerr << Msg1 << ' ' << Msg2 << std::endl;
+}
+
+/**
+ * \ingroup gdcmDebug
+ * \brief   Error 
+ * @param Test test
+ * @param Msg1 first message part
+ * @param Msg2 second message part 
+ */
+void gdcmDebug::Error( bool Test, const char * Msg1, const char * Msg2) {
+   if (!Test)
+      return;
+   std::cerr << Msg1 << ' ' << Msg2 << std::endl;
+   Exit(1);
+}
+
+/**
+ * \ingroup gdcmDebug
+ * \brief   Error 
+ * @param Msg1 first message part
+ * @param Msg2 second message part
+ * @param Msg3 Third message part  
+ */
+void gdcmDebug::Error(const char* Msg1, const char* Msg2,
+                      const char* Msg3) {
+   std::cerr << Msg1 << ' ' << Msg2 << ' ' << Msg3 << std::endl;
+   Exit(1);
+}
+
+/**
+ * \ingroup gdcmDebug
+ * \brief   Assert 
+ * @param Level level 
+ * @param Test test
+ * @param Msg1 first message part
+ * @param Msg2 second message part
+ */
+ void gdcmDebug::Assert(int Level, bool Test,
+                 const char * Msg1, const char * Msg2) {
+   if (Level > DebugLevel)
+      return ;
+   if (!Test)
+      std::cerr << Msg1 << ' ' << Msg2 << std::endl;
+}
+
+/**
+ * \ingroup gdcmDebug
+ * \brief   Exit 
+ * @param a return code 
+ */
+void gdcmDebug::Exit(int a) {
+#ifdef __GNUC__
+   std::exit(a);
+#endif
+#ifdef _MSC_VER
+   exit(a);    // Found in #include <stdlib.h>
+#endif
+}
diff --git a/src/gdcmDebug.h b/src/gdcmDebug.h
new file mode 100644 (file)
index 0000000..886e2ec
--- /dev/null
@@ -0,0 +1,38 @@
+// gdcmDebug.h
+//-----------------------------------------------------------------------------
+#ifndef GDCMDEBUG_H
+#define GDCMDEBUG_H
+
+#define GDCM_DEBUG -1
+
+/**
+ * \ingroup gdcmDebug
+ * \brief gdcmDebug is an object for debugging in program.
+ * It has 2 debugging modes :
+ *  - error : for bad library use
+ *  - debug : for debugging messages
+ * 
+ * A debugging message has a level of priority and is 
+ * Shown only when the debug level is higher than the 
+ * message level.
+ */
+class gdcmDebug {
+public:
+   gdcmDebug(int level = GDCM_DEBUG);
+
+   void SetDebug (int level);
+   void Verbose(int, const char*, const char* ="");
+   void Error(bool, const char*,  const char* ="");
+   void Error(const char*, const char* ="", const char* ="");
+
+   void Assert(int, bool, const char*, const char*);
+   void Exit(int);
+
+private:
+/// warning message level to be displayed
+   int DebugLevel;
+};
+
+extern gdcmDebug dbg;
+
+#endif
index b5fba6876c1786d6912fc3e070ea8913d68a6b73..c24e21989f754ab3d1e562fb221b4904d337cafc 100644 (file)
@@ -1,15 +1,7 @@
 // gdcmDicomDir.cxx
 //-----------------------------------------------------------------------------
-#include "gdcmDicomDir.h"
-#include "gdcmDicomDirStudy.h"
-#include "gdcmDicomDirSerie.h"
-#include "gdcmDicomDirImage.h"
-#include "gdcmDirList.h"
-#include "gdcmUtil.h"
-
 #include <string>
 #include <algorithm>
-
 #include <sys/types.h>
 #include <errno.h>
 
    #include <unistd.h>
 #endif
 
+#include "gdcmDicomDir.h"
+#include "gdcmDicomDirStudy.h"
+#include "gdcmDicomDirSerie.h"
+#include "gdcmDicomDirImage.h"
+#include "gdcmDirList.h"
+#include "gdcmUtil.h"
+#include "gdcmDebug.h"
+
 //-----------------------------------------------------------------------------
 //  For full DICOMDIR description, see:
 //  PS 3.3-2003, pages 731-750
index c26b9d32ae87c4f4167f633a99dec15d32867ee1..be6ce16577dbf4e161370392a78c81a2c047f770 100644 (file)
@@ -2,22 +2,23 @@
 //-----------------------------------------------------------------------------
 #include <fstream>
 #include <stdio.h>    // For sprintf
+#include <iostream>
+#ifdef GDCM_NO_ANSI_STRING_STREAM
+#  include <strstream>
+#  define  ostringstream ostrstream
+# else
+#  include <sstream>
+#endif
 
 #include "gdcmDicomDirElement.h"
 #include "gdcmUtil.h"
+#include "gdcmDebug.h"
 
 #ifndef PUB_DICT_PATH
 #  define PUB_DICT_PATH     "../Dicts/"
 #endif
 #define DICT_ELEM "DicomDir.dic"
 
-#include <iostream>
-#ifdef GDCM_NO_ANSI_STRING_STREAM
-#  include <strstream>
-#  define  ostringstream ostrstream
-# else
-#  include <sstream>
-#endif
 
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
index 2ab6f894817e945d48864f501eb5b85ad22e59a0..57358bbfd107a19ea58af75690fefbb69ec26dbb 100644 (file)
@@ -3,6 +3,7 @@
 #include "gdcmDicomDirPatient.h"
 #include "gdcmDicomDirElement.h"
 #include "gdcmUtil.h"
+
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 /**
index 7324e0595b14d787e6d4af8165a195113dda56da..e805e27e22ce4506d80e08c5009154b715950de4 100644 (file)
@@ -3,6 +3,7 @@
 #include "gdcmDicomDirSerie.h"
 #include "gdcmDicomDirElement.h"
 #include "gdcmUtil.h"
+
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 /**
index 75834e1f76ea3f8a82b836d97241470cafcd9627..b5bdea348deeb07d384a01dbae5436514e1d30d6 100644 (file)
@@ -2,6 +2,7 @@
 //-----------------------------------------------------------------------------
 #include "gdcmDict.h"
 #include "gdcmUtil.h"
+#include "gdcmDebug.h"
 
 #include <fstream>
 #include <iostream>
index bdabafbec3e943cf05fa9fe32abaa4528e664e73..da623a2ef1dd79b6226bd3e1edb6e76e40e441ea 100644 (file)
@@ -1,9 +1,9 @@
 // gdcmDictEntry.cxx
 //-----------------------------------------------------------------------------
 #include "gdcmDictEntry.h"
+#include "gdcmDebug.h"
 
 #include <stdio.h>    // FIXME For sprintf
-#include "gdcmUtil.h"
 
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
@@ -46,7 +46,7 @@ gdcmDictEntry::gdcmDictEntry(guint16 InGroup, guint16 InElement,
 TagKey gdcmDictEntry::TranslateToKey(guint16 group, guint16 element) {
        char trash[10];
        TagKey key;
-       // CLEAN ME: better call the iostream<< with the hex manipulator on.
+       // CLEANME: better call the iostream<< with the hex manipulator on.
        // This requires some reading of the stdlibC++ sources to make the
        // proper call (or copy).
        sprintf(trash, "%04x|%04x", group , element);
index d1e21100c5ca76790dfb2eb7e4432bfa70b0f16c..e2c12ef4b49de9313bd827dd7f9b00b592547cc8 100644 (file)
@@ -1,7 +1,7 @@
 // gdcmDictEntry
 //-----------------------------------------------------------------------------
 #include "gdcmDictSet.h"
-#include "gdcmUtil.h"
+#include "gdcmDebug.h"
 #include <fstream>
 #include <stdlib.h>  // For getenv
 
index 8e84268df4ab764a684ab6c9ea1ae541e64ae416..633d4d2fb8c33b346f7ae35ed676487ab16750b3 100644 (file)
@@ -1,7 +1,7 @@
 // gdcmFile.cxx
 //-----------------------------------------------------------------------------
 #include "gdcmFile.h"
-#include "gdcmUtil.h"
+#include "gdcmDebug.h"
 #include "jpeg/ljpg/jpegless.h"
 
 typedef std::pair<TagHeaderEntryHT::iterator,TagHeaderEntryHT::iterator> IterHT;
@@ -22,7 +22,6 @@ typedef std::pair<TagHeaderEntryHT::iterator,TagHeaderEntryHT::iterator> IterHT;
  * @param header file to be opened for reading datas
  * @return     
  */
 gdcmFile::gdcmFile(gdcmHeader *header) {
    Header=header;
    SelfHeader=false;
index f230f4de54ce5fcef7937acc86dbb3b35a3ef34b..f0fdcf33d2e2ba2fdd5d2d878798ad6dd3ab8336 100644 (file)
@@ -1,15 +1,15 @@
 // gdcmHeader.cxx
 //-----------------------------------------------------------------------------
-#include "gdcmHeader.h"
-
 #include <stdio.h>
 #include <cerrno>
 #include <cctype>    // for isalpha
+#include <vector>
 
+#include "gdcmHeader.h"
 #include "gdcmUtil.h"
+#include "gdcmDebug.h"
 #include "gdcmTS.h"
 
-
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 /**
index a9af79bc99c887de0671b420297355f4b3102b6d..3410c65bf58e54fc40e25a268d30cec761ac1625 100644 (file)
@@ -3,14 +3,12 @@
 #include "gdcmHeaderHelper.h"
 #include "gdcmDirList.h"
 
-#include "gdcmUtil.h" //for debug
+#include "gdcmDebug.h"
 #include <math.h>
 #include <algorithm>
+#include <vector>
 
 //-----------------------------------------------------------------------------
-// gdcmHeaderHelper
-//-----------------------------------------------------------------------------
-// Constructor / Destructor
 /**
  * \ingroup gdcmHeaderHelper
  * \brief   constructor
index 1d39f1e341fb4d0ace00566b4bdf818d20e56c16..cef909778526d8736e2b2191156d384a8fb22e63 100644 (file)
@@ -2,9 +2,9 @@
 //-----------------------------------------------------------------------------
 #include "gdcmObject.h"
 #include "gdcmUtil.h"
+#include "gdcmDebug.h"
 
 //-----------------------------------------------------------------------------
-// Constructor / Destructor
 /**
  * \ingroup gdcmObject
  * \brief  Constructor 
index 40311776c1ca73d957d0f42cb2a4382c6c81c7e9..c95b825f5cf1c0b491b5918b145e2c70d6bebf8f 100644 (file)
@@ -1,19 +1,7 @@
 // gdcmParse.cxx
 //-----------------------------------------------------------------------------
-//This is needed when compiling in debug mode
-#ifdef _MSC_VER
-// 'type' : forcing value to bool 'true' or 'false' (performance warning)
-//#pragma warning ( disable : 4800 )
-// 'identifier' : class 'type' needs to have dll-interface to be used by
-// clients of class 'type2'
-#pragma warning ( disable : 4251 )
-// 'identifier' : identifier was truncated to 'number' characters in the
-// debug information
-#pragma warning ( disable : 4786 )
-#endif //_MSC_VER
-
+#include "gdcmCommon.h"
 #include "gdcmFile.h"
-#include "gdcmUtil.h"
 
 #define str2num(str, typeNum) *((typeNum *)(str))
 
index b78abc2945dee2f7d2332a137eaa6f4bceac0d22..871c8086f4b78cfcf61dd3f1380ba04d0343983d 100644 (file)
@@ -1,9 +1,7 @@
 // gdcmParser.cxx
 //-----------------------------------------------------------------------------
-#include "gdcmParser.h"
-#include "gdcmUtil.h"
-
 #include <errno.h>
+#include <vector>
 
 // For nthos:
 #ifdef _MSC_VER
 #endif
 #  include <iomanip>
 
+#include "gdcmParser.h"
+#include "gdcmUtil.h"
+#include "gdcmDebug.h"
+
 #define UI1_2_840_10008_1_2      "1.2.840.10008.1.2"
 #define UI1_2_840_10008_1_2_1    "1.2.840.10008.1.2.1"
 #define UI1_2_840_10008_1_2_2    "1.2.840.10008.1.2.2"
index b648b26bbb9e018bb2612108fe7fae8726147a1d..8946c61a9a95d6b47bbc2fc88ffc3f3bfabc68dc 100644 (file)
@@ -1,22 +1,25 @@
 // gdcmTS.cxx
 //-----------------------------------------------------------------------------
 #include <fstream>
+#include <string>
+#include <iostream>
+#ifdef GDCM_NO_ANSI_STRING_STREAM
+#  include <strstream>
+#  define  ostringstream ostrstream
+# else
+#  include <sstream>
+#endif
 
 #include "gdcmTS.h"
+#include "gdcmDebug.h"
 #include "gdcmUtil.h"
+#include "gdcmDictSet.h"
 
 #ifndef PUB_DICT_PATH
 #  define PUB_DICT_PATH     "../Dicts/"
 #endif
 #define DICT_TS "dicomTS.dic"
 
-#include <iostream>
-#ifdef GDCM_NO_ANSI_STRING_STREAM
-#  include <strstream>
-#  define  ostringstream ostrstream
-# else
-#  include <sstream>
-#endif
 
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
index 0760f383b929f3daf3ffcdc140a614310baf572a..ae7f0675aef740e99935503dd8308c155de13eb2 100644 (file)
 // gdcmUtil.cxx
 //-----------------------------------------------------------------------------
 #include "gdcmUtil.h"
-
+#include "gdcmDebug.h"
 #include <stdio.h>
 #include <ctype.h>   // For isspace
-#include <string.h>
-
-//-----------------------------------------------------------------------------
-// Library globals.
-gdcmDebug dbg;
+#include <string.h>  // CLEANME: could this be only string ? Related to Win32 ?
 
-//-----------------------------------------------------------------------------
 /**
- * \ingroup gdcmDebug
- * \brief   constructor
- * @param level debug level
- */ 
-
-gdcmDebug::gdcmDebug(int level) {
-   DebugLevel = level;
-}
-
-/**
- * \ingroup gdcmDebug
- * \brief   Verbose 
- * @param Level level
- * @param Msg1 first message part
- * @param Msg2 second message part 
+ * \ingroup Globals
+ * \brief Pointer to a container, holding _all_ the Dicom Dictionaries.
  */
-void gdcmDebug::Verbose(int Level, const char * Msg1, const char * Msg2) {
-   if (Level > DebugLevel)
-      return ;
-   std::cerr << Msg1 << ' ' << Msg2 << std::endl;
-}
+gdcmDictSet         *gdcmGlobal::Dicts  = (gdcmDictSet *)0;
 
 /**
- * \ingroup gdcmDebug
- * \brief   Error 
- * @param Test test
- * @param Msg1 first message part
- * @param Msg2 second message part 
+ * \ingroup Globals
+ * \brief   Pointer to a hash table containing the 'Value Representations'.
  */
-void gdcmDebug::Error( bool Test, const char * Msg1, const char * Msg2) {
-   if (!Test)
-      return;
-   std::cerr << Msg1 << ' ' << Msg2 << std::endl;
-   Exit(1);
-}
+gdcmVR              *gdcmGlobal::VR     = (gdcmVR *)0;
 
 /**
- * \ingroup gdcmDebug
- * \brief   Error 
- * @param Msg1 first message part
- * @param Msg2 second message part
- * @param Msg3 Third message part  
+ * \ingroup Globals
+ * \brief   Pointer to a hash table containing the Transfer Syntax codes
+ *          and their english description 
  */
-void gdcmDebug::Error(const char* Msg1, const char* Msg2,
-                      const char* Msg3) {
-   std::cerr << Msg1 << ' ' << Msg2 << ' ' << Msg3 << std::endl;
-   Exit(1);
-}
+gdcmTS              *gdcmGlobal::TS     = (gdcmTS *)0;
 
 /**
- * \ingroup gdcmDebug
- * \brief   Assert 
- * @param Level level 
- * @param Test test
- * @param Msg1 first message part
- * @param Msg2 second message part
+ * \ingroup Globals
+ * \brief   Pointer to the hash table containing the Dicom Elements
+ *          necessary to describe each part of a DICOMDIR 
  */
- void gdcmDebug::Assert(int Level, bool Test,
-                 const char * Msg1, const char * Msg2) {
-   if (Level > DebugLevel)
-      return ;
-   if (!Test)
-      std::cerr << Msg1 << ' ' << Msg2 << std::endl;
-}
+gdcmDicomDirElement *gdcmGlobal::ddElem = (gdcmDicomDirElement *)0;
 
 /**
- * \ingroup gdcmDebug
- * \brief   Exit 
- * @param a return code 
+ * \ingroup Globals
+ * \brief   Global container
  */
-void gdcmDebug::Exit(int a) {
-#ifdef __GNUC__
-   std::exit(a);
-#endif
-#ifdef _MSC_VER
-   exit(a);    // Found in #include <stdlib.h>
-#endif
-}
-
-//-----------------------------------------------------------------------------
-/// Pointer to a container, holding *all* the Dicom Dictionaries
-gdcmDictSet         *gdcmGlobal::Dicts  = (gdcmDictSet *)0;
-/// Pointer to a H table containing the 'Value Representations'
-gdcmVR              *gdcmGlobal::VR     = (gdcmVR *)0;
-/// Pointer to a H table containing the Transfer Syntax codes and their english description 
-gdcmTS              *gdcmGlobal::TS     = (gdcmTS *)0;
-/// Pointer to a H table containing the Dicom Elements necessary to describe each part of a DICOMDIR 
-gdcmDicomDirElement *gdcmGlobal::ddElem = (gdcmDicomDirElement *)0;
-/// gdcm Glob
 gdcmGlobal gdcmGlob;
 
-
 /**
  * \ingroup gdcmGlobal
  * \brief   constructor : populates the
@@ -144,14 +78,17 @@ gdcmDicomDirElement *gdcmGlobal::GetDicomDirElements(void) {
    return ddElem;
 }
 
-//-----------------------------------------------------------------------------
-// Here are some usefull functions, belonging to NO class,
-// dealing with strings, file names, etc
-// that can be called from anywhere
-// by whomsoever they can help.
-//-----------------------------------------------------------------------------
+/**
+ * \defgroup Globals Utility functions
+ * \brief    Here are some utility functions, belonging to NO class,
+ *           dealing with strings, file names... that can be called
+ *           from anywhere by whomsoever they can help.
+ */
 
-// Because is not yet available in g++2.96
+/**
+ * \ingroup Globals
+ * \brief   Because is not yet available in g++2.96
+ */
 std::istream& eatwhite(std::istream& is) {
    char c;
    while (is.get(c)) {
@@ -163,8 +100,10 @@ std::istream& eatwhite(std::istream& is) {
    return is;
 }
 
-///////////////////////////////////////////////////////////////////////////
-// Because is not  available in C++ (?)
+/**
+ * \ingroup Globals
+ * \brief Because not available in C++ (?)
+ */
 void Tokenize (const std::string& str,
                std::vector<std::string>& tokens,
                const std::string& delimiters) {
@@ -177,10 +116,10 @@ void Tokenize (const std::string& str,
    }
 }
 
-
-///////////////////////////////////////////////////////////////////////////
 /**
- * \brief  to prevent a flashing screen when non-printable character
+ * \ingroup Globals
+ * \brief  Weed out a string from the non-printable characters (in order
+ *         to avoid corrupting the terminal of invocation when printing)
  * @param v characters array to remove non printable characters from
  */
 char *_cleanString(char *v) {
@@ -192,12 +131,12 @@ char *_cleanString(char *v) {
       i++,d++) {
          if (!isprint(*d))
          *d = '.';
-   }   
+   }
    return v;
 }
 
-///////////////////////////////////////////////////////////////////////////
 /**
+ * \ingroup Globals
  * \brief   to prevent a flashing screen when non-printable character
  * @param s string to remove non printable characters from
  */
@@ -210,7 +149,6 @@ std::string _CreateCleanString(std::string s) {
          str[i]='.';
    }
 
-
    if(str.size()>0)
       if(!isprint(s[str.size()-1]))
          if(s[str.size()-1]==0)
@@ -219,27 +157,28 @@ std::string _CreateCleanString(std::string s) {
    return(str);
 }
 
-///////////////////////////////////////////////////////////////////////////
 /**
+ * \ingroup Globals
  * \brief   Add a SEPARATOR to the end of the name is necessary
  * @param name file/directory name to normalize 
  */
 void NormalizePath(std::string &name)
 {
-const char SEPARATOR_X      = '/';
-const char SEPARATOR_WIN    = '\\';
-const std::string SEPARATOR = "/";
+   const char SEPARATOR_X      = '/';
+   const char SEPARATOR_WIN    = '\\';
+   const std::string SEPARATOR = "/";
    int size=name.size();
+
    if((name[size-1]!=SEPARATOR_X)&&(name[size-1]!=SEPARATOR_WIN))
    {
       name+=SEPARATOR;
    }
 }
 
-///////////////////////////////////////////////////////////////////////////
 /**
+ * \ingroup Globals
  * \brief   Get the (directory) path from a full path file name
- * @param fullName file/directory name to extract Path from
+ * @param   fullName file/directory name to extract Path from
  */
 std::string GetPath(std::string &fullName)
 {
@@ -252,10 +191,10 @@ std::string GetPath(std::string &fullName)
    return(fullName);
 }
 
-///////////////////////////////////////////////////////////////////////////
 /**
+ * \ingroup Globals
  * \brief   Get the (last) name of a full path file name
- * @param fullName file/directory name to extract end name from
+ * @param   fullName file/directory name to extract end name from
  */
 std::string GetName(std::string &fullName)
 {   
index 4dcbc4fbf7ad0915955f5416222f823ddd7142d8..7683ed4f91b80087a9253dd5d81d4823b3a92dcc 100644 (file)
@@ -8,45 +8,9 @@
 #include "gdcmTS.h"
 #include "gdcmDictSet.h"
 #include "gdcmDicomDirElement.h"
-#include <iostream>
 #include <vector>
 #include <string>
 
-//-----------------------------------------------------------------------------
-/*
- * gdcmDebug is an object for debugging in program.
- * It has 2 debugging modes :
- *  - error : for bad library use
- *  - debug : for debugging messages
- * 
- * A debugging message has a level of priority and is 
- * Shown only when the debug level is higher than the 
- * message level.
- */
-class gdcmDebug {
-public:
-   gdcmDebug(int level = GDCM_DEBUG);
-
-  /**
-    * \ingroup gdcmDebug
-    * \brief   sets the debug level 
-    * @param i debug level to be set
-  */ 
-   void SetDebug (int i) 
-      {DebugLevel = i;}
-
-   void Verbose(int, const char*, const char* ="");
-   void Error(bool, const char*,  const char* ="");
-   void Error(const char*, const char* ="", const char* ="");
-
-   void Assert(int, bool, const char*, const char*);
-   void Exit(int);
-
-private:
-/// warning message level to be displayed
-   int DebugLevel;
-};
-
 //-----------------------------------------------------------------------------
 /*
  * This class contains all globals elements that might be
@@ -72,18 +36,14 @@ private:
 //-----------------------------------------------------------------------------
 std::istream & eatwhite(std::istream & is);
 
-   void Tokenize (const std::string& str,
-                  std::vector<std::string>& tokens,
-                  const std::string& delimiters = " ");
+void Tokenize (const std::string& str,
+               std::vector<std::string>& tokens,
+               const std::string& delimiters = " ");
 
-   extern gdcmDebug dbg;
+char *_cleanString(char *v);
+std::string _CreateCleanString(std::string s);
 
-   char *_cleanString(char *v);
-   std::string _CreateCleanString(std::string s);
-
-   void NormalizePath (std::string &name);
-   std::string GetPath(std::string &fullName);
-   std::string GetName(std::string &fullName);
-//-----------------------------------------------------------------------------
+void NormalizePath (std::string &name);
+std::string GetPath(std::string &fullName);
+std::string GetName(std::string &fullName);
 #endif
-
index 3732f2bd60cc31a24a23d4ea7baaa52c9ad700a4..fd4f985813e326920a978a878804bc0b1490153e 100644 (file)
@@ -1,13 +1,6 @@
 // gdcmVR.cxx
-#include <fstream>
 //-----------------------------------------------------------------------------
-#include "gdcmVR.h"
-#include "gdcmUtil.h"
-
-#ifndef PUB_DICT_PATH
-#  define PUB_DICT_PATH     "../Dicts/"
-#endif
-#define DICT_VR "dicomVR.dic"
+#include <fstream>
 
 #include <iostream>
 #ifdef GDCM_NO_ANSI_STRING_STREAM
 #  include <sstream>
 #endif
 
+#include "gdcmVR.h"
+#include "gdcmUtil.h"
+#include "gdcmDebug.h"
+
+#ifndef PUB_DICT_PATH
+#  define PUB_DICT_PATH     "../Dicts/"
+#endif
+#define DICT_VR "dicomVR.dic"
+
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 gdcmVR::gdcmVR(void) 
index 707bd8e6c410c533703931a4132123885563a30a..2afbd82e8e87745f1c6cf9abf7d2fa8e479439a3 100644 (file)
@@ -104,6 +104,10 @@ PostBuild_Cmds=copy                       ..\..\lib\gdcmdll.dll
 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
 # Begin Source File\r
 \r
+SOURCE=..\gdcmDebug.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\gdcmDicomDir.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -216,6 +220,10 @@ SOURCE=..\gdcm.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\gdcmDebug.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\gdcmCommon.h\r
 # End Source File\r
 # Begin Source File\r