From 8a640d0e343dc47346cc7a72cd76582b9b429610 Mon Sep 17 00:00:00 2001 From: regrain Date: Mon, 19 Jul 2004 11:51:25 +0000 Subject: [PATCH] * src/gdcmCommon.h, gdcmDict.cxx, gdcmTS.cxx : bug fix for msvc6 compilation * src/gdcmDebug.[h|cxx] : bug fix for msvc6 compilation. Replace the dbg variable (instance of gdcmDebug) by a definition macro, and the instance is now in static in the gdcmDebug class * src/gdcmSQItem.h : (FIXME) remove an undefined method * Test/PrintAllDocument.cxx : bug fix in the result of the test -- BeNours --- ChangeLog | 10 +++++++++- src/gdcmCommon.h | 8 +++++--- src/gdcmDebug.cxx | 45 ++++++++++++++++++++++++++++++--------------- src/gdcmDebug.h | 20 +++++++++++++++----- src/gdcmDict.cxx | 6 +++--- src/gdcmSQItem.h | 7 ++++--- src/gdcmTS.cxx | 6 +++--- 7 files changed, 69 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7fb87396..e11f623c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-07-19 Benoit Regrain + * src/gdcmCommon.h, gdcmDict.cxx, gdcmTS.cxx : bug fix for msvc6 compilation + * src/gdcmDebug.[h|cxx] : bug fix for msvc6 compilation. Replace the dbg + variable (instance of gdcmDebug) by a definition macro, and the instance + is now in static in the gdcmDebug class + * src/gdcmSQItem.h : (FIXME) remove an undefined method + * Test/PrintAllDocument.cxx : bug fix in the result of the test + 2004-07-06 Eric Boix * WARNING: ctest now depends more tightly on gdcmData. You should check out gdcmData properly for things to run smoothly... @@ -472,7 +480,7 @@ WARNING : save your own sources *before* cvs up ! * .... alas, the python testSuite is still broken. 2004-05-18 Benoit Regrain - * gdcmPython/gdcm.i : remove useless lines concerning the gdcmGlobal + * gdcmPython/gdcm.i : remove useless lines concerning the gdcmGlobal gdcmGlob * gdcmPython/setup.py : replace the use of cvar.gdcmGlob to gdcmGlobal * src/gdcmUtil.h : export methods diff --git a/src/gdcmCommon.h b/src/gdcmCommon.h index 384aa738..89e76f67 100644 --- a/src/gdcmCommon.h +++ b/src/gdcmCommon.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmCommon.h,v $ Language: C++ - Date: $Date: 2004/07/02 13:55:27 $ - Version: $Revision: 1.28 $ + Date: $Date: 2004/07/19 11:51:26 $ + Version: $Revision: 1.29 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -47,8 +47,9 @@ //----------------------------------------------------------------------------- #ifdef __GNUC__ #ifndef HAVE_NO_STDINT_H -#include // For uint16_t and uint32_t +#include // For uint8_t uint16_t and uint32_t #else +typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #define UINT32_MAX (4294967295U) @@ -56,6 +57,7 @@ typedef unsigned int uint32_t; #endif #ifdef _MSC_VER +typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #define UINT32_MAX (4294967295U) diff --git a/src/gdcmDebug.cxx b/src/gdcmDebug.cxx index 6868b8a4..e9881105 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/06/20 18:08:47 $ - Version: $Revision: 1.2 $ + Date: $Date: 2004/07/19 11:51:26 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -19,17 +19,16 @@ #include #include "gdcmDebug.h" -/** - * \ingroup Globals - * \brief Instance of debugging utility. - */ -gdcmDebug dbg; +//----------------------------------------------------------------------------- +gdcmDebug gdcmDebug::debug; +//----------------------------------------------------------------------------- /** * \brief constructor * @param level debug level */ -gdcmDebug::gdcmDebug(int level) { +gdcmDebug::gdcmDebug(int level) +{ DebugLevel = level; } @@ -37,7 +36,8 @@ gdcmDebug::gdcmDebug(int level) { * \brief Accessor * @param level Set the debug level */ -void gdcmDebug::SetDebug(int level) { +void gdcmDebug::SetDebug(int level) +{ DebugLevel = level; } @@ -47,7 +47,8 @@ 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 gdcmDebug::Verbose(int Level, const char * Msg1, const char * Msg2) +{ if (Level > DebugLevel) return ; std::cerr << Msg1 << ' ' << Msg2 << std::endl; @@ -59,7 +60,8 @@ 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 gdcmDebug::Error( bool Test, const char * Msg1, const char * Msg2) +{ if (!Test) return; std::cerr << Msg1 << ' ' << Msg2 << std::endl; @@ -73,7 +75,8 @@ void gdcmDebug::Error( bool Test, const char * Msg1, const char * Msg2) { * @param Msg3 Third message part */ void gdcmDebug::Error(const char* Msg1, const char* Msg2, - const char* Msg3) { + const char* Msg3) +{ std::cerr << Msg1 << ' ' << Msg2 << ' ' << Msg3 << std::endl; Exit(1); } @@ -85,8 +88,9 @@ 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 gdcmDebug::Assert(int Level, bool Test, + const char * Msg1, const char * Msg2) +{ if (Level > DebugLevel) return ; if (!Test) @@ -97,7 +101,8 @@ void gdcmDebug::Error(const char* Msg1, const char* Msg2, * \brief Exit * @param a return code */ -void gdcmDebug::Exit(int a) { +void gdcmDebug::Exit(int a) +{ #ifdef __GNUC__ std::exit(a); #endif @@ -105,3 +110,13 @@ void gdcmDebug::Exit(int a) { exit(a); // Found in #include #endif } + +/** + * \brief Get the debug instance + * \return Reference to the debug instance + */ +gdcmDebug &gdcmDebug::GetReference() +{ + return gdcmDebug::debug; +} + diff --git a/src/gdcmDebug.h b/src/gdcmDebug.h index e1e8fde9..a689936f 100644 --- a/src/gdcmDebug.h +++ b/src/gdcmDebug.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDebug.h,v $ Language: C++ - Date: $Date: 2004/06/20 18:08:47 $ - Version: $Revision: 1.3 $ + Date: $Date: 2004/07/19 11:51:26 $ + Version: $Revision: 1.4 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -19,6 +19,13 @@ #ifndef GDCMDEBUG_H #define GDCMDEBUG_H +#include "gdcmCommon.h" + +//----------------------------------------------------------------------------- +#define dbg gdcmDebug::GetReference() + +//----------------------------------------------------------------------------- + /** * \ingroup gdcmDebug * \brief gdcmDebug is an object for debugging in program. @@ -30,7 +37,7 @@ * Shown only when the debug level is higher than the * message level. */ -class gdcmDebug { +class GDCM_EXPORT gdcmDebug { public: gdcmDebug(int level = -1); @@ -42,11 +49,14 @@ public: void Assert(int, bool, const char*, const char*); void Exit(int); + static gdcmDebug &GetReference(); + private: /// warning message level to be displayed int DebugLevel; -}; -extern gdcmDebug dbg; +/// Instance of debugging utility. + static gdcmDebug debug; +}; #endif diff --git a/src/gdcmDict.cxx b/src/gdcmDict.cxx index 6b2efbec..cb0191be 100644 --- a/src/gdcmDict.cxx +++ b/src/gdcmDict.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDict.cxx,v $ Language: C++ - Date: $Date: 2004/07/02 13:55:27 $ - Version: $Revision: 1.38 $ + Date: $Date: 2004/07/19 11:51:26 $ + Version: $Revision: 1.39 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -49,7 +49,7 @@ gdcmDict::gdcmDict(std::string & FileName) { from >> vr; from >> fourth; eatwhite(from); - getline(from, name); /// MEMORY LEAK in std::getline<> + std::getline(from, name); /// MEMORY LEAK in std::getline<> gdcmDictEntry * newEntry = new gdcmDictEntry(group, element, vr, fourth, name); diff --git a/src/gdcmSQItem.h b/src/gdcmSQItem.h index ee4cd01f..fe7f7938 100644 --- a/src/gdcmSQItem.h +++ b/src/gdcmSQItem.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSQItem.h,v $ Language: C++ - Date: $Date: 2004/07/02 13:55:28 $ - Version: $Revision: 1.11 $ + Date: $Date: 2004/07/19 11:51:26 $ + Version: $Revision: 1.12 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -48,7 +48,8 @@ public: virtual bool AddEntry(gdcmDocEntry *Entry); // add to the List gdcmDocEntry *GetDocEntryByNumber(uint16_t group, uint16_t element); - gdcmDocEntry *GetDocEntryByName (std::string Name); + // FIXME method to write + //gdcmDocEntry *GetDocEntryByName (std::string Name); bool SetEntryByNumber(std::string val, uint16_t group, uint16_t element); diff --git a/src/gdcmTS.cxx b/src/gdcmTS.cxx index 630ed7c6..a1c83a8b 100644 --- a/src/gdcmTS.cxx +++ b/src/gdcmTS.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmTS.cxx,v $ Language: C++ - Date: $Date: 2004/06/23 03:36:24 $ - Version: $Revision: 1.21 $ + Date: $Date: 2004/07/19 11:51:26 $ + Version: $Revision: 1.22 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -43,7 +43,7 @@ gdcmTS::gdcmTS(void) from >> key; eatwhite(from); - getline(from, name); /// MEMORY LEAK + std::getline(from, name); /// MEMORY LEAK if(key!="") { -- 2.48.1