+ ReadAndSkipEncapsulatedBasicOffsetTable();
+
+ // Loop on the fragments[s] and store the parsed information in a
+ // JPEGInfo.
+ long fragmentLength;
+ while ( (fragmentLength = ReadTagLength(0xfffe, 0xe000)) )
+ {
+ long fragmentOffset = ftell(Fp);
+
+ // Store the collected info
+ JPEGFragment* newFragment = new JPEGFragment;
+ newFragment->Offset = fragmentOffset;
+ newFragment->Length = fragmentLength;
+ JPEGInfo->Fragments.push_back( newFragment );
+
+ SkipBytes( fragmentLength );
+ }
+
+ // Make sure that at the end of the item we encounter a 'Sequence
+ // Delimiter Item':
+ if ( !ReadTag(0xfffe, 0xe0dd) )
+ {
+ dbg.Verbose(0, "Document::ComputeRLEInfo: no sequence delimiter ");
+ dbg.Verbose(0, " item at end of JPEG item sequence");
+ }
+}
+
+/**
+ * \brief Walk recursively the given \ref DocEntrySet, and feed
+ * the given hash table (\ref TagDocEntryHT) with all the
+ * \ref DocEntry (Dicom entries) encountered.
+ * This method does the job for \ref BuildFlatHashTable.
+ * @param builtHT Where to collect all the \ref DocEntry encountered
+ * when recursively walking the given set.
+ * @param set The structure to be traversed (recursively).
+ */
+void Document::BuildFlatHashTableRecurse( TagDocEntryHT& builtHT,
+ DocEntrySet* set )
+{
+ if (ElementSet* elementSet = dynamic_cast< ElementSet* > ( set ) )
+ {
+ TagDocEntryHT* currentHT = elementSet->GetTagHT();
+ for( TagDocEntryHT::const_iterator i = currentHT->begin();
+ i != currentHT->end();
+ ++i)
+ {
+ DocEntry* entry = i->second;
+ if ( SeqEntry* seqEntry = dynamic_cast<SeqEntry*>(entry) )
+ {
+ ListSQItem& items = seqEntry->GetSQItems();
+ for( ListSQItem::const_iterator item = items.begin();
+ item != items.end();
+ ++item)
+ {
+ BuildFlatHashTableRecurse( builtHT, *item );
+ }
+ continue;
+ }
+ builtHT[entry->GetKey()] = entry;
+ }
+ return;
+ }
+
+ if (SQItem* SQItemSet = dynamic_cast< SQItem* > ( set ) )
+ {
+ ListDocEntry& currentList = SQItemSet->GetDocEntries();
+ for (ListDocEntry::iterator i = currentList.begin();
+ i != currentList.end();
+ ++i)