]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDirSerie.cxx
COMP: Solve both problem of push_back missing in VS6 (already fixed) and no need...
[gdcm.git] / src / gdcmDicomDirSerie.cxx
index 5ae79875455ac04f3d94717dd73c6c7559329294..7dfcfdfddcc44d3638054109c8ddc6fe41183721 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirSerie.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/20 16:16:42 $
-  Version:   $Revision: 1.32 $
+  Date:      $Date: 2005/01/28 17:01:29 $
+  Version:   $Revision: 1.36 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -28,7 +28,8 @@ namespace gdcm
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 /**
- * \brief  Constructor 
+ * \brief  Constructor
+ * \note End user must use : DicomDirStudy::NewSerie() 
  */
 DicomDirSerie::DicomDirSerie(bool empty):
    DicomDirObject()
@@ -46,12 +47,7 @@ DicomDirSerie::DicomDirSerie(bool empty):
  */
 DicomDirSerie::~DicomDirSerie() 
 {
-   for(ListDicomDirImage::iterator cc = Images.begin();
-                                   cc != Images.end();
-                                   ++cc)
-   {
-      delete *cc;
-   }
+   ClearImage();
 }
 
 //-----------------------------------------------------------------------------
@@ -59,7 +55,7 @@ DicomDirSerie::~DicomDirSerie()
 /**
  * \brief   Prints the Object
  * @param os ostream to write to
- * @param   indent indent
+ * @param indent Indentation string to be prepended during printing
  */ 
 void DicomDirSerie::Print(std::ostream &os, std::string const &)
 {
@@ -95,7 +91,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,9 +101,23 @@ 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
+ * \return  The first DicomDirImage if DicomDirserie not empty, otherwhise NULL
  */
 DicomDirImage *DicomDirSerie::GetFirstImage()
 {
@@ -124,26 +135,10 @@ DicomDirImage *DicomDirSerie::GetFirstImage()
 DicomDirImage *DicomDirSerie::GetNextImage()
 {
    gdcmAssertMacro (ItImage != Images.end());
-   {
-      ++ItImage;
-      if (ItImage != Images.end())      
-         return *ItImage;
-   }
-   return NULL;
-}
-/**
- * \brief   Get the first entry while visiting the DicomDirImage
- * \return  The first DicomDirImage if found, otherwhise NULL
- */
-DicomDirImage *DicomDirSerie::GetLastImage()
-{
-   ItImage = Images.end();
-   if (ItImage != Images.begin())
-   {
-      --ItImage;
+
+   ++ItImage;
+   if (ItImage != Images.end())      
       return *ItImage;
-   }
    return NULL;
 }