]> Creatis software - gdcm.git/blob - src/gdcmDicomDirMeta.cxx
-add method GetFirstEntry to replace call to InitTraversal+GetNextEntry
[gdcm.git] / src / gdcmDicomDirMeta.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDicomDirMeta.cxx,v $
5   Language:  C++
6   Date:      $Date: 2005/01/18 07:53:42 $
7   Version:   $Revision: 1.22 $
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 "gdcmDicomDirMeta.h"
20 #include "gdcmDocument.h"
21 #include "gdcmDocEntry.h"
22
23 namespace gdcm 
24 {
25
26 //-----------------------------------------------------------------------------
27 // Constructor / Destructor
28
29 /**
30  * \brief  Constructor
31  */ 
32 DicomDirMeta::DicomDirMeta():
33    DicomDirObject()
34 {
35 }
36
37 /**
38  * \brief   Canonical destructor.
39  */
40 DicomDirMeta::~DicomDirMeta() 
41 {
42 }
43
44 //-----------------------------------------------------------------------------
45 // Print
46 /**
47  * \brief   Prints the Meta Elements
48  * @param os ostream to write to 
49  */ 
50 void DicomDirMeta::Print(std::ostream &os, std::string const & )
51 {
52    os << "META" << std::endl;
53    // warning : META doesn't behave exactly like a Objet 
54    for (ListDocEntry::iterator i = DocEntries.begin();
55         i != DocEntries.end();
56         ++i)
57    {
58       (*i)->SetPrintLevel(PrintLevel);
59       (*i)->Print();
60       os << std::endl;
61    }
62 }
63
64
65 //-----------------------------------------------------------------------------
66 // Public
67
68
69 /**
70  * \brief   Writes the Meta Elements
71  * @param fp ofstream to write to
72  * @param t File Type 
73  * @return
74  */ 
75 void DicomDirMeta::WriteContent(std::ofstream *fp, FileType t)
76 {   
77    for (ListDocEntry::iterator i = DocEntries.begin();  
78                               i != DocEntries.end();
79                               ++i)
80    {
81       (*i)->WriteContent(fp, t);
82    }
83 }
84
85 //-----------------------------------------------------------------------------
86 // Protected
87
88 //-----------------------------------------------------------------------------
89 // Private
90
91 //-----------------------------------------------------------------------------
92
93 } // end namespace gdcm