]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDirPatient.cxx
* src/gdcmDocument.cxx : bug fix on potential memory leak
[gdcm.git] / src / gdcmDicomDirPatient.cxx
index ceeea5b4fe4179e6a699b5712105b98d5c8c3f73..9a339e21f4ed7b59afea54045f30e40a638d4e44 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirPatient.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/23 10:12:33 $
-  Version:   $Revision: 1.31 $
+  Date:      $Date: 2005/01/25 11:11:58 $
+  Version:   $Revision: 1.32 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -47,12 +47,7 @@ DicomDirPatient::DicomDirPatient(bool empty):
  */
 DicomDirPatient::~DicomDirPatient() 
 {
-   for(ListDicomDirStudy::const_iterator cc = Studies.begin();
-                                         cc != Studies.end(); 
-                                       ++cc )
-   {
-      delete *cc;
-   }
+   ClearStudy();
 }
 
 //-----------------------------------------------------------------------------
@@ -106,6 +101,20 @@ DicomDirStudy* DicomDirPatient::NewStudy()
    return st; 
 }   
 
+/**
+ * \brief  Remove all studies in the patient 
+ */
+void DicomDirPatient::ClearStudy()
+{
+   for(ListDicomDirStudy::const_iterator cc = Studies.begin();
+                                         cc != Studies.end(); 
+                                       ++cc )
+   {
+      delete *cc;
+   }
+   Studies.clear();
+}
+
 /**
  * \brief   Get the first entry while visiting the DicomDirStudy
  * \return  The first DicomDirStudy if found, otherwhise NULL