]> Creatis software - gdcm.git/commitdiff
ENH: Try to reuse result from a map query, eventhough this is optimised we should...
authormalaterre <malaterre>
Mon, 18 Oct 2004 02:31:58 +0000 (02:31 +0000)
committermalaterre <malaterre>
Mon, 18 Oct 2004 02:31:58 +0000 (02:31 +0000)
src/gdcmDict.cxx
src/gdcmDict.h
src/gdcmDictSet.cxx

index 8662d1513c4e2901bb85f18edac83bc0e6a3eeeb..a8a80f2b520225d73681f12e9ef5efa9edb6db5c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDict.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/18 02:17:06 $
-  Version:   $Revision: 1.46 $
+  Date:      $Date: 2004/10/18 02:31:58 $
+  Version:   $Revision: 1.47 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -191,11 +191,12 @@ bool Dict::ReplaceEntry(DictEntry *newEntry)
  * @param   key (group|element)
  * @return  false if Dicom Dictionary Entry doesn't exist
  */
-bool Dict::RemoveEntry(TagKey key) 
+bool Dict::RemoveEntry(TagKey const & key) 
 {
-   if(KeyHt.count(key) == 1) 
+   TagKeyHT::const_iterator it = KeyHt.find(key);
+   if(it != KeyHt.end()) 
    {
-      DictEntry* entryToDelete = KeyHt.find(key)->second;
+      DictEntry* entryToDelete = it->second;
 
       if ( entryToDelete )
       {
@@ -235,11 +236,12 @@ bool Dict::RemoveEntry (uint16_t group, uint16_t element)
  */
 DictEntry* Dict::GetDictEntryByName(TagName const & name)
 {
-   if ( !NameHt.count(name))
+   TagNameHT::const_iterator it = NameHt.find(name);
+   if ( it == NameHt.end() )
    {
       return 0;
    }
-   return NameHt.find(name)->second;
+   return it->second;
 }
 
 /**
@@ -251,11 +253,12 @@ DictEntry* Dict::GetDictEntryByName(TagName const & name)
 DictEntry* Dict::GetDictEntryByNumber(uint16_t group, uint16_t element)
 {
    TagKey key = DictEntry::TranslateToKey(group, element);
-   if ( !KeyHt.count(key) )
+   TagKeyHT::const_iterator it = KeyHt.find(key);
+   if ( it == KeyHt.end() )
    {
       return 0;
    }
-   return KeyHt.find(key)->second;
+   return it->second;
 }
 
 /** 
index b6152da2f634baf63e0db3b2ce0d557087802d51..8f1c8379e715fc39bb85c24f2c979c1ebfbe837b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDict.h,v $
   Language:  C++
-  Date:      $Date: 2004/10/18 02:17:06 $
-  Version:   $Revision: 1.20 $
+  Date:      $Date: 2004/10/18 02:31:58 $
+  Version:   $Revision: 1.21 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -59,7 +59,7 @@ public:
 // Entries
    bool AddNewEntry (DictEntry *newEntry);
    bool ReplaceEntry(DictEntry *newEntry);
-   bool RemoveEntry (TagKey key);
+   bool RemoveEntry (TagKey const & key);
    bool RemoveEntry (uint16_t group, uint16_t element);
    
 // Tag
index 53c1ff3c543c3d042045960e975a541a3eeebc0f..5993675bced31b532f20c4d800dffc684d1335f6 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDictSet.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/18 02:17:07 $
-  Version:   $Revision: 1.39 $
+  Date:      $Date: 2004/10/18 02:31:58 $
+  Version:   $Revision: 1.40 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -141,10 +141,10 @@ EntryNamesByCatMap * DictSet::GetPubDictEntryNamesByCategory()
  * @param   name Symbolic name that be used as identifier of the newly 
  *          created dictionary.
  */
-Dict *DictSet::LoadDictFromFile(std::string const & fileName, 
+Dict *DictSet::LoadDictFromFile(std::string const & filename, 
                                 DictKey const & name) 
 {
-   Dict *newDict = new Dict(fileName);
+   Dict *newDict = new Dict(filename);
    AppendDict(newDict, name);
 
    return newDict;