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