Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

gdcmDicomDirPatient.cxx

Go to the documentation of this file.
00001 /*=========================================================================
00002                                                                                 
00003   Program:   gdcm
00004   Module:    $RCSfile: gdcmDicomDirPatient.cxx,v $
00005   Language:  C++
00006   Date:      $Date: 2005/02/02 10:02:16 $
00007   Version:   $Revision: 1.37 $
00008                                                                                 
00009   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
00010   l'Image). All rights reserved. See Doc/License.txt or
00011   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
00012                                                                                 
00013      This software is distributed WITHOUT ANY WARRANTY; without even
00014      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00015      PURPOSE.  See the above copyright notices for more information.
00016                                                                                 
00017 =========================================================================*/
00018 
00019 #include "gdcmDicomDirPatient.h"
00020 #include "gdcmDicomDirElement.h"
00021 #include "gdcmGlobal.h"
00022 #include "gdcmDicomDirStudy.h"
00023 #include "gdcmSQItem.h"
00024 #include "gdcmDebug.h"
00025 
00026 namespace gdcm 
00027 {
00028 //-----------------------------------------------------------------------------
00029 // Constructor / Destructor
00034 DicomDirPatient::DicomDirPatient(bool empty)
00035                 :DicomDirObject()
00036 {
00037    if( !empty )
00038    {
00039       ListDicomDirStudyElem const &elemList = 
00040          Global::GetDicomDirElements()->GetDicomDirPatientElements();
00041       FillObject(elemList);
00042    }
00043 }
00044 
00048 DicomDirPatient::~DicomDirPatient() 
00049 {
00050    ClearStudy();
00051 }
00052 
00053 //-----------------------------------------------------------------------------
00054 // Public
00060 void DicomDirPatient::WriteContent(std::ofstream *fp, FileType t)
00061 {
00062    DicomDirObject::WriteContent(fp, t);
00063 
00064    for(ListDicomDirStudy::iterator cc = Studies.begin();
00065                                    cc!= Studies.end();
00066                                  ++cc )
00067    {
00068       (*cc)->WriteContent( fp, t );
00069    }
00070 }
00071 
00076 DicomDirStudy* DicomDirPatient::NewStudy()
00077 {
00078    DicomDirStudy *st = new DicomDirStudy();
00079    Studies.push_back(st);
00080    return st; 
00081 }   
00082 
00086 void DicomDirPatient::ClearStudy()
00087 {
00088    for(ListDicomDirStudy::const_iterator cc = Studies.begin();
00089                                          cc != Studies.end(); 
00090                                        ++cc )
00091    {
00092       delete *cc;
00093    }
00094    Studies.clear();
00095 }
00096 
00101 DicomDirStudy *DicomDirPatient::GetFirstStudy()
00102 {
00103    ItStudy = Studies.begin();
00104    if (ItStudy != Studies.end())
00105       return *ItStudy;
00106    return NULL;
00107 }
00108 
00114 DicomDirStudy *DicomDirPatient::GetNextStudy()
00115 {
00116    gdcmAssertMacro (ItStudy != Studies.end())
00117 
00118    ++ItStudy;
00119    if (ItStudy != Studies.end())
00120       return *ItStudy;
00121    return NULL;
00122 }
00123 
00128 DicomDirStudy *DicomDirPatient::GetLastStudy()
00129 {
00130    ItStudy = Studies.end();
00131    if (ItStudy != Studies.begin())
00132    {
00133       --ItStudy;
00134       return *ItStudy;
00135    }
00136    return NULL;
00137 }
00138 
00139 //-----------------------------------------------------------------------------
00140 // Protected
00141 
00142 //-----------------------------------------------------------------------------
00143 // Private
00144 
00145 //-----------------------------------------------------------------------------
00146 // Print
00152 void DicomDirPatient::Print(std::ostream &os, std::string const & )
00153 {
00154    os << "PATIENT" << std::endl;
00155    DicomDirObject::Print(os);
00156 
00157    for(ListDicomDirStudy::const_iterator cc = Studies.begin();
00158                                          cc != Studies.end(); 
00159                                        ++cc )
00160    {
00161       (*cc)->SetPrintLevel(PrintLevel);
00162       (*cc)->Print(os);
00163    }
00164 }
00165 
00166 //-----------------------------------------------------------------------------
00167 } // end namespace gdcm

Generated on Thu Feb 10 22:17:56 2005 for gdcm by doxygen 1.3.6