]> Creatis software - gdcm.git/blob - src/gdcmUtil.h
* ENH = set a debug macro
[gdcm.git] / src / gdcmUtil.h
1 // gdcmUtil.h
2 //-----------------------------------------------------------------------------
3 #ifndef GDCMUTIL_H
4 #define GDCMUTIL_H
5
6 #include "gdcmCommon.h"
7 #include "gdcmVR.h"
8 #include "gdcmTS.h"
9 #include "gdcmDictSet.h"
10 #include "gdcmDicomDirElement.h"
11 #include <iostream>
12 #include <vector>
13 #include <string>
14
15 //-----------------------------------------------------------------------------
16 /*
17  * gdcmDebug is an object for debugging in program.
18  * It has 2 debugging modes :
19  *  - error : for bad library use
20  *  - debug : for debugging messages
21  * 
22  * A debugging message has a level of priority and is 
23  * Shown only when the debug level is higher than the 
24  * message level.
25  */
26 class gdcmDebug {
27 public:
28         gdcmDebug(int level = GDCM_DEBUG);
29
30         void SetDebug (int i) {DebugLevel = i;}
31
32    void Verbose(int, const char*, const char* ="");
33         void Error(bool, const char*,  const char* ="");
34         void Error(const char*, const char* ="", const char* ="");
35
36         void Assert(int, bool, const char*, const char*);
37         void Exit(int);
38
39 private:
40         int DebugLevel;
41 };
42
43 //-----------------------------------------------------------------------------
44 /*
45  * This class contains all globals elements that might be
46  * instanciated only one time
47  */
48 class GDCM_EXPORT gdcmGlobal {
49 public:
50    gdcmGlobal(void);
51    ~gdcmGlobal();
52
53    static gdcmDictSet *GetDicts(void);
54    static gdcmVR *GetVR(void);
55    static gdcmTS *GetTS(void);
56    static gdcmDicomDirElement *GetDicomDirElements(void);
57
58 private:
59    static gdcmDictSet *Dicts; 
60    static gdcmVR *VR;
61    static gdcmTS *TS; 
62    static gdcmDicomDirElement *ddElem;
63 };
64
65 //-----------------------------------------------------------------------------
66 std::istream & eatwhite(std::istream & is);
67
68 void Tokenize (const std::string& str,
69                std::vector<std::string>& tokens,
70                const std::string& delimiters = " ");
71
72 extern gdcmDebug dbg;
73
74 char *_cleanString(char *v);
75 std::string _CreateCleanString(std::string s);
76
77 //-----------------------------------------------------------------------------
78 #endif
79