]> Creatis software - gdcm.git/blob - src/gdcmGlobal.cxx
Fix mistypings
[gdcm.git] / src / gdcmGlobal.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmGlobal.cxx,v $
5   Language:  C++
6   Date:      $Date: 2007/09/17 12:20:01 $
7   Version:   $Revision: 1.37 $
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_NAME_SPACE
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";
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 const char GDCM_VRUNKNOWN[2] = {' ',' '}; // avoid useless std::string stuff
47
48 #ifdef _WIN32
49 const char GDCM_FILESEPARATOR = '\\';
50 #else
51 const char GDCM_FILESEPARATOR = '/';
52 #endif
53
54 //-----------------------------------------------------------------------------
55 DictSet         *Global::Dicts     = (DictSet *)0;
56 VR              *Global::ValRes    = (VR *)0;
57 TS              *Global::TranSyn   = (TS *)0;
58 DictGroupName   *Global::GroupName = (DictGroupName *)0;
59 DicomDirElement *Global::ddElem    = (DicomDirElement *)0;
60
61 Dict            *Global::DefaultPubDict = (Dict *)0;
62
63 //-----------------------------------------------------------------------------
64 /**
65  * \brief   Global container
66  */
67 Global Glob;
68
69 //-------------------------------------------------------------------------
70 // Constructor / Destructor
71 /**
72  * \brief   constructor : populates the various H Tables
73  */
74 Global::Global()
75 {
76    if (ValRes || TranSyn || Dicts || ddElem || GroupName )
77    {
78       gdcmStaticWarningMacro( "VR or TS or Dicts or ... already allocated");
79       return;
80    }
81    Dicts     = DictSet::New();
82    ValRes    = VR::New();
83    TranSyn   = TS::New();
84    GroupName = DictGroupName::New();
85    ddElem    = DicomDirElement::New();
86 }
87
88 /**
89  * \brief   canonical destructor 
90  */
91 Global::~Global()
92 {
93    Dicts->Delete();
94    ValRes->Delete();
95    TranSyn->Delete();
96    GroupName->Delete();
97    ddElem->Delete();
98 }
99
100 //-----------------------------------------------------------------------------
101 // Public
102
103 //-----------------------------------------------------------------------------
104 // Protected
105
106 //-----------------------------------------------------------------------------
107 // Private
108
109 //-----------------------------------------------------------------------------
110 // Print
111
112 //-----------------------------------------------------------------------------
113 } // end namespace gdcm