Program: gdcm
Module: $RCSfile: gdcmSQItem.cxx,v $
Language: C++
- Date: $Date: 2005/01/19 08:55:09 $
- Version: $Revision: 1.54 $
+ Date: $Date: 2005/01/24 16:10:53 $
+ Version: $Revision: 1.57 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/*
* \brief canonical Writer
+ * @param fp file pointer to an already open file.
+ * @param filetype type of the file (ACR, ImplicitVR, ExplicitVR, ...)
*/
void SQItem::WriteContent(std::ofstream *fp, FileType filetype)
{
// Public
/**
* \brief adds any Entry (Dicom Element) to the Sequence Item
+ * @param entry Entry to add
*/
bool SQItem::AddEntry(DocEntry *entry)
{
* \warning we suppose, right now, the element belongs to a Public Group
* (NOT a shadow one)
* @param val string value to set
- * @param group Group number of the searched tag.
+ * @param group Group number of the searched tag.
* @param elem Element number of the searched tag.
* @return true if element was found or created successfully
*/
-bool SQItem::SetEntry(std::string const &val, uint16_t group,
+bool SQItem::SetEntryValue(std::string const &val, uint16_t group,
uint16_t elem)
{
for(ListDocEntry::iterator i = DocEntries.begin();
Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
// if the invoked (group,elem) doesn't exist inside the Dictionary
// we create a VirtualDictEntry
- DictEntry *dictEntry = pubDict->GetDictEntry(group, elem);
+ DictEntry *dictEntry = pubDict->GetEntry(group, elem);
if (dictEntry == NULL)
{
dictEntry =
}
/**
- * \brief Clear the hash table from given entry AND delete the entry.
+ * \brief Clear the std::list from given entry AND delete the entry.
* @param entryToRemove Entry to remove AND delete.
- * \warning Some problems when using under Windows... prefer the use of
- * Initialize / GetNext methods
* @return true if the entry was found and removed; false otherwise
*/
bool SQItem::RemoveEntry( DocEntry* entryToRemove)
if( *it == entryToRemove)
{
DocEntries.erase(it);
- gdcmVerboseMacro( "One element erased.");
+ gdcmVerboseMacro( "One element erased: " << entryToRemove->GetKey() );
delete entryToRemove;
return true;
}
}
- gdcmVerboseMacro( "Value not present.");
+ gdcmVerboseMacro( "Entry not found: " << entryToRemove->GetKey() );
return false ;
}
/**
- * \brief Clear the hash table from given entry BUT keep the entry.
+ * \brief Clear the std::list from given entry BUT keep the entry.
* @param entryToRemove Entry to remove.
* @return true if the entry was found and removed; false otherwise
*/
if( *it == entryToRemove)
{
DocEntries.erase(it);
- gdcmVerboseMacro( "One element erased.");
+ gdcmVerboseMacro( "One element erased, no destroyed: "
+ << entryToRemove->GetKey() );
return true;
}
}
- gdcmVerboseMacro( "Value not present.");
+ gdcmVerboseMacro( "Entry not found:" << entryToRemove->GetKey() );
return false ;
}
/**
- * \brief Get the first entry while visiting the SQItem
+ * \brief Get the first Dicom entry while visiting the SQItem
* \return The first DocEntry if found, otherwhise 0
*/
DocEntry * SQItem::GetFirstEntry()
}
/**
- * \brief Get the next entry while visiting the chained list
+ * \brief Get the next Dicom entry while visiting the chained list
* \return The next DocEntry if found, otherwhise NULL
*/
DocEntry *SQItem::GetNextEntry()
{
- gdcmAssertMacro (ItDocEntries != DocEntries.end());
+ // gdcmAssertMacro (ItDocEntries != DocEntries.end());
{
++ItDocEntries;
if (ItDocEntries != DocEntries.end())
// Protected
/**
* \brief Gets a Dicom Element inside a SQ Item Entry
- * @param group Group number of the Entry
+ * @param group Group number of the Entry
* @param elem Element number of the Entry
* @return Entry whose (group,elem) was passed. 0 if not found
*/
/**
* \brief Gets a Dicom Element inside a SQ Item Entry
- * @param group Group number of the Entry
+ * @param group Group number of the Entry
* @param elem Element number of the Entry
* @return Entry whose (group,elem) was passed. 0 if not found
*/
* GDCM_UNFOUND if not found
*/
-std::string SQItem::GetEntry(uint16_t group, uint16_t elem)
+std::string SQItem::GetEntryValue(uint16_t group, uint16_t elem)
{
+
+/*
+ DocEntry *e = GetFirstEntry();
+ while (e)
+ {
+ if ( e->GetGroup() == group && e->GetElement() == elem)
+ {
+
+ if (ValEntry *ve = dynamic_cast<ValEntry*>(e))
+ return ve->GetValue();
+ }
+ e = GetNextEntry();
+ }
+*/
for(ListDocEntry::iterator i = DocEntries.begin();
i != DocEntries.end(); ++i)
{
if ( (*i)->GetGroup() == group && (*i)->GetElement() == elem)
{
- if (ValEntry *e = dynamic_cast<ValEntry*>(*i))
- return e->GetValue();
+ if (ValEntry *ve = dynamic_cast<ValEntry*>(*i))
+ return ve->GetValue();
}
}
return GDCM_UNFOUND;