]> Creatis software - gdcm.git/blob - src/gdcmDicomDirSerie.cxx
BUG: Remove the Print indent mess. Please only one Print per class default paramater...
[gdcm.git] / src / gdcmDicomDirSerie.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDicomDirSerie.cxx,v $
5   Language:  C++
6   Date:      $Date: 2005/01/16 04:50:41 $
7   Version:   $Revision: 1.26 $
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 "gdcmDicomDirSerie.h"
20 #include "gdcmDicomDirElement.h"
21 #include "gdcmDicomDirImage.h"
22 #include "gdcmGlobal.h"
23
24 namespace gdcm 
25 {
26
27 //-----------------------------------------------------------------------------
28 // Constructor / Destructor
29 /**
30  * \brief  Constructor 
31  */
32 DicomDirSerie::DicomDirSerie():
33    DicomDirObject()
34 {
35 }
36 /**
37  * \brief   Canonical destructor.
38  */
39 DicomDirSerie::~DicomDirSerie() 
40 {
41    for(ListDicomDirImage::iterator cc = Images.begin();
42                                    cc != Images.end();
43                                    ++cc)
44    {
45       delete *cc;
46    }
47 }
48
49 //-----------------------------------------------------------------------------
50 // Print
51 /**
52  * \brief   Prints the Object
53  * @param os ostream to write to
54  */ 
55 void DicomDirSerie::Print(std::ostream &os, std::string const &)
56 {
57    os << "SERIE" << std::endl;
58    DicomDirObject::Print(os);
59
60    for(ListDicomDirImage::iterator cc = Images.begin();
61                                    cc != Images.end();
62                                    ++cc)
63    {
64       (*cc)->SetPrintLevel(PrintLevel);
65       (*cc)->Print(os);
66    }
67 }
68
69 //-----------------------------------------------------------------------------
70 // Public
71
72 /**
73  * \brief   Writes the Object
74  * @param fp ofstream to write to
75  * @param t Type of the File (explicit VR, implicitVR, ...)
76  */ 
77 void DicomDirSerie::WriteContent(std::ofstream *fp, FileType t)
78 {
79    DicomDirObject::WriteContent(fp, t);
80
81    for(ListDicomDirImage::iterator cc = Images.begin();
82                                    cc!= Images.end();
83                                  ++cc )
84    {
85       (*cc)->WriteContent( fp, t );
86    }
87 }
88
89 /**
90  * \brief   adds a new Image (with the basic elements) to a partially created DICOMDIR
91  */
92 DicomDirImage *DicomDirSerie::NewImage()
93 {
94    ListDicomDirImageElem const &elemList = 
95       Global::GetDicomDirElements()->GetDicomDirImageElements();
96
97    DicomDirImage *st = new DicomDirImage();
98    FillObject(elemList);
99    Images.push_front(st);
100
101    return st;   
102
103 //-----------------------------------------------------------------------------
104 // Protected
105
106 //-----------------------------------------------------------------------------
107 // Private
108
109 //-----------------------------------------------------------------------------
110 } // end namespace gdcm
111
112