X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmSQItem.cxx;h=1dff9cd878cf60e9fe10554fe5152aa672376fff;hb=4ef8257270e9d499e8c5ece74c4582bcb6c3f6a4;hp=fe331d2b6bed66fefafb9f34c7967f399b0f0ff5;hpb=80c92fa39ae3f5a69f1a56f2ae6052802373b610;p=gdcm.git diff --git a/src/gdcmSQItem.cxx b/src/gdcmSQItem.cxx index fe331d2b..1dff9cd8 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/07/12 17:08:12 $ - Version: $Revision: 1.74 $ + Date: $Date: 2005/10/27 09:52:33 $ + Version: $Revision: 1.78 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -18,8 +18,6 @@ #include "gdcmSQItem.h" #include "gdcmSeqEntry.h" -#include "gdcmValEntry.h" -#include "gdcmBinEntry.h" #include "gdcmGlobal.h" #include "gdcmDictSet.h" #include "gdcmUtil.h" @@ -85,7 +83,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); @@ -110,6 +110,7 @@ bool SQItem::AddEntry(DocEntry *entry) if (DocEntries.empty() ) { DocEntries.push_back(entry); + entry->Register(); return true; } @@ -131,9 +132,11 @@ bool SQItem::AddEntry(DocEntry *entry) break; } while (it != DocEntries.begin() ); - insertSpot = it++; - insertSpot++; // ?!? + ++it; + insertSpot = it; + //++insertSpot; // ?!? DocEntries.insert(insertSpot, entry); + entry->Register(); return true; } @@ -151,8 +154,8 @@ bool SQItem::RemoveEntry( DocEntry *entryToRemove ) if ( *it == entryToRemove ) { DocEntries.erase(it); - gdcmWarningMacro( "One element erased: " << entryToRemove->GetKey() ); - delete entryToRemove; + gdcmDebugMacro( "One element erased: " << entryToRemove->GetKey() ); + entryToRemove->Unregister(); return true; } } @@ -160,30 +163,6 @@ bool SQItem::RemoveEntry( DocEntry *entryToRemove ) return false ; } -/** - * \brief Clear the std::list from given entry BUT keep the entry. - * @param entryToRemove Entry to remove. - * @return true if the entry was found and removed; false otherwise - */ -bool SQItem::RemoveEntryNoDestroy(DocEntry *entryToRemove) -{ - for(ListDocEntry::iterator it = DocEntries.begin(); - it != DocEntries.end(); - ++it) - { - if ( *it == entryToRemove ) - { - DocEntries.erase(it); - gdcmWarningMacro( "One element removed, no destroyed: " - << entryToRemove->GetKey() ); - return true; - } - } - - gdcmWarningMacro( "Entry not found:" << entryToRemove->GetKey() ); - return false ; -} - /** * \brief Remove all entry in the Sequence Item */ @@ -193,27 +172,18 @@ void SQItem::ClearEntry() cc != DocEntries.end(); ++cc) { - delete *cc; + (*cc)->Unregister(); } 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(); + source->DocEntries.clear(); } /**