]> Creatis software - gdcm.git/blob - src/gdcmDicomDirMeta.cxx
Summer nights are really too hot to sleep.
[gdcm.git] / src / gdcmDicomDirMeta.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDicomDirMeta.cxx,v $
5   Language:  C++
6   Date:      $Date: 2005/06/24 10:55:58 $
7   Version:   $Revision: 1.28 $
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 #include "gdcmGlobal.h"
23
24 namespace gdcm 
25 {
26 //-----------------------------------------------------------------------------
27 // Constructor / Destructor
28 /**
29  * \brief  Constructor
30  */ 
31 DicomDirMeta::DicomDirMeta(bool empty):
32    DicomDirObject()
33 {
34    if ( !empty )
35    {
36       ListDicomDirStudyElem const &elemList = 
37          Global::GetDicomDirElements()->GetDicomDirMetaElements();
38       FillObject(elemList);
39    }
40 }
41
42 /**
43  * \brief   Canonical destructor.
44  */
45 DicomDirMeta::~DicomDirMeta() 
46 {
47 }
48
49 //-----------------------------------------------------------------------------
50 // Public
51 /**
52  * \brief   Writes the Meta Elements
53  * @param fp ofstream to write to
54  * @param filetype type of the file (ACR, ImplicitVR, ExplicitVR, ...)
55  * @return
56  */ 
57 void DicomDirMeta::WriteContent(std::ofstream *fp, FileType filetype)
58 {   
59    for (ListDocEntry::iterator i = DocEntries.begin();  
60                               i != DocEntries.end();
61                               ++i)
62    {
63       (*i)->WriteContent(fp, filetype);
64    }
65 }
66
67 //-----------------------------------------------------------------------------
68 // Protected
69
70 //-----------------------------------------------------------------------------
71 // Private
72
73 //-----------------------------------------------------------------------------
74 // Print
75 /**
76  * \brief   Prints the Meta Elements
77  * @param os ostream to write to 
78  * @param indent Indentation string to be prepended during printing
79  */ 
80 void DicomDirMeta::Print(std::ostream &os, std::string const & )
81 {
82    os << "META" << std::endl;
83    // warning : META doesn't behave exactly like a Objet 
84    for (ListDocEntry::iterator i = DocEntries.begin();
85         i != DocEntries.end();
86         ++i)
87    {
88       (*i)->SetPrintLevel(PrintLevel);
89       (*i)->Print();
90       os << std::endl;
91    }
92 }
93
94 //-----------------------------------------------------------------------------
95 } // end namespace gdcm