]> Creatis software - gdcm.git/blob - src/gdcmDicomDirStudy.cxx
ENH: * Huge cleanup:
[gdcm.git] / src / gdcmDicomDirStudy.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDicomDirStudy.cxx,v $
5   Language:  C++
6   Date:      $Date: 2004/12/03 20:16:57 $
7   Version:   $Revision: 1.20 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18
19 #include "gdcmDicomDirStudy.h"
20 #include "gdcmDicomDirElement.h"
21 #include "gdcmGlobal.h"
22 #include "gdcmDicomDirSerie.h"
23
24 namespace gdcm 
25 {
26 //-----------------------------------------------------------------------------
27 // Constructor / Destructor
28 /**
29  * \ingroup DicomDirStudy
30  * \brief constructor  
31  * @param ptagHT pointer to the HTable (DicomDirObject needs it 
32  *               to build the HeaderEntries)
33  */
34 DicomDirStudy::DicomDirStudy():
35    DicomDirObject()
36 {
37 }
38 /**
39  * \ingroup DicomDirStudy
40  * \brief   Canonical destructor.
41  */
42 DicomDirStudy::~DicomDirStudy() 
43 {
44    for(ListDicomDirSerie::iterator cc = Series.begin();
45                                    cc != Series.end();
46                                  ++cc )
47    {
48       delete *cc;
49    }
50 }
51
52 //-----------------------------------------------------------------------------
53 // Print
54 /**
55  * \ingroup DicomDirStudy
56  * \brief   Prints the Object
57  * @return
58  */ 
59 void DicomDirStudy::Print(std::ostream& os)
60 {
61    os << "STUDY" << std::endl;
62    DicomDirObject::Print(os);
63
64    for(ListDicomDirSerie::iterator cc = Series.begin();
65                                    cc != Series.end();
66                                    ++cc)
67    {
68       (*cc)->SetPrintLevel(PrintLevel);
69       (*cc)->Print(os);
70    }
71 }
72
73 //-----------------------------------------------------------------------------
74 // Public
75
76 /**
77  * \brief   Writes the Object
78  * @return
79  */ 
80 void DicomDirStudy::WriteContent(std::ofstream* fp, FileType t)
81 {
82    DicomDirObject::WriteContent(fp, t);
83
84    for(ListDicomDirSerie::iterator cc = Series.begin();
85                                    cc!= Series.end();
86                                  ++cc )
87    {
88       (*cc)->WriteContent( fp, t );
89    }
90 }
91
92 /**
93  * \ingroup DicomDirStudy
94  * \brief   adds a new Serie at the begining of the SerieList
95  *          of a partially created DICOMDIR
96  */
97 DicomDirSerie* DicomDirStudy::NewSerie()
98 {
99    ListDicomDirSerieElem const & elemList = 
100       Global::GetDicomDirElements()->GetDicomDirSerieElements();   
101
102    DicomDirSerie* st = new DicomDirSerie();
103    FillObject(elemList);
104    Series.push_front(st);
105
106    return st;  
107 }   
108 //-----------------------------------------------------------------------------
109 // Protected
110
111 //-----------------------------------------------------------------------------
112 // Private
113
114 //-----------------------------------------------------------------------------
115 } // end namespace gdcm
116