- * \ingroup gdcmHeader
- * \brief Get the dictionnary entry identified by a given tag (group,element)
- * @param group group of the entry to be found
- * @param element element of the entry to be found
- * @return the corresponding dictionnary entry when existing, NULL otherwise
+ * \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
+ {
+ gdcmWarningMacro( "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