[Insight-developers] Small modification to ImportImageContainer

Luis Ibanez luis.ibanez at kitware.com
Wed Apr 1 13:40:07 EDT 2009


Hi Tom,

Thanks a lot for sending the patch.

This version look a lot better.

The new implementation of the DeallocateManagedMemory()
has a better encapsulation.


It actually would be nice to have a symmetric method:

              AllocateManagedMemory(),

and to package in it the calls to:

   {
    m_ImportPointer = this->AllocateElements(size);
    m_Capacity = size;
    m_Size = size;
    m_ContainerManageMemory = true;
    this->Modified();
    }

that are repeated in Reserve().


but this could be part of a second commit...


I have no objections to the patch.


       Thanks


              Luis


----------------------------------------------------
On Tue, Mar 31, 2009 at 1:37 PM, Tom Vercauteren
<tom.vercauteren at m4x.org> wrote:
> Hi,
>
> Sorry for being so noisy on this topic.
>
> I have implemented a new version of ImportImageContainer. All the
> deallocation takes place within
>  virtual void DeallocateManagedMemory();
>
> Here is what this function does:
>  if (m_ImportPointer && m_ContainerManageMemory) delete [] m_ImportPointer;
>  m_ImportPointer = 0; m_Capacity = 0; m_Size = 0;
>
> I have also put the members of ImportImageContainer back into the
> private section and added some protected set accessors for them.
>
> The attached patch provides all these modifications together with an
> enhanced  itkObjectFactoryTest2 unit test. itkFactoryTestLib.cxx
> (which is used by itkObjectFactoryTest2) implements
> TestImportImageContainer, a class that derives from
> ImportImageContainer but uses a std::allocator instead of using new
> and delete .
>
> Let me know, if such a patch seems more appropriate.
>
> Regards,
> Tom
>


More information about the Insight-developers mailing list