- * \ingroup gdcmHeader
- * \brief Print all the dictionary entries contained in this dictionary.
- * Entries will be sorted by the name of the dictionary entries.
- * @param os The output stream to be written to.
+ * \brief adds a new Dicom Dictionary Entry
+ * @param newEntry entry to add
+ * @return false if Dicom Element already exists
+ */
+bool Dict::AddEntry(DictEntry const &newEntry)
+{
+ const TagKey &key = newEntry.GetKey();
+
+ if ( KeyHt.count(key) == 1 )
+ {
+ gdcmWarningMacro( "Already present" << key.c_str());
+ return false;
+ }
+ else
+ {
+ KeyHt.insert( TagKeyHT::value_type(newEntry.GetKey(), newEntry));
+ return true;
+ }
+}
+
+/**
+ * \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