#include <string>
#include <iostream>
-#include <stddef.h> // For size_t
+#include <stddef.h> // For size_t
#include <glib.h>
-#include <stdio.h>
+#include <stdio.h> // CLEANME
+#include <map> // The requirement for the hash table (or map) that
+ // we shall use:
+ // 1/ First, next, last (iterators)
+ // 2/ should be sortable (i.e. sorted by TagKey). This
+ // condition shall be droped since the Win32/VC++
+ // implementation doesn't look a sorted one. Pffff....
+ // 3/ Make sure we can setup some default size value,
+ // which should be around 4500 entries which is the
+ // average dictionary size (said JPR)
-
-// The requirement for the hash table (or map) that we shall use:
-// 1/ First, next, last (iterators)
-// 2/ should be sortable (i.e. sorted by TagKey). This condition
-// shall be droped since the Win32/VC++ implementation doesn't look
-// a sorted one. Pffff....
-// 3/ Make sure we can setup some default size value, which should be
-// around 4500 entries which is the average dictionary size (said JPR)
-#include <map>
-using namespace std;
+#ifdef _MSC_VR
+ using namespace std; // string type lives in the std namespace on VC++
+#endif
+#ifdef _MSC_VR
#define GDCM_EXPORT __declspec( dllexport )
+#else
+#define GDCM_EXPORT
+#endif
+
// 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
void gdcmDictSet::SetDictPath(void) {
const char* EnvPath = (char*)0;
EnvPath = getenv("GDCM_DICT_PATH");
- if (EnvPath && (strlen(EnvPath) != 0))
+ if (EnvPath && (strlen(EnvPath) != 0)) {
DictPath = EnvPath;
- else
+ if (DictPath[DictPath.length() -1] != '/' )
+ DictPath += '/';
+ dbg.Verbose(1, "gdcmDictSet::SetDictPath:",
+ "Dictionary path set from environnement");
+ } else
DictPath = PUB_DICT_PATH;
}
int gdcmDictSet::LoadDictFromFile(string FileName, DictKey Name) {
gdcmDict *NewDict = new gdcmDict(FileName.c_str());
dicts[Name] = NewDict;
- return 0;
+ return 0; //FIXME if this is a dummy return make the method void
}
void gdcmDictSet::Print(ostream& os) {
entCur = deb + 128;
if(memcmp(entCur, "DICM", (size_t)4) == 0) {
filetype = TrueDicom;
- dbg.Verbose(0, "gdcmHeader::CheckSwap:", "looks like DICOM Version3");
+ dbg.Verbose(1, "gdcmHeader::CheckSwap:", "looks like DICOM Version3");
} else {
filetype = Unknown;
- dbg.Verbose(0, "gdcmHeader::CheckSwap:", "not a DICOM Version3 file");
+ dbg.Verbose(1, "gdcmHeader::CheckSwap:", "not a DICOM Version3 file");
}
if(filetype == TrueDicom) {
if (!Test)
return;
std::cerr << Msg1 << ' ' << Msg2 << '\n';
- exit(1);
+ Exit(1);
}
void gdcmDebug::Error(const char* Msg1, const char* Msg2,
const char* Msg3) {
std::cerr << Msg1 << ' ' << Msg2 << ' ' << Msg3 << '\n';
- exit(1);
+ Exit(1);
+}
+
+void gdcmDebug::Exit(int a) {
+#ifdef __GNUC__
+ std::exit(a);
+#endif
+#ifdef _MSC_VER
+ exit(a); // Found in #include <stdlib.h>
+#endif
}
gdcmDebug dbg;
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);
};
istream & eatwhite(istream & is);