]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDirStudy.cxx
* Remove memory leaks on the DicomDir
[gdcm.git] / src / gdcmDicomDirStudy.cxx
index ea46883016c4c945d9cd54c1588ec25468278dcd..a602cdd2503708084c2c7a0273c06070fa74dd60 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirStudy.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/12 04:35:45 $
-  Version:   $Revision: 1.14 $
+  Date:      $Date: 2004/12/03 17:13:18 $
+  Version:   $Revision: 1.19 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 
 namespace gdcm 
 {
-
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
-
-/**
- * \ingroup DicomDirStudy
- * \brief constructor  
- * @param  s SQ Item holding the elements related to this "STUDY" part
- * @param ptagHT pointer to the HTable (DicomDirObject needs it 
- *               to build the HeaderEntries)
- */
-DicomDirStudy::DicomDirStudy(SQItem* s, TagDocEntryHT* ptagHT):
-   DicomDirObject(ptagHT)
-{
-   docEntries = s->GetDocEntries();
-}
 /**
  * \ingroup DicomDirStudy
  * \brief constructor  
  * @param ptagHT pointer to the HTable (DicomDirObject needs it 
  *               to build the HeaderEntries)
  */
-DicomDirStudy::DicomDirStudy(TagDocEntryHT* ptagHT):
-   DicomDirObject(ptagHT)
+DicomDirStudy::DicomDirStudy():
+   DicomDirObject()
 {
 }
 /**
@@ -54,7 +40,9 @@ DicomDirStudy::DicomDirStudy(TagDocEntryHT* ptagHT):
  */
 DicomDirStudy::~DicomDirStudy() 
 {
-   for(ListDicomDirSerie::iterator cc = series.begin();cc != series.end();++cc)
+   for(ListDicomDirSerie::iterator cc = Series.begin();
+                                   cc != Series.end();
+                                 ++cc )
    {
       delete *cc;
    }
@@ -72,8 +60,8 @@ void DicomDirStudy::Print(std::ostream& os)
    os << "STUDY" << std::endl;
    DicomDirObject::Print(os);
 
-   for(ListDicomDirSerie::iterator cc = series.begin();
-                                   cc != series.end();
+   for(ListDicomDirSerie::iterator cc = Series.begin();
+                                   cc != Series.end();
                                    ++cc)
    {
       (*cc)->SetPrintLevel(PrintLevel);
@@ -88,13 +76,15 @@ void DicomDirStudy::Print(std::ostream& os)
  * \brief   Writes the Object
  * @return
  */ 
-void DicomDirStudy::Write(FILE* fp, FileType t)
+void DicomDirStudy::WriteContent(std::ofstream* fp, FileType t)
 {
-   DicomDirObject::Write(fp, t);
+   DicomDirObject::WriteContent(fp, t);
 
-   for(ListDicomDirSerie::iterator cc = series.begin();cc!=series.end();++cc)
+   for(ListDicomDirSerie::iterator cc = Series.begin();
+                                   cc!= Series.end();
+                                 ++cc )
    {
-      (*cc)->Write( fp, t );
+      (*cc)->WriteContent( fp, t );
    }
 }
 
@@ -105,12 +95,12 @@ void DicomDirStudy::Write(FILE* fp, FileType t)
  */
 DicomDirSerie* DicomDirStudy::NewSerie()
 {
-   std::list<Element> elemList = 
+   ListDicomDirSerieElem const & elemList = 
       Global::GetDicomDirElements()->GetDicomDirSerieElements();   
 
-   DicomDirSerie* st = new DicomDirSerie(PtagHT);
+   DicomDirSerie* st = new DicomDirSerie();
    FillObject(elemList);
-   series.push_front(st);
+   Series.push_front(st);
 
    return st;  
 }