]> Creatis software - gdcm.git/blob - src/gdcmGlobal.cxx
Within Print method, change the 'warning value' for Pixel Data,
[gdcm.git] / src / gdcmGlobal.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmGlobal.cxx,v $
5   Language:  C++
6   Date:      $Date: 2005/10/11 08:24:10 $
7   Version:   $Revision: 1.26 $
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 "gdcmDictGroupName.h"
25 #include "gdcmDictSet.h"
26 #include "gdcmDicomDirElement.h"
27
28 namespace gdcm 
29 {
30 //-----------------------------------------------------------------------------
31 /// \brief Those global string that are returned by reference everywhere in 
32 /// gdcm code used to be in gdcmCommon.h but due to a 'bug' in gcc/MacOSX
33 /// you cannot have static initialization in a multithreaded environment
34 /// since there is a lazy construction everything got skrew up somehow
35 /// Therefore the actual initialization is done in a cxx file (avoid
36 /// duplicated symbol), and an extern is used in gdcmCommon.h
37
38 const std::string GDCM_UNKNOWN   = "gdcm::Unknown";
39 const std::string GDCM_UNFOUND   = "gdcm::Unfound";
40 const std::string GDCM_BINLOADED = "gdcm::Binary data loaded";
41 const std::string GDCM_NOTLOADED = "gdcm::NotLoaded";
42 const std::string GDCM_UNREAD    = "gdcm::UnRead";
43 const std::string GDCM_NOTASCII  = "gdcm::NotAscii";
44 const std::string GDCM_PIXELDATA = "gdcm::Pixel Data to be loaded";
45 //-----------------------------------------------------------------------------
46 DictSet         *Global::Dicts     = (DictSet *)0;
47 VR              *Global::ValRes    = (VR *)0;
48 TS              *Global::TranSyn   = (TS *)0;
49 DictGroupName   *Global::GroupName = (DictGroupName *)0;
50 DicomDirElement *Global::ddElem    = (DicomDirElement *)0;
51
52 //-----------------------------------------------------------------------------
53 /**
54  * \brief   Global container
55  */
56 Global Glob;
57
58 //-------------------------------------------------------------------------
59 // Constructor / Destructor
60 /**
61  * \brief   constructor : populates the various H Tables
62  */
63 Global::Global()
64 {
65    if (ValRes || TranSyn || Dicts || ddElem)
66    {
67       gdcmWarningMacro( "VR or TS or Dicts already allocated");
68       return;
69    }
70    Dicts     = new DictSet();
71    ValRes    = new VR();
72    TranSyn   = new TS();
73    GroupName = new DictGroupName();
74    ddElem    = new DicomDirElement();
75 }
76
77 /**
78  * \brief   canonical destructor 
79  */
80 Global::~Global()
81 {
82    delete Dicts;
83    delete ValRes;
84    delete TranSyn;
85    delete GroupName;
86    delete ddElem;
87 }
88
89 //-----------------------------------------------------------------------------
90 // Public
91 /**
92  * \brief   returns a pointer to Dictionaries Table 
93  */
94 DictSet *Global::GetDicts()
95 {
96    return Dicts;
97 }
98
99 /**
100  * \brief   returns a pointer to the 'Value Representation Table' 
101  */
102 VR *Global::GetVR()
103 {
104    return ValRes;
105 }
106
107 /**
108  * \brief   returns a pointer to the 'Transfer Syntax Table' 
109  */
110 TS *Global::GetTS()
111 {
112    return TranSyn;
113 }
114
115 /**
116  * \brief   returns a pointer to the Group name correspondance table
117  */
118 DictGroupName *Global::GetDictGroupName()
119 {
120    return GroupName;
121 }
122
123 /**
124  * \brief   returns a pointer to the DicomDir related elements Table 
125  */
126 DicomDirElement *Global::GetDicomDirElements()
127 {
128    return ddElem;
129 }
130
131 //-----------------------------------------------------------------------------
132 // Protected
133
134 //-----------------------------------------------------------------------------
135 // Private
136
137 //-----------------------------------------------------------------------------
138 // Print
139
140 //-----------------------------------------------------------------------------
141 } // end namespace gdcm