+ else
+ {
+ val = GDCM_UNFOUND;
+ }
+
+ if ( val == GDCM_UNFOUND)
+ {
+ if ( tmpGr == 0x0004 ) // never present in File !
+ {
+ switch (tmpEl)
+ {
+ case 0x1130: // File-set ID
+ // force to the *end* File Name
+ val = Util::GetName( path );
+ break;
+
+ case 0x1500: // Only used for image
+ if ( header->GetFileName().substr(0, path.length()) != path )
+ {
+ gdcmWarningMacro( "The base path of file name is incorrect");
+ val = header->GetFileName();
+ }
+ else
+ {
+ //val = &(header->GetFileName().c_str()[path.length()+1]);
+ val = &(header->GetFileName().c_str()[path.length()]);
+ }
+ break;
+
+ case 0x1510: // Referenced SOP Class UID in File
+ referencedVal = header->GetEntryString(0x0008, 0x0016);
+ // FIXME : probabely something to check
+ val = referencedVal;
+ break;
+
+ case 0x1511: // Referenced SOP Instance UID in File
+ referencedVal = header->GetEntryString(0x0008, 0x0018);
+ // FIXME : probabely something to check
+ val = referencedVal;
+ break;
+
+ case 0x1512: // Referenced Transfer Syntax UID in File
+ referencedVal = header->GetEntryString(0x0002, 0x0010);
+ // FIXME : probabely something to check
+ val = referencedVal;
+ break;
+
+ default :
+ val = it->Value;
+ }
+ }
+ }
+ else
+ {
+ if ( header->GetEntryLength(tmpGr,tmpEl) == 0 )
+ val = it->Value;
+ }
+
+/* FIX later the pb of creating the 'Implementation Version Name'!
+
+ if (val == GDCM_UNFOUND)
+ val = "";
+
+ if ( tmpGr == 0x0002 && tmpEl == 0x0013)
+ {
+ // 'Implementation Version Name'
+ std::string val = "GDCM ";
+ val += Util::GetVersion();
+ }
+*/
+ entry->SetString( val ); // troubles expected when vr=SQ ...
+
+ if ( type == GDCM_DICOMDIR_META ) // fusible : should never print !
+ {
+ gdcmDebugMacro("GDCM_DICOMDIR_META ?!? should never print that");
+ }
+ si->AddEntry(entry);
+ entry->Delete();
+ }
+}
+
+/**
+ * \brief Move the content of the source SQItem to the destination SQItem
+ * Only DocEntry's are moved
+ * @param dst destination SQItem
+ * @param src source SQItem
+ */
+void DicomDir::MoveSQItem(DocEntrySet *dst, DocEntrySet *src)
+{
+ DocEntry *entry;
+// todo : rewrite the whole stuff, without using RemoveEntry an AddEntry,
+// to save time
+ entry = src->GetFirstEntry();
+ while(entry)
+ {
+ dst->AddEntry(entry); // use it, *before* removing it!
+ src->RemoveEntry(entry);
+ // we destroyed -> the current iterator is not longer valid
+ entry = src->GetFirstEntry();
+ }
+}
+
+/**
+ * \brief compares two files
+ */
+bool DicomDir::HeaderLessThan(Document *header1, Document *header2)
+{
+ return *header1 < *header2;
+}
+
+//-----------------------------------------------------------------------------
+// Print
+/**
+ * \brief Canonical Printer
+ * @param os ostream we want to print in
+ * @param indent Indentation string to be prepended during printing
+ */
+void DicomDir::Print(std::ostream &os, std::string const & )
+{
+ if ( MetaElems )
+ {
+ MetaElems->SetPrintLevel(PrintLevel);
+ MetaElems->Print(os);
+ }
+ for(ListDicomDirPatient::iterator cc = Patients.begin();
+ cc != Patients.end();
+ ++cc)
+ {
+ (*cc)->SetPrintLevel(PrintLevel);
+ (*cc)->Print(os);