+/**
+ * \ingroup gdcmElValSet
+ * \brief Generate a free TagKey i.e. a TagKey that is not present
+ * in the TagHt dictionary. One of the potential usage is
+ * to add gdcm generated additional informartion to the ElValSet
+ * (see gdcmHeader::AddAndDefaultElements).
+ * @param group The generated tag must belong to this group.
+ * @return The element of tag with given group which is fee.
+ */
+guint32 gdcmElValSet::GenerateFreeTagKeyInGroup(guint32 group) {
+ for (guint32 elem = 0; elem < UINT32_MAX; elem++) {
+ TagKey key = gdcmDictEntry::TranslateToKey(group, elem);
+ if (tagHt.count(key) == 0)
+ return elem;
+ }
+ return UINT32_MAX;
+}
+
+int gdcmElValSet::SetElValueLengthByNumber(guint32 l,
+ guint32 group, guint32 element) {
+ TagKey key = gdcmDictEntry::TranslateToKey(group, element);
+ if ( ! tagHt.count(key))
+ return 0;
+ if (tagHt.count(key) > 1) {
+ dbg.Verbose(0, "gdcmElValSet::SetElValueLengthByNumber",
+ "multiple entries for this key (FIXME) !");
+ return (0);
+ }
+ tagHt[key]->SetLength(l);
+ return(1);
+}
+
+
+int gdcmElValSet::SetElValueLengthByName(guint32 l, string TagName) {
+ if ( ! NameHt.count(TagName))
+ return 0;
+ if (NameHt.count(TagName) > 1) {
+ dbg.Verbose(0, "gdcmElValSet::SetElValueByName",
+ "multipe entries for this key (FIXME) !");
+ return 0;
+ }
+ NameHt.find(TagName)->second->SetLength(l);
+ return(1);
+}