]> Creatis software - gdcm.git/blob - src/gdcmUtil.h
doxygenation
[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   /**
31     * \ingroup gdcmDebug
32     * \brief   sets the debug level 
33     * @param i debug level to be set
34   */ 
35    void SetDebug (int i) 
36       {DebugLevel = i;}
37
38    void Verbose(int, const char*, const char* ="");
39    void Error(bool, const char*,  const char* ="");
40    void Error(const char*, const char* ="", const char* ="");
41
42    void Assert(int, bool, const char*, const char*);
43    void Exit(int);
44
45 private:
46 /// warning message level to be displayed
47    int DebugLevel;
48 };
49
50 //-----------------------------------------------------------------------------
51 /*
52  * This class contains all globals elements that might be
53  * instanciated only one time
54  */
55 class GDCM_EXPORT gdcmGlobal {
56 public:
57    gdcmGlobal(void);
58    ~gdcmGlobal();
59
60    static gdcmDictSet *GetDicts(void);
61    static gdcmVR *GetVR(void);
62    static gdcmTS *GetTS(void);
63    static gdcmDicomDirElement *GetDicomDirElements(void);
64
65 private:
66    static gdcmDictSet *Dicts; 
67    static gdcmVR *VR;
68    static gdcmTS *TS; 
69    static gdcmDicomDirElement *ddElem;
70 };
71
72 //-----------------------------------------------------------------------------
73 std::istream & eatwhite(std::istream & is);
74
75    void Tokenize (const std::string& str,
76                   std::vector<std::string>& tokens,
77                   const std::string& delimiters = " ");
78
79    extern gdcmDebug dbg;
80
81    char *_cleanString(char *v);
82    std::string _CreateCleanString(std::string s);
83
84    void NormalizePath (std::string &name);
85    std::string GetPath(std::string &fullName);
86    std::string GetName(std::string &fullName);
87 //-----------------------------------------------------------------------------
88 #endif
89