- else
- {
- ValEntry = dynamic_cast< gdcmValEntry* >(CurrentEntry);
- if ( !ValEntry )
- {
- // We need to promote the gdcmDocEntry to a gdcmValEntry:
- ValEntry = new gdcmValEntry(CurrentEntry);
- if (!RemoveEntry(CurrentEntry))
- {
- dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: removal"
- " of previous DocEntry failed.");
- return NULL;
- }
- if ( !AddEntry(ValEntry))
- {
- dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: adding"
- " promoted ValEntry failed.");
- return NULL;
- }
- }
- }
-
- SetEntryByNumber(Value, Group, Elem);
-
- return ValEntry;
-}
-
-/*
- * \brief Modifies the value of a given Header Entry (Dicom Element)
- * when it exists. Create it with the given value when unexistant.
- * @param voidArea (binary) value to be set
- * @param Group Group number of the Entry
- * @param Elem Element number of the Entry
- * \return pointer to the modified/created Header Entry (NULL when creation
- * failed).
- */
-gdcmBinEntry * gdcmDocument::ReplaceOrCreateByNumber(
- void *voidArea,
- int lgth,
- guint16 Group,
- guint16 Elem)
-{
- gdcmDocEntry* a;
- gdcmBinEntry* b;
- a = GetDocEntryByNumber( Group, Elem);
- if (a == NULL) {
- a =NewBinEntryByNumber(Group, Elem);
- if (a == NULL)
- return NULL;
-
- b = new gdcmBinEntry(a);
- AddEntry(b);
- }
- SetEntryByNumber(voidArea, lgth, Group, Elem);
- b->SetVoidArea(voidArea);
-
- return b;
-}
-
-
-
-/**
- * \brief Set a new value if the invoked element exists
- * Seems to be useless !!!
- * @param Value new element value
- * @param Group group number of the Entry
- * @param Elem element number of the Entry
- * \return boolean
- */
-bool gdcmDocument::ReplaceIfExistByNumber(char* Value, guint16 Group, guint16 Elem )
-{
- std::string v = Value;
- SetEntryByNumber(v, Group, Elem);
- return true;
-}
-
-//-----------------------------------------------------------------------------
-// Protected
-
-/**
- * \brief Checks if a given Dicom Element exists within the H table
- * @param group Group number of the searched Dicom Element
- * @param element Element number of the searched Dicom Element
- * @return number of occurences
- */
-int gdcmDocument::CheckIfEntryExistByNumber(guint16 group, guint16 element ) {
- std::string key = gdcmDictEntry::TranslateToKey(group, element );
- return tagHT.count(key);
-}
-
-/**
- * \brief Searches within Header Entries (Dicom Elements) parsed with
- * the public and private dictionaries
- * for the element value of a given tag.
- * \warning Don't use any longer : use GetPubEntryByName
- * @param tagName name of the searched element.
- * @return Corresponding element value when it exists,
- * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
- */
-std::string gdcmDocument::GetEntryByName(std::string tagName) {
- gdcmDictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName);
- if( dictEntry == NULL)
- return GDCM_UNFOUND;
-
- return GetEntryByNumber(dictEntry->GetGroup(),dictEntry->GetElement());