+
+/**
+ * \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);
+ gdcmDebugMacro( "One element erased: " << entryToRemove->GetKey() );
+ entryToRemove->Unregister();
+ 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)
+ {
+ (*cc)->Unregister();
+ }
+ 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;
+}
+
+/**
+ * \brief Copies all the attributes from an other DocEntrySet
+ * @param set entry to copy from
+ * @remarks The contained DocEntries a not copied, only referenced
+ */
+void SQItem::Copy(DocEntrySet *set)
+{
+ // Remove all previous entries
+ ClearEntry();
+
+ DocEntrySet::Copy(set);
+
+ SQItem *sq = dynamic_cast<SQItem *>(set);
+ if( sq )
+ {
+ SQDepthLevel = sq->SQDepthLevel;
+ SQItemNumber = sq->SQItemNumber;
+
+ DocEntries = sq->DocEntries;
+ for(ItDocEntries = DocEntries.begin();ItDocEntries != DocEntries.end();++ItDocEntries)
+ (*ItDocEntries)->Register();
+ }
+}
+