+
+/**
+ * \brief replaces an already existing Dicom Element by a new one
+ * @param newEntry new entry (overwrites any previous one with same tag)
+ * @return false if Dicom Element doesn't exist
+ */
+bool Dict::ReplaceEntry(DictEntry const &newEntry)
+{
+ if ( RemoveEntry(newEntry.GetKey()) )
+ {
+ KeyHt.insert( TagKeyHT::value_type(newEntry.GetKey(), newEntry));
+ return true;
+ }
+ return false;
+}
+
+/**
+ * \brief removes an already existing Dicom Dictionary Entry,
+ * identified by its Tag
+ * @param key (group|element)
+ * @return false if Dicom Dictionary Entry doesn't exist
+ */
+bool Dict::RemoveEntry (TagKey const &key)
+{
+ TagKeyHT::const_iterator it = KeyHt.find(key);
+ if(it != KeyHt.end())
+ {
+ KeyHt.erase(key);
+
+ return true;
+ }
+ else
+ {
+ gdcmVerboseMacro( "Unfound entry" << key.c_str());
+ return false;
+ }
+}
+
+/**
+ * \brief removes an already existing Dicom Dictionary Entry,
+ * identified by its group,element number
+ * @param group Dicom group number of the Dicom Element
+ * @param elem Dicom element number of the Dicom Element
+ * @return false if Dicom Dictionary Entry doesn't exist
+ */
+bool Dict::RemoveEntry (uint16_t group, uint16_t elem)
+{
+ return RemoveEntry(DictEntry::TranslateToKey(group, elem));
+}
+
+/**
+ * \brief Get the dictionary entry identified by a given tag (group,element)
+ * @param group group of the entry to be found
+ * @param elem element of the entry to be found
+ * @return the corresponding dictionary entry when existing, NULL otherwise
+ */
+DictEntry *Dict::GetEntry(uint16_t group, uint16_t elem)
+{
+ TagKey key = DictEntry::TranslateToKey(group, elem);
+ TagKeyHT::iterator it = KeyHt.find(key);
+ if ( it == KeyHt.end() )
+ {
+ return 0;
+ }
+ return &(it->second);
+}
+
+/**
+ * \brief Get the first entry while visiting the Dict entries
+ * \return The first DicEntry if found, otherwhise NULL
+ */
+DictEntry *Dict::GetFirstEntry()
+{
+ ItKeyHt = KeyHt.begin();
+ if( ItKeyHt != KeyHt.end() )
+ return &(ItKeyHt->second);
+ return NULL;
+}
+
+/**
+ * \brief Get the next entry while visiting the Hash table (KeyHt)
+ * \note : meaningfull only if GetFirstEntry already called
+ * \return The next DictEntry if found, otherwhise NULL
+ */
+DictEntry *Dict::GetNextEntry()
+{
+ gdcmAssertMacro (ItKeyHt != KeyHt.end());
+
+ {
+ ++ItKeyHt;
+ if (ItKeyHt != KeyHt.end())
+ return &(ItKeyHt->second);
+ }
+ return NULL;
+}
+
+//-----------------------------------------------------------------------------
+// Protected
+
+//-----------------------------------------------------------------------------
+// Private
+
+//-----------------------------------------------------------------------------
+
+} // end namespace gdcm