From fd285cb4d58d253d739ac87e04dccec2a64f9bc0 Mon Sep 17 00:00:00 2001 From: malaterre Date: Wed, 27 Oct 2004 22:47:19 +0000 Subject: [PATCH] ENH: Minor cleanup, mostly remove comments --- ChangeLog | 5 +++++ Example/TestChangeHeader.cxx | 2 +- src/gdcmDict.cxx | 18 +++--------------- src/gdcmDictSet.cxx | 18 ++++-------------- 4 files changed, 13 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 03a03809..748425db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-10-27 Mathieu Malaterre + * Change internals for gdcmDict. Don't use any 'new' any more. + This should definitely solve any leak problem, and we should be + as fast as before, as long as don't modify too much the dictionary. + 2004-10-25 Mathieu Malaterre * STYLE: ivars should start with a capital letter. * Accessors should be const to avoid people starting modifying stuff (since this is a ref). diff --git a/Example/TestChangeHeader.cxx b/Example/TestChangeHeader.cxx index 1ad0e782..6550733f 100644 --- a/Example/TestChangeHeader.cxx +++ b/Example/TestChangeHeader.cxx @@ -20,7 +20,7 @@ std::endl; // 0018 1310 US ACQ Acquisition Matrix gdcm::DictEntry *dictEntry = - f2->GetHeader()->GetPubDict()->GetDictEntryByName( "Acquisition Matrix" ); + f2->GetHeader()->GetPubDict()->GetDictEntryByName( "Acquisition Matrix" ); std::cerr << std::hex << dictEntry->GetGroup() << "," << dictEntry->GetElement() << std::endl; // std::string matrix = f2->GetHeader()->GetEntryByNumber(0x0018, 0x1310); diff --git a/src/gdcmDict.cxx b/src/gdcmDict.cxx index 01acd68d..ffcd2dc7 100644 --- a/src/gdcmDict.cxx +++ b/src/gdcmDict.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDict.cxx,v $ Language: C++ - Date: $Date: 2004/10/27 22:31:12 $ - Version: $Revision: 1.48 $ + Date: $Date: 2004/10/27 22:47:20 $ + Version: $Revision: 1.49 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -68,14 +68,6 @@ Dict::Dict(std::string const & filename) */ Dict::~Dict() { -/* for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag) - { - DictEntry* entryToDelete = tag->second; - if ( entryToDelete ) - { - delete entryToDelete; - } - }*/ // Since AddNewEntry adds symetrical in both KeyHt and NameHT we can // assume all the pointed DictEntries are already cleaned-up when // we cleaned KeyHt. @@ -161,11 +153,9 @@ bool Dict::AddNewEntry(DictEntry const & newEntry) } else { - //KeyHt[newEntry.GetKey()] = newEntry; KeyHt.insert( TagKeyHT::value_type (newEntry.GetKey(), newEntry)); - //NameHt[newEntry.GetName()] = newEntry; NameHt.insert( TagNameHT::value_type (newEntry.GetName(), newEntry )); @@ -183,11 +173,9 @@ bool Dict::ReplaceEntry(DictEntry const & newEntry) { if ( RemoveEntry(newEntry.GetKey()) ) { - //KeyHt[newEntry.GetKey()] = newEntry; KeyHt.insert( TagKeyHT::value_type (newEntry.GetKey(), newEntry)); - //NameHt[newEntry.GetName()] = newEntry; NameHt.insert( TagNameHT::value_type (newEntry.GetName(), newEntry )); @@ -237,7 +225,7 @@ bool Dict::RemoveEntry (uint16_t group, uint16_t element) * \brief Get the dictionnary entry identified by it's name. * @param name element of the ElVal to modify * \warning : NEVER use it ! - * the 'name' IS NOT an identifier within the Dicom Dicom Dictionary + * the 'name' IS NOT an identifier within the Dicom Dictionary * the name MAY CHANGE between two versions ! * @return the corresponding dictionnary entry when existing, NULL otherwise */ diff --git a/src/gdcmDictSet.cxx b/src/gdcmDictSet.cxx index afe0b079..04238f0b 100644 --- a/src/gdcmDictSet.cxx +++ b/src/gdcmDictSet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDictSet.cxx,v $ Language: C++ - Date: $Date: 2004/10/27 22:31:12 $ - Version: $Revision: 1.42 $ + Date: $Date: 2004/10/27 22:47:20 $ + Version: $Revision: 1.43 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -58,16 +58,7 @@ DictSet::~DictSet() Dicts.clear(); // Remove virtual dictionnary entries -/* TagKeyHT::iterator it; - for(it = VirtualEntry.begin(); it != VirtualEntry.end(); ++it) - { - DictEntry entry = it->second; - if ( entry ) - { - delete entry; - } - it->second = NULL; - }*/ + VirtualEntry.clear(); } //----------------------------------------------------------------------------- @@ -191,7 +182,6 @@ DictEntry *DictSet::NewVirtualDictEntry( uint16_t group, else { DictEntry ent(group, element, vr, fourth, name); - //VirtualEntry[tag] = entry; VirtualEntry.insert( TagKeyHT::value_type (tag, ent)); @@ -238,7 +228,7 @@ bool DictSet::AppendDict(Dict *newDict, DictKey const & name) { Dicts[name] = newDict; - return true; //FIXME + return true; } //----------------------------------------------------------------------------- -- 2.48.1