<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Change SYSTEM "https://itk.org/migrationv4/ITKMigration.dtd">
<!--**
**
** MetaArrowFixMemoryLeaksAndConvertToITKObject.xml
**
**
**-->
<Change>
    <!--**
    ** Title for the online migration page
    **-->
    <Title>
      Meta Arrow Fix Memory Leaks
    </Title>

    <!--**
    ** The author of the change
    **-->
    <Author>
      Luis Ibanez
    </Author>

    <!--**
    ** Date of creation for the XML document
    **-->
    <Date>
      2010-12-23
    </Date>

    <!--**
    ** Plain text description of the change
    ** Extracted from git commit messages
    **-->
    <Description>
      <![CDATA[
      A review of the MetaArrowConverter code revealed that this class does not
      use any state information (does not have any member variables) and therefore
      all of its methods can be declared static. The arguments of many of the methods
      were also missing to use a 'const' declaration, despite the fact that the execution
      of the function did not modified the content of the argument.

      The main API change here is that now MetaArrowConverter is an ITK object and
      it has to be constructed with the typical SmartPointer notation of

          MetaArrowConverterType::Pointer converter = MetaArrowConverterType::New();

      while before it could be constructed as:

          MetaArrowConverterType  converter;

      The default constructor has now been declared 'protected' so the second
      notation will result in compilation errors.

      BUG: MetaArrow memory leaks.
      MetaArrowConverter is now  an ITK Object and uses smart pointers.
      Several delete were added to places where irresponsible calls to new
      MetaArrow were done without regards for cleaning up the allocations.

      ENH: Fixing const in ArrowSpatialObject::GetLength.

      ENH: Making most methods of itkMetaArrowConverter to be static,
      since this class doesn&apos;t really have a state (no member variables).
      As pointed out by Brad Lowekamp during Gerrit review.
      ]]>
    </Description>

    <!--**
    ** Sample code snippets
    ** Extracted from git diff of changed files in Examples and Testing
    **-->
    <SampleCode>
      <Old>
        <![CDATA[
        typedef MetaArrowConverter<Dimension> MetaArrowConverterType;
        MetaArrowConverterType  converter;
        ]]>
      </Old>

      <New>
        <![CDATA[
         typedef MetaArrowConverter<Dimension> MetaArrowConverterType;
         MetaArrowConverterType::Pointer converter = MetaArrowConverterType::New();

         SpatialObjectPointer spatialObject = converter->ReadMeta( inputFilename );
         converter->WriterMeta( spatialObject, outputFilename );

         MetaArrow * arrow = GetArrowSomeHow();
         SpatialObjectPointer arrowObject = converter->MetaArrowToArrowSpatialObject( arrow );

         MetaArrow * anotherArrow = converter->ArrowSpatialObjectToMetaArrow( arrowObject );

         //
         // Or with the static notation:
         //
         SpatialObjectPointer spatialObject = MetaArrowConverterType::ReadMeta( inputFilename );
         MetaArrowConverterType::WriterMeta( spatialObject, outputFilename );

         MetaArrow * arrow = GetArrowSomeHow();
         SpatialObjectPointer arrowObject = MetaArrowConverterType::MetaArrowToArrowSpatialObject( arrow );

         MetaArrow * anotherArrow = MetaArrowConverterType::ArrowSpatialObjectToMetaArrow( arrowObject );
        ]]>
      </New>

    </SampleCode>

    <!--**
    ** The change-ids for all commits in the topic branch
    **-->
    <Gerrit-ChangeId>
      I6c4eafc97cf2c3859d9a624985494ebe680d6044
    </Gerrit-ChangeId>

    <!--**
    ** List of all changed files from the topic branch
    **-->
    <FileList>
      Code/SpatialObject/itkArrowSpatialObject.h
      Code/SpatialObject/itkMetaArrowConverter.h
      Code/SpatialObject/itkMetaArrowConverter.txx
      Code/SpatialObject/itkMetaSceneConverter.txx
      Testing/Code/SpatialObject/itkMetaArrowConverterTest.cxx
    </FileList>

    <!--**
    ** If the migration can be accomplished by a simple string
    ** substitution, then use the following construct to define
    ** the substitution rule.
    **
    ** <MigrationFix-Automatic>
    **   <Old>
    **     MipsleledName
    **   </Old>
    **   <New>
    **     MisspelledName
    **   </New>
    ** </MigrationFix-Automatic>
    **-->

    <!--**
    ** If the migration can NOT be accomplished by a simple string
    ** substitution, but potential problem spots can be identified,
    ** use the following construct to define a migration flag rule.
    **
    ** <MigrationFix-Manual>
    **   Invocations to default constructor must be replaced
    **   with the typical notation of SmartPointers.
    ** </MigrationFix-Manual>
    **-->

</Change>
