]> Creatis software - gdcm.git/blob - src/gdcmDicomDirPatient.cxx
* src/gdcmUtil.[cxx|h] split in two. Additional file gdcmDebug.[cxx|h]
[gdcm.git] / src / gdcmDicomDirPatient.cxx
1 // gdcmDicomDirPatient.cxx
2 //-----------------------------------------------------------------------------
3 #include "gdcmDicomDirPatient.h"
4 #include "gdcmDicomDirElement.h"
5 #include "gdcmUtil.h"
6
7 //-----------------------------------------------------------------------------
8 // Constructor / Destructor
9 /**
10  * \ingroup gdcmDicomDirPatient
11  * \brief   Constructor
12  * @param  begin  iterator (inside the gdcmParser chained list)
13  *                on the first Header Entry (i.e Dicom Element)
14  *                related to this "PATIENT" part
15  * @param  end  iterator  (inside the gdcmParser chained list)
16  *              on the last Header Entry (i.e Dicom Element) 
17  *              related to this 'PATIENT' part
18  * @param ptagHT pointer to the HTable (gdcmObject needs it 
19  *               to build the gdcmHeaderEntries)
20  * @param plistEntries pointer to the chained List (gdcmObject needs it 
21  *               to build the gdcmHeaderEntries)
22  */
23 gdcmDicomDirPatient::gdcmDicomDirPatient(ListTag::iterator begin,
24                                          ListTag::iterator end,
25                                          TagHeaderEntryHT *ptagHT, 
26                                          ListTag *plistEntries):
27    gdcmObject(begin,end,ptagHT,plistEntries)
28 {
29 }
30
31 /**
32  * \ingroup gdcmDicomDirPatient
33  * \brief   Canonical destructor.
34  */
35 gdcmDicomDirPatient::~gdcmDicomDirPatient() 
36 {
37    for(ListDicomDirStudy::iterator cc = studies.begin();cc != studies.end();++cc)
38    {
39       delete *cc;
40    }
41 }
42
43 //-----------------------------------------------------------------------------
44 // Print
45 /**
46  * \ingroup gdcmDicomDirPatient
47  * \brief   Prints the Object
48  * @return
49  */ 
50 void gdcmDicomDirPatient::Print(std::ostream &os)
51 {
52    os<<"PATIENT"<<std::endl;
53    gdcmObject::Print(os);
54
55    for(ListDicomDirStudy::iterator cc = studies.begin();cc!=studies.end();++cc)
56    {
57       (*cc)->SetPrintLevel(printLevel);
58       (*cc)->Print(os);
59    }
60 }
61
62 //-----------------------------------------------------------------------------
63 // Public
64
65 /**
66  * \ingroup gdcmDicomDir
67  * \brief   adds a new Patient at the begining of the PatientList
68  *          of a partially created DICOMDIR
69  */
70 gdcmDicomDirStudy * gdcmDicomDirPatient::NewStudy(void) {
71    std::list<gdcmElement> elemList;   
72    elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirStudyElements();
73       
74    FillObject(elemList);
75    gdcmDicomDirStudy *st = new gdcmDicomDirStudy(i, j, ptagHT, plistEntries);
76    studies.push_front(st);
77    return st; 
78
79   
80 }   
81
82 //-----------------------------------------------------------------------------
83 // Protected
84
85 //-----------------------------------------------------------------------------
86 // Private
87
88 //-----------------------------------------------------------------------------