]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDirSerie.cxx
* Remove memory leaks on the DicomDir
[gdcm.git] / src / gdcmDicomDirSerie.cxx
index 0b62c553ac2e0b3adc0bb2fecc9e3be63b3afd4a..dcdd74656a78e0f350188884afd29170573631da 100644 (file)
@@ -3,12 +3,12 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirSerie.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/07/21 14:02:10 $
-  Version:   $Revision: 1.11 $
+  Date:      $Date: 2004/12/03 17:13:18 $
+  Version:   $Revision: 1.22 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
-  http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
+  http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
                                                                                 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 #include "gdcmDicomDirElement.h"
 #include "gdcmGlobal.h"
 
-//-----------------------------------------------------------------------------
-// Constructor / Destructor
-/**
- * \brief  Constructor 
- * @param  s  SQ Item holding the elements related to this "SERIE" part
- * @param ptagHT pointer to the HTable (gdcmObject needs it 
- *               to build the gdcmDocEntries)
- */
-gdcmDicomDirSerie::gdcmDicomDirSerie(gdcmSQItem *s, TagDocEntryHT *ptagHT):
-   gdcmObject(ptagHT)
+namespace gdcm 
 {
-   docEntries = s->GetDocEntries();
-}
 
+//-----------------------------------------------------------------------------
+// Constructor / Destructor
 /**
  * \brief  Constructor 
- * @param ptagHT pointer to the HTable (gdcmObject needs it 
- *               to build the gdcmDocEntries)
+ * @param ptagHT pointer to the HTable (DicomDirObject needs it 
+ *               to build the DocEntries)
  */
-gdcmDicomDirSerie::gdcmDicomDirSerie(TagDocEntryHT *ptagHT):
-   gdcmObject(ptagHT)
+DicomDirSerie::DicomDirSerie():
+   DicomDirObject()
 {
 }
 /**
  * \brief   Canonical destructor.
  */
-gdcmDicomDirSerie::~gdcmDicomDirSerie() 
+DicomDirSerie::~DicomDirSerie() 
 {
-   for(ListDicomDirImage::iterator cc = images.begin();cc != images.end();++cc)
+   for(ListDicomDirImage::iterator cc = Images.begin();
+                                   cc != Images.end();
+                                   ++cc)
    {
       delete *cc;
    }
@@ -60,30 +53,51 @@ gdcmDicomDirSerie::~gdcmDicomDirSerie()
  * \brief   Prints the Object
  * @return
  */ 
-void gdcmDicomDirSerie::Print(std::ostream &os)
+void DicomDirSerie::Print(std::ostream& os)
 {
-   os<<"SERIE"<<std::endl;
-   gdcmObject::Print(os);
+   os << "SERIE" << std::endl;
+   DicomDirObject::Print(os);
 
-   for(ListDicomDirImage::iterator cc = images.begin();cc != images.end();++cc)
+   for(ListDicomDirImage::iterator cc = Images.begin();
+                                   cc != Images.end();
+                                   ++cc)
    {
-      (*cc)->SetPrintLevel(printLevel);
+      (*cc)->SetPrintLevel(PrintLevel);
       (*cc)->Print(os);
    }
 }
 
 //-----------------------------------------------------------------------------
 // Public
+
+/**
+ * \brief   Writes the Object
+ * @return
+ */ 
+void DicomDirSerie::WriteContent(std::ofstream* fp, FileType t)
+{
+   DicomDirObject::WriteContent(fp, t);
+
+   for(ListDicomDirImage::iterator cc = Images.begin();
+                                   cc!= Images.end();
+                                 ++cc )
+   {
+      (*cc)->WriteContent( fp, t );
+   }
+}
+
 /**
  * \brief   adds a new Image (with the basic elements) to a partially created DICOMDIR
  */
-gdcmDicomDirImage * gdcmDicomDirSerie::NewImage(void) {
-   std::list<gdcmElement> elemList;   
-   elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirImageElements();
-      
-   gdcmDicomDirImage *st = new gdcmDicomDirImage(ptagHT);
+DicomDirImage* DicomDirSerie::NewImage()
+{
+   ListDicomDirImageElem const & elemList = 
+      Global::GetDicomDirElements()->GetDicomDirImageElements();
+
+   DicomDirImage* st = new DicomDirImage();
    FillObject(elemList);
-   images.push_front(st);
+   Images.push_front(st);
+
    return st;   
 } 
 //-----------------------------------------------------------------------------
@@ -93,3 +107,6 @@ gdcmDicomDirImage * gdcmDicomDirSerie::NewImage(void) {
 // Private
 
 //-----------------------------------------------------------------------------
+} // end namespace gdcm
+
+