ITK/Deprecation Procedure: Difference between revisions

From KitwarePublic
< ITK
Jump to navigationJump to search
(New page: This page describes the procedure to be followed when deprecating code from ITK. The overall procedure involves the following: * Use itkLegacyMacros * Leave the deprecated methods for o...)
 
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__TOC__


This page describes the procedure to be followed when deprecating code from ITK.
This page describes the procedure to be followed when deprecating code from ITK.
Line 5: Line 7:


* Use itkLegacyMacros
* Use itkLegacyMacros
* Leave the deprecated methods for one release
* Leave the deprecated methods for backwards compatibility
* Remove at the next release.
* Remove at the next major release.  See also [http://semver.org/ semantic versioning].




Line 23: Line 25:


=== Insertion of Legacy Macros ===
=== Insertion of Legacy Macros ===
==== In the headers ====


   /**
   /**
Line 28: Line 32:
   */
   */
   itkLegacyMacro( virtual const GMatrixType & ComputeG(const InputVectorType& landmarkVector) const );
   itkLegacyMacro( virtual const GMatrixType & ComputeG(const InputVectorType& landmarkVector) const );
==== In the function bodies ====
  /**
  * This method has been deprecated as of ITK 3.6.
  * Please use the method: void ComputeG(vector,gmatrix) instead.
  */
  #if !defined(ITK_LEGACY_REMOVE)
  template <class TScalarType, unsigned int NDimensions>
  const typename ElasticBodyReciprocalSplineKernelTransform<TScalarType, NDimensions>::GMatrixType &
  ElasticBodyReciprocalSplineKernelTransform<TScalarType, NDimensions>::
  ComputeG( const InputVectorType & ) const
  {
    itkLegacyReplaceBodyMacro(itkElasticBodyReciprocalSplineKernelTransform::ComputeG_vector,
      3.6,itkElasticBodyReciprocalSplineKernelTransform::ComputeG_vector_gmatrix);
    return this->m_GMatrix;
  }
  #endif

Latest revision as of 21:12, 2 November 2014


This page describes the procedure to be followed when deprecating code from ITK.

The overall procedure involves the following:

  • Use itkLegacyMacros
  • Leave the deprecated methods for backwards compatibility
  • Remove at the next major release. See also semantic versioning.


Example

KernelTransforms case

In the KernelTransforms we replaced the method

  Matrix & ComputeG();

with the method

  void ComputeG( Matrix & m );


Insertion of Legacy Macros

In the headers

 /**
  * \deprecated in ITK 3.6, please use void ComputeG(vector,gmatrix) instead.
  */
 itkLegacyMacro( virtual const GMatrixType & ComputeG(const InputVectorType& landmarkVector) const );

In the function bodies

 /**
  * This method has been deprecated as of ITK 3.6.
  * Please use the method: void ComputeG(vector,gmatrix) instead.
  */
 #if !defined(ITK_LEGACY_REMOVE)
 template <class TScalarType, unsigned int NDimensions>
 const typename ElasticBodyReciprocalSplineKernelTransform<TScalarType, NDimensions>::GMatrixType &
 ElasticBodyReciprocalSplineKernelTransform<TScalarType, NDimensions>::
 ComputeG( const InputVectorType & ) const
 {
   itkLegacyReplaceBodyMacro(itkElasticBodyReciprocalSplineKernelTransform::ComputeG_vector,
     3.6,itkElasticBodyReciprocalSplineKernelTransform::ComputeG_vector_gmatrix);
   return this->m_GMatrix;
 }
 #endif