+
+/**
+ * \brief Clear the std::list from given entry AND delete the entry.
+ * @param entryToRemove Entry to remove AND delete.
+ * @return true if the entry was found and removed; false otherwise
+ */
+bool SQItem::RemoveEntry( DocEntry *entryToRemove )
+{
+ for(ListDocEntry::iterator it = DocEntries.begin();
+ it != DocEntries.end();
+ ++it)
+ {
+ if( *it == entryToRemove )
+ {
+ DocEntries.erase(it);
+ gdcmWarningMacro( "One element erased: " << entryToRemove->GetKey() );
+ delete entryToRemove;
+ return true;
+ }
+ }
+ gdcmWarningMacro( "Entry not found: " << entryToRemove->GetKey() );
+ return false ;
+}
+
+/**
+ * \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
+ */
+bool SQItem::RemoveEntryNoDestroy(DocEntry *entryToRemove)
+{
+ for(ListDocEntry::iterator it = DocEntries.begin();
+ it != DocEntries.end();
+ ++it)
+ {
+ if( *it == entryToRemove )
+ {
+ DocEntries.erase(it);
+ gdcmWarningMacro( "One element erased, no destroyed: "
+ << entryToRemove->GetKey() );
+ return true;
+ }
+ }
+
+ gdcmWarningMacro( "Entry not found:" << entryToRemove->GetKey() );
+ return false ;
+}
+
+/**
+ * \brief Remove all entry in the Sequence Item
+ */
+void SQItem::ClearEntry()
+{
+ for(ListDocEntry::iterator cc = DocEntries.begin();
+ cc != DocEntries.end();
+ ++cc)
+ {
+ delete *cc;
+ }
+ DocEntries.clear();
+}
+
+/**
+ * \brief Get the first Dicom entry while visiting the SQItem
+ * \return The first DocEntry if found, otherwhise 0
+ */
+DocEntry *SQItem::GetFirstEntry()
+{
+ ItDocEntries = DocEntries.begin();
+ if( ItDocEntries != DocEntries.end() )
+ return *ItDocEntries;
+ return 0;
+}
+
+/**
+ * \brief Get the next Dicom entry while visiting the SQItem
+ * \return The next DocEntry if found, otherwhise NULL
+ */
+DocEntry *SQItem::GetNextEntry()
+{
+ ++ItDocEntries;
+ if( ItDocEntries != DocEntries.end() )
+ return *ItDocEntries;
+ return NULL;
+}
+
+/**
+ * \brief Gets a Dicom Element inside a SQ Item 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
+ */
+DocEntry *SQItem::GetDocEntry(uint16_t group, uint16_t elem)
+{
+ for(ListDocEntry::iterator i = DocEntries.begin();
+ i != DocEntries.end();
+ ++i)
+ {
+ if ( (*i)->GetGroup() == group && (*i)->GetElement() == elem )
+ return *i;
+ }
+ return NULL;
+}
+