X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDicomDirPatient.cxx;h=e3235ec8e4aa45933c421e3af20c68d8b61c2cb2;hb=831b4cec23815614ee2ceddff957e852d7a36fe9;hp=d6673ac79bab943812ee5fb7949ee94d08142a86;hpb=1d69b92978803204089d270599133917d944c651;p=gdcm.git diff --git a/src/gdcmDicomDirPatient.cxx b/src/gdcmDicomDirPatient.cxx index d6673ac7..e3235ec8 100644 --- a/src/gdcmDicomDirPatient.cxx +++ b/src/gdcmDicomDirPatient.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirPatient.cxx,v $ Language: C++ - Date: $Date: 2004/10/12 04:35:45 $ - Version: $Revision: 1.15 $ + Date: $Date: 2005/01/17 10:59:52 $ + Version: $Revision: 1.25 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -19,6 +19,9 @@ #include "gdcmDicomDirPatient.h" #include "gdcmDicomDirElement.h" #include "gdcmGlobal.h" +#include "gdcmDicomDirStudy.h" +#include "gdcmSQItem.h" + namespace gdcm { @@ -26,22 +29,9 @@ namespace gdcm // Constructor / Destructor /** * \brief Constructor - * @param s SQ Item holding the elements related to this "PATIENT" part - * @param ptagHT pointer to the HTable (DicomDirObject needs it - * to build the HeaderEntries) - */ -DicomDirPatient::DicomDirPatient(SQItem *s, TagDocEntryHT *ptagHT): - DicomDirObject(ptagHT) -{ - docEntries = s->GetDocEntries(); -} -/** - * \brief Constructor - * @param ptagHT pointer to the HTable (DicomDirObject needs it - * to build the HeaderEntries) */ -DicomDirPatient::DicomDirPatient(TagDocEntryHT* ptagHT): - DicomDirObject(ptagHT) +DicomDirPatient::DicomDirPatient(): + DicomDirObject() { } /** @@ -49,8 +39,9 @@ DicomDirPatient::DicomDirPatient(TagDocEntryHT* ptagHT): */ DicomDirPatient::~DicomDirPatient() { - for(ListDicomDirStudy::iterator cc = studies.begin(); - cc != studies.end(); ++cc) + for(ListDicomDirStudy::const_iterator cc = Studies.begin(); + cc != Studies.end(); + ++cc ) { delete *cc; } @@ -60,15 +51,16 @@ DicomDirPatient::~DicomDirPatient() // Print /** * \brief Prints the Object - * @return + * @param os ostream to write to */ -void DicomDirPatient::Print(std::ostream& os) +void DicomDirPatient::Print(std::ostream &os, std::string const & ) { os << "PATIENT" << std::endl; DicomDirObject::Print(os); - for(ListDicomDirStudy::iterator cc = studies.begin(); - cc != studies.end(); ++cc) + for(ListDicomDirStudy::const_iterator cc = Studies.begin(); + cc != Studies.end(); + ++cc ) { (*cc)->SetPrintLevel(PrintLevel); (*cc)->Print(os); @@ -77,15 +69,18 @@ void DicomDirPatient::Print(std::ostream& os) /** * \brief Writes the Object - * @return + * @param fp ofstream to write to + * @param t Type of the File (explicit VR, implicitVR, ...) */ -void DicomDirPatient::Write(FILE* fp, FileType t) +void DicomDirPatient::WriteContent(std::ofstream *fp, FileType t) { - DicomDirObject::Write(fp, t); + DicomDirObject::WriteContent(fp, t); - for(ListDicomDirStudy::iterator cc = studies.begin();cc!=studies.end();++cc) + for(ListDicomDirStudy::iterator cc = Studies.begin(); + cc!= Studies.end(); + ++cc ) { - (*cc)->Write( fp, t ); + (*cc)->WriteContent( fp, t ); } } //----------------------------------------------------------------------------- @@ -97,16 +92,41 @@ void DicomDirPatient::Write(FILE* fp, FileType t) */ DicomDirStudy* DicomDirPatient::NewStudy() { - std::list elemList = + ListDicomDirStudyElem const &elemList = Global::GetDicomDirElements()->GetDicomDirStudyElements(); - DicomDirStudy* st = new DicomDirStudy( PtagHT ); + DicomDirStudy *st = new DicomDirStudy(); st->FillObject(elemList); - studies.push_front(st); + Studies.push_front(st); return st; } +/** + * \brief Initialise the visit of the DicomDirPatients + */ +void DicomDirPatient::InitTraversal() +{ + ItDicomDirStudy = Studies.begin(); +} + +/** + * \brief Get the next entry while visiting the DicomDirStudies + * \return The next DicomDirStudies if found, otherwhise NULL + */ +DicomDirStudy *DicomDirPatient::GetNextEntry() +{ + if (ItDicomDirStudy != Studies.end()) + { + DicomDirStudy *tmp = *ItDicomDirStudy; + ++ItDicomDirStudy; + return tmp; + } + else + { + return NULL; + } +} //----------------------------------------------------------------------------- // Protected