X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmGlobal.cxx;h=c9ccd9d984fb182f8aeaa6ca1f78a058742a3fab;hb=21d241b3fdcf675d8d91a6daf6dfd6f448b68195;hp=7be5abe6d0ab6225952ebad9e4bb199e499be7ae;hpb=1bc5ccd72098866fc29ca8a786e8bb6852f388ea;p=gdcm.git diff --git a/src/gdcmGlobal.cxx b/src/gdcmGlobal.cxx index 7be5abe6..c9ccd9d9 100644 --- a/src/gdcmGlobal.cxx +++ b/src/gdcmGlobal.cxx @@ -1,91 +1,141 @@ -// gdcmGlobal.cxx -//----------------------------------------------------------------------------- -#include "gdcmGlobal.h" -#include "gdcmDebug.h" -#include -#include // For isspace -#include // CLEANME: could this be only string ? Related to Win32 ? +/*========================================================================= + + Program: gdcm + Module: $RCSfile: gdcmGlobal.cxx,v $ + Language: C++ + Date: $Date: 2005/10/11 08:24:10 $ + Version: $Revision: 1.26 $ + + Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de + l'Image). All rights reserved. See Doc/License.txt or + http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ -/** - * \ingroup Globals - * \brief Pointer to a container, holding _all_ the Dicom Dictionaries. - */ -gdcmDictSet *gdcmGlobal::Dicts = (gdcmDictSet *)0; +#include "gdcmGlobal.h" -/** - * \ingroup Globals - * \brief Pointer to a hash table containing the 'Value Representations'. - */ -gdcmVR *gdcmGlobal::VR = (gdcmVR *)0; +#include "gdcmDebug.h" +#include "gdcmVR.h" +#include "gdcmTS.h" +#include "gdcmDictGroupName.h" +#include "gdcmDictSet.h" +#include "gdcmDicomDirElement.h" -/** - * \ingroup Globals - * \brief Pointer to a hash table containing the Transfer Syntax codes - * and their english description - */ -gdcmTS *gdcmGlobal::TS = (gdcmTS *)0; +namespace gdcm +{ +//----------------------------------------------------------------------------- +/// \brief Those global string that are returned by reference everywhere in +/// gdcm code used to be in gdcmCommon.h but due to a 'bug' in gcc/MacOSX +/// you cannot have static initialization in a multithreaded environment +/// since there is a lazy construction everything got skrew up somehow +/// Therefore the actual initialization is done in a cxx file (avoid +/// duplicated symbol), and an extern is used in gdcmCommon.h -/** - * \ingroup Globals - * \brief Pointer to the hash table containing the Dicom Elements - * necessary to describe each part of a DICOMDIR - */ -gdcmDicomDirElement *gdcmGlobal::ddElem = (gdcmDicomDirElement *)0; +const std::string GDCM_UNKNOWN = "gdcm::Unknown"; +const std::string GDCM_UNFOUND = "gdcm::Unfound"; +const std::string GDCM_BINLOADED = "gdcm::Binary data loaded"; +const std::string GDCM_NOTLOADED = "gdcm::NotLoaded"; +const std::string GDCM_UNREAD = "gdcm::UnRead"; +const std::string GDCM_NOTASCII = "gdcm::NotAscii"; +const std::string GDCM_PIXELDATA = "gdcm::Pixel Data to be loaded"; +//----------------------------------------------------------------------------- +DictSet *Global::Dicts = (DictSet *)0; +VR *Global::ValRes = (VR *)0; +TS *Global::TranSyn = (TS *)0; +DictGroupName *Global::GroupName = (DictGroupName *)0; +DicomDirElement *Global::ddElem = (DicomDirElement *)0; +//----------------------------------------------------------------------------- /** - * \ingroup Globals * \brief Global container */ -gdcmGlobal gdcmGlob; +Global Glob; +//------------------------------------------------------------------------- +// Constructor / Destructor /** - * \ingroup gdcmGlobal * \brief constructor : populates the various H Tables */ -gdcmGlobal::gdcmGlobal(void) { - if (VR || TS || Dicts || ddElem) - dbg.Verbose(0, "gdcmGlobal::gdcmGlobal : VR or TS or Dicts already allocated"); - Dicts = new gdcmDictSet(); - VR = new gdcmVR(); - TS = new gdcmTS(); - ddElem = new gdcmDicomDirElement(); +Global::Global() +{ + if (ValRes || TranSyn || Dicts || ddElem) + { + gdcmWarningMacro( "VR or TS or Dicts already allocated"); + return; + } + Dicts = new DictSet(); + ValRes = new VR(); + TranSyn = new TS(); + GroupName = new DictGroupName(); + ddElem = new DicomDirElement(); } /** - * \ingroup gdcmGlobal * \brief canonical destructor */ -gdcmGlobal::~gdcmGlobal() { +Global::~Global() +{ delete Dicts; - delete VR; - delete TS; + delete ValRes; + delete TranSyn; + delete GroupName; delete ddElem; } + +//----------------------------------------------------------------------------- +// Public +/** + * \brief returns a pointer to Dictionaries Table + */ +DictSet *Global::GetDicts() +{ + return Dicts; +} + /** - * \ingroup gdcmGlobal * \brief returns a pointer to the 'Value Representation Table' */ -gdcmVR *gdcmGlobal::GetVR(void) { - return VR; +VR *Global::GetVR() +{ + return ValRes; } + /** - * \ingroup gdcmGlobal - * \brief returns a pointer to the 'Transfert Syntax Table' + * \brief returns a pointer to the 'Transfer Syntax Table' */ -gdcmTS *gdcmGlobal::GetTS(void) { - return TS; +TS *Global::GetTS() +{ + return TranSyn; } + /** - * \ingroup gdcmGlobal - * \brief returns a pointer to Dictionaries Table + * \brief returns a pointer to the Group name correspondance table */ -gdcmDictSet *gdcmGlobal::GetDicts(void) { - return Dicts; +DictGroupName *Global::GetDictGroupName() +{ + return GroupName; } + /** - * \ingroup gdcmGlobal * \brief returns a pointer to the DicomDir related elements Table */ -gdcmDicomDirElement *gdcmGlobal::GetDicomDirElements(void) { +DicomDirElement *Global::GetDicomDirElements() +{ return ddElem; } + +//----------------------------------------------------------------------------- +// Protected + +//----------------------------------------------------------------------------- +// Private + +//----------------------------------------------------------------------------- +// Print + +//----------------------------------------------------------------------------- +} // end namespace gdcm