]> Creatis software - gdcm.git/blobdiff - src/gdcmGlobal.cxx
Fix mistypings
[gdcm.git] / src / gdcmGlobal.cxx
index d875390a31a8c121edd37b003aaba4f5981e43e3..7ae08b6e0a16ed5277aad44ba21e2a28c9188dcc 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmGlobal.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/12 04:35:46 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2007/09/17 12:20:01 $
+  Version:   $Revision: 1.37 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 =========================================================================*/
 
 #include "gdcmGlobal.h"
+
 #include "gdcmDebug.h"
+#include "gdcmVR.h"
+#include "gdcmTS.h"
+#include "gdcmDictGroupName.h"
+#include "gdcmDictSet.h"
+#include "gdcmDicomDirElement.h"
 
-namespace gdcm 
+namespace  GDCM_NAME_SPACE
 {
+//-----------------------------------------------------------------------------
+/// \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 a container, holding _all_ the Dicom Dictionaries.
- */
-DictSet         *Global::Dicts  = (DictSet *)0;
+const std::string GDCM_UNKNOWN   = "GDCM::Unknown";
+const std::string GDCM_UNFOUND   = "GDCM::Unfound";
+const std::string GDCM_BINLOADED = "GDCM::Binary data";
+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";
 
-/**
- * \ingroup Globals
- * \brief   Pointer to a hash table containing the 'Value Representations'.
- */
-VR              *Global::ValRes     = (VR *)0;
+const char GDCM_VRUNKNOWN[2] = {' ',' '}; // avoid useless std::string stuff
 
-/**
- * \ingroup Globals
- * \brief   Pointer to a hash table containing the Transfer Syntax codes
- *          and their english description 
- */
-TS              *Global::TranSyn     = (TS *)0;
+#ifdef _WIN32
+const char GDCM_FILESEPARATOR = '\\';
+#else
+const char GDCM_FILESEPARATOR = '/';
+#endif
 
-/**
- * \ingroup Globals
- * \brief   Pointer to the hash table containing the Dicom Elements
- *          necessary to describe each part of a DICOMDIR 
- */
-DicomDirElement *Global::ddElem = (DicomDirElement *)0;
+//-----------------------------------------------------------------------------
+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;
+
+Dict            *Global::DefaultPubDict = (Dict *)0;
 
+//-----------------------------------------------------------------------------
 /**
- * \ingroup Globals
  * \brief   Global container
  */
 Global Glob;
 
+//-------------------------------------------------------------------------
+// Constructor / Destructor
 /**
- * \ingroup Global
  * \brief   constructor : populates the various H Tables
  */
 Global::Global()
 {
-   if (ValRes || TranSyn || Dicts || ddElem)
+   if (ValRes || TranSyn || Dicts || ddElem || GroupName )
    {
-      dbg.Verbose(0, "Global::Global : VR or TS or Dicts already allocated");
+      gdcmStaticWarningMacro( "VR or TS or Dicts or ... already allocated");
+      return;
    }
-   Dicts   = new DictSet();
-   ValRes  = new VR();
-   TranSyn = new TS();
-   ddElem  = new DicomDirElement();
+   Dicts     = DictSet::New();
+   ValRes    = VR::New();
+   TranSyn   = TS::New();
+   GroupName = DictGroupName::New();
+   ddElem    = DicomDirElement::New();
 }
 
 /**
- * \ingroup Global
  * \brief   canonical destructor 
  */
 Global::~Global()
 {
-   delete Dicts;
-   delete ValRes;
-   delete TranSyn;
-   delete ddElem;
-}
-/**
- * \ingroup Global
- * \brief   returns a pointer to the 'Value Representation Table' 
- */
-VR *Global::GetVR()
-{
-   return ValRes;
-}
-/**
- * \ingroup Global
- * \brief   returns a pointer to the 'Transfert Syntax Table' 
- */
-TS *Global::GetTS()
-{
-   return TranSyn;
-}
-/**
- * \ingroup Global
- * \brief   returns a pointer to Dictionaries Table 
- */
-DictSet *Global::GetDicts()
-{
-   return Dicts;
-}
-/**
- * \ingroup Global
- * \brief   returns a pointer to the DicomDir related elements Table 
- */
-DicomDirElement *Global::GetDicomDirElements()
-{
-   return ddElem;
+   Dicts->Delete();
+   ValRes->Delete();
+   TranSyn->Delete();
+   GroupName->Delete();
+   ddElem->Delete();
 }
+
+//-----------------------------------------------------------------------------
+// Public
+
+//-----------------------------------------------------------------------------
+// Protected
+
+//-----------------------------------------------------------------------------
+// Private
+
+//-----------------------------------------------------------------------------
+// Print
+
+//-----------------------------------------------------------------------------
 } // end namespace gdcm