+/**
+ * \brief Constructor : creates an empty DicomDir
+ */
+DicomDir::DicomDir()
+ :Document( )
+{
+ Initialize(); // sets all private fields to NULL
+ ParseDir = false;
+ NewMeta();
+}
+
+#ifndef GDCM_LEGACY_REMOVE
+/**
+ * \brief Constructor Parses recursively the directory and creates the DicomDir
+ * or uses an already built DICOMDIR, depending on 'parseDir' value.
+ * @param fileName name
+ * - of the root directory (parseDir = true)
+ * - of the DICOMDIR (parseDir = false)
+ * @param parseDir boolean
+ * - true if user passed an entry point
+ * and wants to explore recursively the directories
+ * - false if user passed an already built DICOMDIR file
+ * and wants to use it
+ * @deprecated use : new DicomDir() + [ SetLoadMode(lm) + ] SetDirectoryName(name)
+ * or : new DicomDir() + SetFileName(name)
+ */
+DicomDir::DicomDir(std::string const &fileName, bool parseDir ):
+ Document( )
+{
+ // At this step, Document constructor is already executed,
+ // whatever user passed (either a root directory or a DICOMDIR)
+ // and whatever the value of parseDir was.
+ // (nothing is cheked in Document constructor, to avoid overhead)
+
+ ParseDir = parseDir;
+ SetLoadMode (0x00000000); // concerns only dicom files
+ SetFileName( fileName );
+ Load( );
+}
+#endif
+
+/**
+ * \brief Canonical destructor
+ */
+DicomDir::~DicomDir()
+{
+ SetStartMethod(NULL,NULL,NULL);
+ SetProgressMethod(NULL,NULL,NULL);
+ SetEndMethod(NULL,NULL,NULL);
+
+ ClearPatient();
+ if ( MetaElems )
+ {
+ delete MetaElems;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Public
+
+/**
+ * \brief Loader. use SetFileName(fn)
+ * or SetLoadMode(lm) + SetDirectoryName(dn) before !
+ * @return false if file cannot be open or no swap info was found,
+ * or no tag was found.
+ */
+bool DicomDir::Load( )
+{
+ // We should clean out anything that already exists.
+ Initialize(); // sets all private fields to NULL
+
+ if (!ParseDir)
+ {
+ if ( ! this->Document::Load( ) )
+ return false;
+ }
+ return DoTheLoadingJob( );
+}
+
+#ifndef GDCM_LEGACY_REMOVE
+/**
+ * \brief Loader. (DEPRECATED : kept not to break the API)
+ * @param fileName file to be open for parsing
+ * @return false if file cannot be open or no swap info was found,
+ * or no tag was found.
+ * @deprecated use SetFileName(n) + Load() instead