]> Creatis software - gdcm.git/blob - src/gdcmGlobal.cxx
Typo, comments, doxygenation
[gdcm.git] / src / gdcmGlobal.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmGlobal.cxx,v $
5   Language:  C++
6   Date:      $Date: 2005/02/11 15:22:18 $
7   Version:   $Revision: 1.21 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18
19 #include "gdcmGlobal.h"
20
21 #include "gdcmDebug.h"
22 #include "gdcmVR.h"
23 #include "gdcmTS.h"
24 #include "gdcmDictSet.h"
25 #include "gdcmDicomDirElement.h"
26
27 namespace gdcm 
28 {
29 //-----------------------------------------------------------------------------
30 /// \brief Those global string that are return by reference everywhere in 
31 /// gdcm code used to be in gdcmCommon.h but due to a 'bug' in gcc/MacOSX
32 /// you cannot have static initialization in a multithreaded environment
33 /// since there is a lazy construction everything got skrew up somehow
34 /// Therefore the actual initialization is done in a cxx file (avoid
35 /// duplicated symbol), and an extern is used in gdcmCommon.h
36 const std::string GDCM_UNKNOWN   = "gdcm::Unknown";
37 const std::string GDCM_UNFOUND   = "gdcm::Unfound";
38 const std::string GDCM_BINLOADED = "gdcm::Binary data loaded";
39 const std::string GDCM_NOTLOADED = "gdcm::NotLoaded";
40 const std::string GDCM_UNREAD    = "gdcm::UnRead";
41
42 //-----------------------------------------------------------------------------
43 DictSet         *Global::Dicts   = (DictSet *)0;
44 VR              *Global::ValRes  = (VR *)0;
45 TS              *Global::TranSyn = (TS *)0;
46 DicomDirElement *Global::ddElem  = (DicomDirElement *)0;
47
48 //-----------------------------------------------------------------------------
49 /**
50  * \brief   Global container
51  */
52 Global Glob;
53
54 //-------------------------------------------------------------------------
55 // Constructor / Destructor
56 /**
57  * \brief   constructor : populates the various H Tables
58  */
59 Global::Global()
60 {
61    if (ValRes || TranSyn || Dicts || ddElem)
62    {
63       gdcmWarningMacro( "VR or TS or Dicts already allocated");
64       return;
65    }
66    Dicts   = new DictSet();
67    ValRes  = new VR();
68    TranSyn = new TS();
69    ddElem  = new DicomDirElement();
70 }
71
72 /**
73  * \brief   canonical destructor 
74  */
75 Global::~Global()
76 {
77    delete Dicts;
78    delete ValRes;
79    delete TranSyn;
80    delete ddElem;
81 }
82
83 //-----------------------------------------------------------------------------
84 // Public
85 /**
86  * \brief   returns a pointer to Dictionaries Table 
87  */
88 DictSet *Global::GetDicts()
89 {
90    return Dicts;
91 }
92
93 /**
94  * \brief   returns a pointer to the 'Value Representation Table' 
95  */
96 VR *Global::GetVR()
97 {
98    return ValRes;
99 }
100
101 /**
102  * \brief   returns a pointer to the 'Transfer Syntax Table' 
103  */
104 TS *Global::GetTS()
105 {
106    return TranSyn;
107 }
108
109 /**
110  * \brief   returns a pointer to the DicomDir related elements Table 
111  */
112 DicomDirElement *Global::GetDicomDirElements()
113 {
114    return ddElem;
115 }
116
117 //-----------------------------------------------------------------------------
118 // Protected
119
120 //-----------------------------------------------------------------------------
121 // Private
122
123 //-----------------------------------------------------------------------------
124 // Print
125
126 //-----------------------------------------------------------------------------
127 } // end namespace gdcm