]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDir.cxx
Avoid Doxygen Warnings
[gdcm.git] / src / gdcmDicomDir.cxx
index 0a9a714244c26bdef80e039535f130fe13ab57c6..1a47080925328ad312a6fd473843c6a7315c4d0f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/11/07 10:14:44 $
-  Version:   $Revision: 1.172 $
+  Date:      $Date: 2005/11/29 12:48:45 $
+  Version:   $Revision: 1.176 $
   
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -37,6 +37,7 @@
 #include "gdcmSeqEntry.h"
 #include "gdcmSQItem.h"
 #include "gdcmDataEntry.h"
+#include "gdcmCommandManager.h"
 
 #include <fstream>
 #include <string>
@@ -117,7 +118,6 @@ namespace gdcm
  * \brief   Constructor : creates an empty DicomDir
  */
 DicomDir::DicomDir()
-         :Document( )
 {
    Initialize();  // sets all private fields to NULL
    ParseDir = false;
@@ -129,10 +129,6 @@ DicomDir::DicomDir()
  */
 DicomDir::~DicomDir() 
 {
-   SetStartMethod(NULL,NULL,NULL);
-   SetProgressMethod(NULL,NULL,NULL);
-   SetEndMethod(NULL,NULL,NULL);
-
    ClearPatient();
    if ( MetaElems )
    {
@@ -159,32 +155,6 @@ bool DicomDir::Load( )
    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
- */
-bool DicomDir::Load(std::string const &fileName ) 
-{
-   SetFileName(fileName);
-   return Load();
-}
-
-/// DEPRECATED : use SetDirectoryName(dname) instead
-/* *
- * \brief   Loader. (DEPRECATED : kept not to break the API)
- * @param   paseDir Parse Dir
- * @deprecated use SetDirectoryName(dname) instead
- */
-void DicomDir::SetParseDir(bool parseDir)
-{
-   ParseDir = parseDir;
-}
-#endif
-
 /**
  * \brief   Does the Loading Job (internal use only)
  * @return false if file cannot be open or no swap info was found,
@@ -371,117 +341,6 @@ void DicomDir::ParseDirectory()
    CreateDicomDir();
 }
 
-void DicomDir::SetStartMethod( DicomDir::Method *method, void *arg )
-{
-   SetStartMethod(method,arg,NULL);
-}
-
-void DicomDir::SetProgressMethod( DicomDir::Method *method, void *arg )
-{
-   SetProgressMethod(method,arg,NULL);
-}
-
-void DicomDir::SetEndMethod( DicomDir::Method *method, void *arg )
-{
-   SetEndMethod(method,arg,NULL);
-}
-
-/**
- * \brief   Set the start method to call when the parsing of the
- *          directory starts.
- * @param   method Method to call
- * @param   arg    Argument to pass to the method
- * @param   argDelete    Argument 
- * \warning In python : the arg parameter isn't considered
- */
-void DicomDir::SetStartMethod( DicomDir::Method *method, void *arg, 
-                               DicomDir::Method *argDelete )
-{
-   if ( StartArg && StartMethodArgDelete )
-   {
-      StartMethodArgDelete( StartArg );
-   }
-
-   StartMethod          = method;
-   StartArg             = arg;
-   StartMethodArgDelete = argDelete;
-}
-
-
-/**
- * \brief   Set the progress method to call when the parsing of the
- *          directory progress
- * @param   method Method to call
- * @param   arg    Argument to pass to the method
- * @param   argDelete    Argument  
- * \warning In python : the arg parameter isn't considered
- */
-void DicomDir::SetProgressMethod( DicomDir::Method *method, void *arg, 
-                                  DicomDir::Method *argDelete )
-{
-   if ( ProgressArg && ProgressMethodArgDelete )
-   {
-      ProgressMethodArgDelete( ProgressArg );
-   }
-
-   ProgressMethod          = method;
-   ProgressArg             = arg;
-   ProgressMethodArgDelete = argDelete;
-}
-
-/**
- * \brief   Set the end method to call when the parsing of the directory ends
- * @param   method Method to call
- * @param   arg    Argument to pass to the method
- * @param   argDelete    Argument 
- * \warning In python : the arg parameter isn't considered
- */
-void DicomDir::SetEndMethod( DicomDir::Method *method, void *arg, 
-                             DicomDir::Method *argDelete )
-{
-   if ( EndArg && EndMethodArgDelete )
-   {
-      EndMethodArgDelete( EndArg );
-   }
-
-   EndMethod          = method;
-   EndArg             = arg;
-   EndMethodArgDelete = argDelete;
-}
-
-/**
- * \brief   Set the method to delete the argument
- *          The argument is destroyed when the method is changed or when the
- *          class is destroyed
- * @param   method Method to call to delete the argument
- */
-void DicomDir::SetStartMethodArgDelete( DicomDir::Method *method ) 
-{
-   StartMethodArgDelete = method;
-}
-
-/**
- * \brief   Set the method to delete the argument
- *          The argument is destroyed when the method is changed or when the 
- *          class is destroyed          
- * @param   method Method to call to delete the argument
- */
-void DicomDir::SetProgressMethodArgDelete( DicomDir::Method *method )
-{
-   ProgressMethodArgDelete = method;
-}
-
-/**
- * \brief   Set the method to delete the argument
- *          The argument is destroyed when the method is changed or when
- *          the class is destroyed
- * @param   method Method to call to delete the argument
- */
-void DicomDir::SetEndMethodArgDelete( DicomDir::Method *method )
-{
-   EndMethodArgDelete = method;
-}
-
 /**
  * \brief    writes on disc a DICOMDIR
  * \ warning does NOT add the missing elements in the header :
@@ -576,6 +435,33 @@ bool DicomDir::Anonymize()
    return true;
 }
 
+/**
+ * \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 DicomDir::Copy(DocEntrySet *set)
+{
+   // Remove all previous childs
+   ClearPatient();
+
+   Document::Copy(set);
+
+   DicomDir *dd = dynamic_cast<DicomDir *>(set);
+   if( dd )
+   {
+      if(MetaElems)
+         MetaElems->Unregister();
+      MetaElems = dd->MetaElems;
+      if(MetaElems)
+         MetaElems->Register();
+
+      Patients = dd->Patients;
+      for(ItPatient = Patients.begin();ItPatient != Patients.end();++ItPatient)
+         (*ItPatient)->Register();
+   }
+}
+
 //-----------------------------------------------------------------------------
 // Protected
 /**
@@ -644,10 +530,7 @@ void DicomDir::CallStartMethod()
 {
    Progress = 0.0f;
    Abort    = false;
-   if ( StartMethod )
-   {
-      StartMethod( StartArg );
-   }
+   CommandManager::ExecuteCommand(this,CMD_STARTPROGRESS);
 }
 
 /**
@@ -655,10 +538,7 @@ void DicomDir::CallStartMethod()
  */
 void DicomDir::CallProgressMethod()
 {
-   if ( ProgressMethod )
-   {
-      ProgressMethod( ProgressArg );
-   }
+   CommandManager::ExecuteCommand(this,CMD_PROGRESS);
 }
 
 /**
@@ -667,10 +547,7 @@ void DicomDir::CallProgressMethod()
 void DicomDir::CallEndMethod()
 {
    Progress = 1.0f;
-   if ( EndMethod )
-   {
-      EndMethod( EndArg );
-   }
+   CommandManager::ExecuteCommand(this,CMD_ENDPROGRESS);
 }
 
 //-----------------------------------------------------------------------------
@@ -680,16 +557,6 @@ void DicomDir::CallEndMethod()
  */
 void DicomDir::Initialize()
 {
-   StartMethod             = NULL;
-   ProgressMethod          = NULL;
-   EndMethod               = NULL;
-   StartMethodArgDelete    = NULL;
-   ProgressMethodArgDelete = NULL;
-   EndMethodArgDelete      = NULL;
-   StartArg                = NULL;
-   ProgressArg             = NULL;
-   EndArg                  = NULL;
-
    Progress = 0.0;
    Abort = false;
 
@@ -812,7 +679,7 @@ void DicomDir::CreateDicomDir()
         continue;
       }
       if ( si )
-         si->MoveObject(tmpSI);  // New code : Copies the List
+         si->Copy(tmpSI);
 
       tmpSI=s->GetNextSQItem();
    }