]> Creatis software - gdcm.git/blobdiff - src/gdcmFile.cxx
ENH: Adding a deprecation mechanism to gdcm via two MACRO and two config options
[gdcm.git] / src / gdcmFile.cxx
index b33765ad47eab787f9cc6d1374ce7727fc857b09..09a9e8fd1a932439fb442300e9a2f4d2b71b5047 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/07/02 18:09:36 $
-  Version:   $Revision: 1.246 $
+  Date:      $Date: 2005/07/19 14:43:48 $
+  Version:   $Revision: 1.250 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -65,12 +65,12 @@ File::File():
  * @param  filename name of the file whose header we want to analyze
  */
 File::File( std::string const &filename )
-     :Document(filename)
+     :Document( )
 {    
    RLEInfo  = new RLEFramesInfo;
    JPEGInfo = new JPEGFragmentsInfo;
 
-   Load( filename );
+   Load( filename ); // gdcm::Document is first Loaded, then the 'File part'
 }
 
 /**
@@ -86,16 +86,26 @@ File::~File ()
 
 //-----------------------------------------------------------------------------
 // Public
-
 /**
  * \brief   Loader  
- * @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.
  */
-bool File::Load( std::string const &fileName ) 
+bool File::Load( ) 
+{
+   if ( ! this->Document::Load( ) )
+      return false;
+
+    return DoTheLoadingJob( );   
+}
+
+/**
+ * \brief   Does the Loading Job (internal use only)
+ * @return false if file cannot be open or no swap info was found,
+ *         or no tag was found.
+ */
+bool File::DoTheLoadingJob( ) 
 {
-   this->Document::Load( fileName );
 
    // for some ACR-NEMA images GrPixel, NumPixel is *not* 7fe0,0010
    // We may encounter the 'RETired' (0x0028, 0x0200) tag
@@ -1701,6 +1711,27 @@ void File::ReadAndSkipEncapsulatedBasicOffsetTable()
    }
 }
 
+// These are the deprecated method that one day should be removed (after the next release)
+#ifndef GDCM_LEGACY_REMOVE
+/**
+ * \brief   Loader. (DEPRECATED : 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 the Load() function instead
+ */
+bool File::Load( std::string const &fileName ) 
+{
+   GDCM_LEGACY_REPLACED_BODY(File::Load(std::string), "1.2",
+                             File::Load());
+   SetFileName( fileName );
+   if ( ! this->Document::Load( ) )
+      return false;
+
+   return DoTheLoadingJob( );
+}
+#endif
+
 //-----------------------------------------------------------------------------
 // Print