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