+/**
+ * \brief Build a new DataEntry from all the low level arguments.
+ * @param group Group number of the new Entry
+ * @param elem Element number of the new Entry
+ * @param vr V(alue) R(epresentation) of the new Entry
+ * \remarks The user of this method must destroy the DataEntry when unused
+ */
+DataEntry *DocEntrySet::NewDataEntry(uint16_t group, uint16_t elem,
+ VRKey const &vr)
+{
+
+ DataEntry *newEntry = DataEntry::New(group, elem, vr);
+ if (!newEntry)
+ {
+ gdcmWarningMacro( "Failed to allocate DataEntry for ("
+ <<std::hex << group << "|" << elem <<")" );
+ return 0;
+ }
+ return newEntry;
+}
+
+/**
+ * \brief Build a new SeqEntry from all the low level arguments.
+ * @param group Group number of the new Entry
+ * @param elem Element number of the new Entry
+ * \remarks The user of this method must destroy the SeqEntry when unused
+ */
+SeqEntry* DocEntrySet::NewSeqEntry(uint16_t group, uint16_t elem)
+{
+ //DictEntry *dictEntry = GetDictEntry(group, elem, "SQ");
+
+ //SeqEntry *newEntry = SeqEntry::New( dictEntry );
+ SeqEntry *newEntry = SeqEntry::New( group, elem );
+ //dictEntry->Unregister(); // GetDictEntry register it
+ if (!newEntry)
+ {
+ gdcmWarningMacro( "Failed to allocate SeqEntry for ("
+ <<std::hex << group << "|" << elem <<")" );
+ return 0;
+ }
+ return newEntry;
+}
+
+//-----------------------------------------------------------------------------
+// Protected
+/**
+ * \brief Searches [both] the public [and the shadow dictionary (when they
+ * exist)] for the presence of the DictEntry with given
+ * group and element. The public dictionary has precedence on the
+ * shadow one(s), if any.
+ * @param group Group number of the searched DictEntry
+ * @param elem Element number of the searched DictEntry
+ * @return Corresponding DictEntry when it exists, NULL otherwise.
+ * \remarks The returned DictEntry is registered when existing
+ */
+DictEntry *DocEntrySet::GetDictEntry(uint16_t group,uint16_t elem)
+{
+ DictEntry *found = 0;
+ /// \todo store the DefaultPubDict somwhere, in order not to access the HTable
+ /// every time ! --> Done!
+ Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
+ if (!pubDict)
+ {
+ gdcmWarningMacro( "We SHOULD have a default dictionary");
+ }
+ else
+ {
+ found = pubDict->GetEntry(group, elem);
+ if( found )
+ found->Register();
+ }
+ return found;
+}