X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmSeqEntry.cxx;h=8f5e4731c6dc33e6745d1c507fbcd904653812a1;hb=ae64a0ce6b0e05103e13d8b2eedc87b7fcf02380;hp=9e510814df433678865a4f339247394f51e68858;hpb=d1c68c2c2ae9fadf927053150f7fbc625a7c7366;p=gdcm.git diff --git a/src/gdcmSeqEntry.cxx b/src/gdcmSeqEntry.cxx index 9e510814..8f5e4731 100644 --- a/src/gdcmSeqEntry.cxx +++ b/src/gdcmSeqEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSeqEntry.cxx,v $ Language: C++ - Date: $Date: 2005/02/01 10:29:56 $ - Version: $Revision: 1.52 $ + Date: $Date: 2005/08/24 03:42:40 $ + Version: $Revision: 1.57 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -18,6 +18,7 @@ #include "gdcmSeqEntry.h" #include "gdcmSQItem.h" +#include "gdcmValEntry.h" #include "gdcmTS.h" #include "gdcmGlobal.h" #include "gdcmUtil.h" @@ -46,7 +47,7 @@ SeqEntry::SeqEntry( DictEntry *e ) } /** - * \brief Constructor from a given SeqEntry + * \brief Constructor from a given DocEntry * @param e Pointer to existing Doc entry * @param depth depth level of the current Seq entry */ @@ -67,14 +68,7 @@ SeqEntry::SeqEntry( DocEntry *e, int depth ) */ SeqEntry::~SeqEntry() { - for(ListSQItem::iterator cc = Items.begin(); cc != Items.end(); ++cc) - { - delete *cc; - } - if (SeqTerm) - { - delete SeqTerm; - } + ClearSQItem(); } //----------------------------------------------------------------------------- @@ -108,6 +102,38 @@ void SeqEntry::WriteContent(std::ofstream *fp, FileType filetype) binary_write(*fp, seq_term_lg); } +/** + * \brief adds the passed ITEM to the ITEM chained List for this SeQuence. + * @param sqItem SQItem to be pushed back in the SeqEntry + * @param itemNumber ordinal number of the SQItem + * \note NOT end-user intendend method ! + */ +void SeqEntry::AddSQItem(SQItem *sqItem, int itemNumber) +{ +// FIXME : SQItemNumber is supposed to be the ordinal number of the SQItem +// within the Sequence. +// Either only 'push_back' is allowed, +// and we just have to do something like SeqEntry::lastNb++ +// Or we can add (or remove) anywhere, and SQItemNumber will be broken + sqItem->SetSQItemNumber(itemNumber); + Items.push_back(sqItem); +} + +/** + * \brief Remove all SQItem. + */ +void SeqEntry::ClearSQItem() +{ + for(ListSQItem::iterator cc = Items.begin(); cc != Items.end(); ++cc) + { + delete *cc; + } + if (SeqTerm) + { + delete SeqTerm; + } +} + /** * \brief Get the first entry while visiting the SeqEntry * \return The first SQItem if found, otherwhise NULL @@ -170,23 +196,6 @@ unsigned int SeqEntry::GetNumberOfSQItems() return Items.size(); } -/** - * \brief adds the passed ITEM to the ITEM chained List for this SeQuence. - * @param sqItem SQItem to be pushed back in the SeqEntry - * @param itemNumber ordinal number of the SQItem - * \note NOT end-user intendend method ! - */ -void SeqEntry::AddSQItem(SQItem *sqItem, int itemNumber) -{ -// FIXME : SQItemNumber is supposed to be the ordinal number of the SQItem -// within the Sequence. -// Either only 'push_back' is allowed, -// and we just have to do something like SeqEntry::lastNb++ -// Or we can add (or remove) anywhere, and SQItemNumber will be broken - sqItem->SetSQItemNumber(itemNumber); - Items.push_back(sqItem); -} - //----------------------------------------------------------------------------- // Protected @@ -219,10 +228,12 @@ void SeqEntry::Print( std::ostream &os, std::string const & ) // at end, print the sequence terminator item, if any if (DelimitorMode) { - for ( int i = 0; i < SQDepthLevel; i++ ) - { + int i; + for ( i = 0; i < SQDepthLevel; i++ ) + os << " | " ; + os << " --- " << std::endl; + for ( i = 0; i < SQDepthLevel; i++ ) os << " | " ; - } if (SeqTerm != NULL) { SeqTerm->SetPrintLevel(PrintLevel); @@ -232,7 +243,7 @@ void SeqEntry::Print( std::ostream &os, std::string const & ) else { // fuse - gdcmVerboseMacro(" -------- should have a sequence terminator item"); + gdcmWarningMacro(" -------- should have a sequence terminator item"); } } }