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