]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDirSerie.cxx
* src/gdcmDocument.cxx : bug fix on potential memory leak
[gdcm.git] / src / gdcmDicomDirSerie.cxx
index 5b0b3179cea36d1ee4c1b03337f472c03f83be60..a03c64800f76bcff2b74821fc417933e0c82ff8e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirSerie.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/23 10:12:33 $
-  Version:   $Revision: 1.33 $
+  Date:      $Date: 2005/01/25 11:11:58 $
+  Version:   $Revision: 1.34 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -46,12 +46,7 @@ DicomDirSerie::DicomDirSerie(bool empty):
  */
 DicomDirSerie::~DicomDirSerie() 
 {
-   for(ListDicomDirImage::iterator cc = Images.begin();
-                                   cc != Images.end();
-                                   ++cc)
-   {
-      delete *cc;
-   }
+   ClearImage();
 }
 
 //-----------------------------------------------------------------------------
@@ -95,7 +90,8 @@ void DicomDirSerie::WriteContent(std::ofstream *fp, FileType t)
 }
 
 /**
- * \brief   adds a new Image (with the basic elements) to a partially created DICOMDIR
+ * \brief   adds a new Image (with the basic elements) to a partially created 
+ *          DICOMDIR
  */
 DicomDirImage *DicomDirSerie::NewImage()
 {
@@ -104,6 +100,20 @@ DicomDirImage *DicomDirSerie::NewImage()
    return st;   
 }
 
+/**
+ * \brief  Remove all images in the serie 
+ */
+void DicomDirSerie::ClearImage()
+{
+   for(ListDicomDirImage::iterator cc = Images.begin();
+                                   cc != Images.end();
+                                   ++cc)
+   {
+      delete *cc;
+   }
+   Images.clear();
+}
+
 /**
  * \brief   Get the first entry while visiting the DicomDirImage
  * \return  The first DicomDirImage if found, otherwhise NULL