X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmSQItem.cxx;h=88c93b3ad21c7021b5c4dac7a2201488e63f54b1;hb=a331d5552949298f5d59b7a7bd78552a875a0214;hp=75d99b677953b2044c971e14602ec1bc9764ba4b;hpb=0408b1aa8aaf0d1e17391984490ad2bbe89a922b;p=gdcm.git diff --git a/src/gdcmSQItem.cxx b/src/gdcmSQItem.cxx index 75d99b67..88c93b3a 100644 --- a/src/gdcmSQItem.cxx +++ b/src/gdcmSQItem.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSQItem.cxx,v $ Language: C++ - Date: $Date: 2005/02/02 10:00:24 $ - Version: $Revision: 1.65 $ + Date: $Date: 2005/09/06 17:15:25 $ + Version: $Revision: 1.75 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -85,7 +85,9 @@ void SQItem::WriteContent(std::ofstream *fp, FileType filetype) // we just *always* ignore spurious fffe|0000 tag ! if ( (*it)->GetGroup() == 0xfffe && (*it)->GetElement() == 0x0000 ) { - break; // FIXME : continue; ?!? + break; // FIXME : break or continue; ?!? + // --> makes no difference since the only bugged file we have + // contains 'impossible tag' fffe|0000 in last position ! } (*it)->WriteContent(fp, filetype); @@ -99,24 +101,11 @@ void SQItem::WriteContent(std::ofstream *fp, FileType filetype) } } -/** - * \brief Remove all entry in the Sequence Item - */ -void SQItem::ClearEntry() -{ - for(ListDocEntry::iterator cc = DocEntries.begin(); - cc != DocEntries.end(); - ++cc) - { - delete *cc; - } - DocEntries.clear(); -} - /** * \brief Inserts *in the right place* any Entry (Dicom Element) * into the Sequence Item * @param entry Entry to add + * @return always true */ bool SQItem::AddEntry(DocEntry *entry) { @@ -161,15 +150,15 @@ bool SQItem::RemoveEntry( DocEntry *entryToRemove ) it != DocEntries.end(); ++it) { - if( *it == entryToRemove ) + if ( *it == entryToRemove ) { DocEntries.erase(it); - gdcmVerboseMacro( "One element erased: " << entryToRemove->GetKey() ); + gdcmWarningMacro( "One element erased: " << entryToRemove->GetKey() ); delete entryToRemove; return true; } } - gdcmVerboseMacro( "Entry not found: " << entryToRemove->GetKey() ); + gdcmWarningMacro( "Entry not found: " << entryToRemove->GetKey() ); return false ; } @@ -184,19 +173,51 @@ bool SQItem::RemoveEntryNoDestroy(DocEntry *entryToRemove) it != DocEntries.end(); ++it) { - if( *it == entryToRemove ) + if ( *it == entryToRemove ) { DocEntries.erase(it); - gdcmVerboseMacro( "One element erased, no destroyed: " + gdcmWarningMacro( "One element removed, no destroyed: " << entryToRemove->GetKey() ); return true; } } - gdcmVerboseMacro( "Entry not found:" << entryToRemove->GetKey() ); + gdcmWarningMacro( "Entry not found:" << entryToRemove->GetKey() ); return false ; } +/** + * \brief Remove all entry in the Sequence Item + */ +void SQItem::ClearEntry() +{ + for(ListDocEntry::iterator cc = DocEntries.begin(); + cc != DocEntries.end(); + ++cc) + { + delete *cc; + } + DocEntries.clear(); +} + +/** + * \brief Clear the std::list from given Sequence Item BUT keep the entries + */ +void SQItem::ClearEntryNoDestroy() +{ + DocEntries.clear(); +} + + +/** + * \brief Move all the entries from a given Sequence Item + */ +void SQItem::MoveObject(SQItem *source) +{ + DocEntries = source->DocEntries; + source->ClearEntryNoDestroy(); +} + /** * \brief Get the first Dicom entry while visiting the SQItem * \return The first DocEntry if found, otherwhise 0 @@ -204,19 +225,19 @@ bool SQItem::RemoveEntryNoDestroy(DocEntry *entryToRemove) DocEntry *SQItem::GetFirstEntry() { ItDocEntries = DocEntries.begin(); - if( ItDocEntries != DocEntries.end() ) + if ( ItDocEntries != DocEntries.end() ) return *ItDocEntries; return 0; } /** - * \brief Get the next Dicom entry while visiting the chained list + * \brief Get the next Dicom entry while visiting the SQItem * \return The next DocEntry if found, otherwhise NULL */ DocEntry *SQItem::GetNextEntry() { ++ItDocEntries; - if( ItDocEntries != DocEntries.end() ) + if ( ItDocEntries != DocEntries.end() ) return *ItDocEntries; return NULL; }