]> Creatis software - gdcm.git/blobdiff - src/gdcmElementSet.cxx
* src/gdcmDocEntryArchive.[h|cxx] : bug fix and add a method to temporary
[gdcm.git] / src / gdcmElementSet.cxx
index 37340268a3fe5510c328290063ee13f2c59d83b8..42639f89265d435529a3f93397bd236d102c28ee 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmElementSet.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/11/16 10:37:54 $
-  Version:   $Revision: 1.28 $
+  Date:      $Date: 2004/11/24 10:23:47 $
+  Version:   $Revision: 1.31 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -44,12 +44,11 @@ ElementSet::ElementSet(int depthLevel)
  */
 ElementSet::~ElementSet() 
 {
-  for(TagDocEntryHT::iterator cc = TagHT.begin();cc != TagHT.end(); ++cc)
+   for(TagDocEntryHT::iterator cc = TagHT.begin();cc != TagHT.end(); ++cc)
    {
-      DocEntry* entryToDelete = cc->second;
-      if ( entryToDelete )
+      if ( cc->second )
       {
-         delete entryToDelete;
+         delete cc->second;
       }
    }
    TagHT.clear();
@@ -147,6 +146,8 @@ bool ElementSet::RemoveEntryNoDestroy(DocEntry* entryToRemove)
 /**
  * \brief   Clear the hash table from given entry AND delete the entry.
  * @param   entryToRemove Entry to remove AND delete.
+ * \warning Some problems when using under Windows... prefer the use of
+ *          Initialize / GetNext methods
  */
 bool ElementSet::RemoveEntry( DocEntry* entryToRemove)
 {
@@ -162,4 +163,33 @@ bool ElementSet::RemoveEntry( DocEntry* entryToRemove)
    dbg.Verbose(0, "ElementSet::RemoveEntry: key not present: ");
    return false ;
 }
+
+/**
+ * \brief   Initialise the visit of the Hash table (TagHT)
+ */
+void ElementSet::Initialize()
+{
+   ItTagHT = TagHT.begin();
+}
+
+/**
+ * \brief   Get the next entry whil visiting the Hash table (TagHT)
+ * \return  The next DocEntry if found, otherwhise NULL
+ */
+DocEntry *ElementSet::GetNextEntry()
+{
+   if (ItTagHT != TagHT.end())
+   {
+      DocEntry *tmp = ItTagHT->second;
+      ++ItTagHT;
+
+      return(tmp);
+   }
+   else
+   {
+      return(NULL);
+   }
+}
+
+//-----------------------------------------------------------------------------
 } // end namespace gdcm