]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDirElement.cxx
Solve pb when structure (list, map, ...) is empty.
[gdcm.git] / src / gdcmDicomDirElement.cxx
index 65c05e51bb310f54670e428f642a84bc30cd3b7f..b393d5dd00b93fe579af715a671b646f36e63b2b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirElement.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/11/03 18:08:56 $
-  Version:   $Revision: 1.21 $
+  Date:      $Date: 2005/01/18 07:53:42 $
+  Version:   $Revision: 1.27 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -40,9 +40,7 @@ DicomDirElement::DicomDirElement()
    std::ifstream from(filename.c_str());
    if(!from)
    {
-      dbg.Verbose(2, 
-         "DicomDirElement::DicomDirElement: can't open dictionary", 
-            filename.c_str());
+      gdcmVerboseMacro( "Can't open dictionary" << filename.c_str());
       FillDefaultDIRDict( this );
    }
    else
@@ -57,9 +55,9 @@ DicomDirElement::DicomDirElement()
          from.getline(buff, 1024, ' ');
          type = buff;
 
-         if( (type=="metaElem")  || (type=="patientElem") || 
-             (type=="studyElem") || (type=="serieElem")   || 
-             (type=="imageElem") )
+         if( type == "metaElem"  || type == "patientElem" || 
+             type == "studyElem" || type == "serieElem"   || 
+             type == "imageElem" )
          {
             from >> std::hex >> elem.Group >> elem.Elem;
 
@@ -68,23 +66,16 @@ DicomDirElement::DicomDirElement()
             from >> std::ws;
             from.getline(buff, 1024, '"');
             elem.Value = buff;
-         
+
             AddNewEntry(type, elem);
          }
-         else
-         {
-            dbg.Error("DicomDirElement::DicomDirElement: Error parsing file",
-                      filename.c_str());
-            dbg.Error("Type", type.c_str(), " is not registered as valid" );
-         }
          from.getline(buff, 1024, '\n');
       }
-   from.close();
+      from.close();
    }
 }
 
 /**
- * \ingroup DicomDirElement
  * \brief   canonical destructor 
  */
 DicomDirElement::~DicomDirElement()
@@ -99,7 +90,6 @@ DicomDirElement::~DicomDirElement()
 //-----------------------------------------------------------------------------
 // Print
 /**
- * \ingroup DicomDirElement
  * \brief   Print all
  * \todo add a 'Print Level' check 
  * @param   os The output stream to be written to.
@@ -152,8 +142,13 @@ void DicomDirElement::Print(std::ostream &os)
 //-----------------------------------------------------------------------------
 // Public
 
-bool DicomDirElement::AddNewEntry(std::string const & type, 
-                                  Element const & elem)
+/**
+ * \brief AddNewEntry 
+ * @param  type type
+ * @param elem elem
+ */
+bool DicomDirElement::AddNewEntry(std::string const &type, 
+                                  Element const &elem)
 {
    if( type == "metaElem" )
    {