1 // $Header: /cvs/public/gdcm/src/gdcmUtil.cxx,v 1.11 2003/05/21 16:26:28 regrain Exp $
3 #include <ctype.h> // For isspace
10 gdcmDebug::gdcmDebug(int level) {
14 void gdcmDebug::Verbose(int Level, const char * Msg1, const char * Msg2) {
15 if (Level > DebugLevel)
17 cerr << Msg1 << ' ' << Msg2 << '\n';
20 void gdcmDebug::Assert(int Level, bool Test,
21 const char * Msg1, const char * Msg2) {
22 if (Level > DebugLevel)
25 cerr << Msg1 << ' ' << Msg2 << '\n';
28 void gdcmDebug::Error( bool Test, const char * Msg1, const char * Msg2) {
31 std::cerr << Msg1 << ' ' << Msg2 << '\n';
35 void gdcmDebug::Error(const char* Msg1, const char* Msg2,
37 std::cerr << Msg1 << ' ' << Msg2 << ' ' << Msg3 << '\n';
41 void gdcmDebug::Exit(int a) {
46 exit(a); // Found in #include <stdlib.h>
50 ///////////////////////////////////////////////////////////////////////////
51 gdcmVR * gdcmGlobal::VR = (gdcmVR*)0;
52 gdcmDictSet * gdcmGlobal::Dicts = (gdcmDictSet*)0;
55 gdcmGlobal::gdcmGlobal(void) {
57 dbg.Verbose(0, "gdcmGlobal::gdcmGlobal: VR or Dicts allready allocated");
59 Dicts = new gdcmDictSet();
62 gdcmGlobal::~gdcmGlobal() {
67 gdcmVR * gdcmGlobal::GetVR(void) {
71 gdcmDictSet * gdcmGlobal::GetDicts(void) {
75 ///////////////////////////////////////////////////////////////////////////
76 // Because is not yet available in g++2.96
77 istream& eatwhite(istream& is) {
88 void Tokenize (const string& str,
89 vector<string>& tokens,
90 const string& delimiters) {
91 string::size_type lastPos = str.find_first_not_of(delimiters,0);
92 string::size_type pos = str.find_first_of(delimiters,lastPos);
93 while (string::npos != pos || string::npos != lastPos) {
94 tokens.push_back(str.substr(lastPos, pos - lastPos));
95 lastPos = str.find_first_not_of(delimiters, pos);
96 pos = str.find_first_of(delimiters, lastPos);