]> Creatis software - gdcm.git/blob - src/gdcmGlobal.cxx
* src/gdcmUtil.[cxx|h] split in two. Additional file gdcmGlobal.[cxx|h]
[gdcm.git] / src / gdcmGlobal.cxx
1 // gdcmGlobal.cxx
2 //-----------------------------------------------------------------------------
3 #include "gdcmGlobal.h"
4 #include "gdcmDebug.h"
5 #include <stdio.h>
6 #include <ctype.h>   // For isspace
7 #include <string.h>  // CLEANME: could this be only string ? Related to Win32 ?
8
9 /**
10  * \ingroup Globals
11  * \brief Pointer to a container, holding _all_ the Dicom Dictionaries.
12  */
13 gdcmDictSet         *gdcmGlobal::Dicts  = (gdcmDictSet *)0;
14
15 /**
16  * \ingroup Globals
17  * \brief   Pointer to a hash table containing the 'Value Representations'.
18  */
19 gdcmVR              *gdcmGlobal::VR     = (gdcmVR *)0;
20
21 /**
22  * \ingroup Globals
23  * \brief   Pointer to a hash table containing the Transfer Syntax codes
24  *          and their english description 
25  */
26 gdcmTS              *gdcmGlobal::TS     = (gdcmTS *)0;
27
28 /**
29  * \ingroup Globals
30  * \brief   Pointer to the hash table containing the Dicom Elements
31  *          necessary to describe each part of a DICOMDIR 
32  */
33 gdcmDicomDirElement *gdcmGlobal::ddElem = (gdcmDicomDirElement *)0;
34
35 /**
36  * \ingroup Globals
37  * \brief   Global container
38  */
39 gdcmGlobal gdcmGlob;
40
41 /**
42  * \ingroup gdcmGlobal
43  * \brief   constructor : populates the various H Tables
44  */
45 gdcmGlobal::gdcmGlobal(void) {
46    if (VR || TS || Dicts || ddElem)
47       dbg.Verbose(0, "gdcmGlobal::gdcmGlobal : VR or TS or Dicts already allocated");
48    Dicts  = new gdcmDictSet();
49    VR     = new gdcmVR();
50    TS     = new gdcmTS();
51    ddElem = new gdcmDicomDirElement();
52 }
53
54 /**
55  * \ingroup gdcmGlobal
56  * \brief   canonical destructor 
57  */
58 gdcmGlobal::~gdcmGlobal() {
59    delete Dicts;
60    delete VR;
61    delete TS;
62    delete ddElem;
63 }
64 /**
65  * \ingroup gdcmGlobal
66  * \brief   returns a pointer to the 'Value Representation Table' 
67  */
68 gdcmVR *gdcmGlobal::GetVR(void) {
69    return VR;
70 }
71 /**
72  * \ingroup gdcmGlobal
73  * \brief   returns a pointer to the 'Transfert Syntax Table' 
74  */
75 gdcmTS *gdcmGlobal::GetTS(void) {
76    return TS;
77 }
78 /**
79  * \ingroup gdcmGlobal
80  * \brief   returns a pointer to Dictionaries Table 
81  */
82 gdcmDictSet *gdcmGlobal::GetDicts(void) {
83    return Dicts;
84 }
85 /**
86  * \ingroup gdcmGlobal
87  * \brief   returns a pointer to the DicomDir related elements Table 
88  */
89 gdcmDicomDirElement *gdcmGlobal::GetDicomDirElements(void) {
90    return ddElem;
91 }