00001 /*========================================================================= 00002 00003 Program: gdcm 00004 Module: $RCSfile: gdcmGlobal.cxx,v $ 00005 Language: C++ 00006 Date: $Date: 2005/02/07 14:48:34 $ 00007 Version: $Revision: 1.20 $ 00008 00009 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de 00010 l'Image). All rights reserved. See Doc/License.txt or 00011 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. 00012 00013 This software is distributed WITHOUT ANY WARRANTY; without even 00014 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00015 PURPOSE. See the above copyright notices for more information. 00016 00017 =========================================================================*/ 00018 00019 #include "gdcmGlobal.h" 00020 00021 #include "gdcmDebug.h" 00022 #include "gdcmVR.h" 00023 #include "gdcmTS.h" 00024 #include "gdcmDictSet.h" 00025 #include "gdcmDicomDirElement.h" 00026 00027 namespace gdcm 00028 { 00029 //----------------------------------------------------------------------------- 00030 // Those global string that are return by reference everywhere in gdcm code 00031 // used to be in gdcmCommon.h but due to a 'bug' in gcc/MacOSX 00032 // you cannot have static initialization in a multithreaded environment 00033 // since there is a lazy construction everything got skrew up somehow 00034 // Therefore the actual initialization is done in a cxx file (avoid 00035 // duplicated symbol), and an extern is used in gdcmCommon.h 00036 const std::string GDCM_UNKNOWN = "gdcm::Unknown"; 00037 const std::string GDCM_UNFOUND = "gdcm::Unfound"; 00038 const std::string GDCM_BINLOADED = "gdcm::Binary data loaded"; 00039 const std::string GDCM_NOTLOADED = "gdcm::NotLoaded"; 00040 const std::string GDCM_UNREAD = "gdcm::UnRead"; 00041 00042 //----------------------------------------------------------------------------- 00043 DictSet *Global::Dicts = (DictSet *)0; 00044 VR *Global::ValRes = (VR *)0; 00045 TS *Global::TranSyn = (TS *)0; 00046 DicomDirElement *Global::ddElem = (DicomDirElement *)0; 00047 00048 //----------------------------------------------------------------------------- 00052 Global Glob; 00053 00054 //------------------------------------------------------------------------- 00055 // Constructor / Destructor 00059 Global::Global() 00060 { 00061 if (ValRes || TranSyn || Dicts || ddElem) 00062 { 00063 gdcmWarningMacro( "VR or TS or Dicts already allocated"); 00064 return; 00065 } 00066 Dicts = new DictSet(); 00067 ValRes = new VR(); 00068 TranSyn = new TS(); 00069 ddElem = new DicomDirElement(); 00070 } 00071 00075 Global::~Global() 00076 { 00077 delete Dicts; 00078 delete ValRes; 00079 delete TranSyn; 00080 delete ddElem; 00081 } 00082 00083 //----------------------------------------------------------------------------- 00084 // Public 00088 DictSet *Global::GetDicts() 00089 { 00090 return Dicts; 00091 } 00092 00096 VR *Global::GetVR() 00097 { 00098 return ValRes; 00099 } 00100 00104 TS *Global::GetTS() 00105 { 00106 return TranSyn; 00107 } 00108 00112 DicomDirElement *Global::GetDicomDirElements() 00113 { 00114 return ddElem; 00115 } 00116 00117 //----------------------------------------------------------------------------- 00118 // Protected 00119 00120 //----------------------------------------------------------------------------- 00121 // Private 00122 00123 //----------------------------------------------------------------------------- 00124 // Print 00125 00126 //----------------------------------------------------------------------------- 00127 } // end namespace gdcm