-//-----------------------------------------------------------------------------
-// Public
-/*
- * \ingroup gdcmDicomDir
- * \brief This predicate, based on hopefully reasonable heuristics,
- * decides whether or not the current gdcmParser was properly parsed
- * and contains the mandatory information for being considered as
- * a well formed and usable DicomDir.
- * @return true when gdcmParser is the one of a reasonable DicomDir,
- * false otherwise.
+/**
+ * \brief adds *the* Meta to a partially created DICOMDIR
+ */
+DicomDirMeta *DicomDir::NewMeta()
+{
+ if( MetaElems )
+ delete MetaElems;
+
+ DocEntry *entry = GetFirstEntry();
+ if( entry )
+ {
+ MetaElems = new DicomDirMeta(true);
+
+ entry = GetFirstEntry();
+ while( entry )
+ {
+ if( dynamic_cast<SeqEntry *>(entry) )
+ break;
+
+ RemoveEntryNoDestroy(entry);
+ MetaElems->AddEntry(entry);
+
+ entry = GetFirstEntry();
+ }
+ }
+ else // after root directory parsing
+ {
+ MetaElems = new DicomDirMeta(false);
+ }
+ MetaElems->SetSQItemNumber(0); // To avoid further missprinting
+ return MetaElems;
+}
+
+/**
+ * \brief adds a new Patient (with the basic elements) to a partially created
+ * DICOMDIR
+ */
+DicomDirPatient *DicomDir::NewPatient()
+{
+ DicomDirPatient *p = new DicomDirPatient();
+ AddPatientToEnd( p );
+ return p;
+}
+
+/**
+ * \brief Remove all Patients
+ */
+void DicomDir::ClearPatient()
+{
+ for(ListDicomDirPatient::iterator cc = Patients.begin();
+ cc!= Patients.end();
+ ++cc)
+ {
+ delete *cc;
+ }
+ Patients.clear();
+}
+
+/**
+ * \brief Get the first entry while visiting the DicomDirPatients
+ * \return The first DicomDirPatient if found, otherwhise NULL
+ */
+DicomDirPatient *DicomDir::GetFirstPatient()
+{
+ ItPatient = Patients.begin();
+ if ( ItPatient != Patients.end() )
+ return *ItPatient;
+ return NULL;
+}
+
+/**
+ * \brief Get the next entry while visiting the DicomDirPatients
+ * \note : meaningfull only if GetFirstEntry already called
+ * \return The next DicomDirPatient if found, otherwhise NULL