- // instead of ReplaceOrCreateByNumber
- // that is a method of gdcmDocument :-(
- gdcmValEntry* entry = 0;
- gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element);
-
- if ( ! PtagHT->count(key))
- {
- // we assume a Public Dictionnary *is* loaded
- gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
- // if the invoked (group,elem) doesn't exist inside the Dictionary
- // we create a VirtualDictEntry
- gdcmDictEntry *dictEntry = pubDict->GetDictEntryByNumber(group,
- element);
- if (dictEntry == NULL)
- {
- dictEntry =
- gdcmGlobal::GetDicts()->NewVirtualDictEntry(group, element,
- "UN", "??", "??");
- }
- // we assume the constructor didn't fail
- entry = new gdcmValEntry(dictEntry);
- /// \todo
- /// ----
- /// better we don't assume too much !
- /// gdcmSQItem is now used to describe any DICOMDIR related object
- }
- else
- {
- gdcmDocEntry* foundEntry = PtagHT->find(key)->second;
- entry = dynamic_cast<gdcmValEntry*>(foundEntry);
- if (!entry)
- {
- dbg.Verbose(0, "gdcmSQItem::SetEntryByNumber: docEntries"
- " contains non gdcmValEntry occurences");
- }
- }
- if (entry)
- {
- entry->SetValue(val);
- }
- entry->SetLength(val.length());
- docEntries.insert(i,entry);
-