]> Creatis software - gdcm.git/blob - src/gdcmDicomDirPatient.cxx
Still in a debugging status.
[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  * \ingroup gdcmDicomDirPatient
23  * \brief   Constructor
24  * @param ptagHT pointer to the HTable (gdcmObject needs it 
25  *               to build the gdcmHeaderEntries)
26  */
27 gdcmDicomDirPatient::gdcmDicomDirPatient(TagDocEntryHT *ptagHT):
28    gdcmObject(ptagHT)
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    gdcmDicomDirStudy *st = new gdcmDicomDirStudy( ptagHT);
75    st->FillObject(elemList);
76
77    studies.push_front(st);
78    return st; 
79
80   
81 }   
82
83 //-----------------------------------------------------------------------------
84 // Protected
85
86 //-----------------------------------------------------------------------------
87 // Private
88
89 //-----------------------------------------------------------------------------