[Insight-developers] Introducing itk::AutoPointer

Miller, James V (Research) millerjv at crd . ge . com
Fri, 31 May 2002 11:48:01 -0400


Is the FEMP version similar to what Ross had called
a "Copy On Write" pointer?  The "pointer" would hold a reference to 
the original object until you tried to modify it, at which time
it would finally do the expensive copy operation and modify the copy.

Maybe these are three different concepts:

1) AutoPointer - transfers ownership of a pointer.
2) CopyOnWritePointer
3) DeepCopyPointer - doesn't transfer ownership but does a DeepCopy


Luis, if you copy an auto pointer, is the original pointer invalidated?



-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez@kitware.com]
Sent: Friday, May 31, 2002 11:38 AM
To: Aljaz Noe
Cc: 'Insight Developers'
Subject: Re: [Insight-developers] Introducing itk::AutoPointer



Aljaz,

Great !,

Maybe we can fuse this two classes.

The only difference I can see in the
implementation of the itkFEMP is the
deep copy which seems to be the default
operation in construction and assignment.

The AutoPointer has as default action
to copy the raw pointer and release
the ownership in the original holder,
so it is more a transfer than a copy.

I have almost finished the modification
in my local checkout. The files involved are:

M Code/Common/itkCellBoundary.h
M Code/Common/itkCellBoundary.txx
M Code/Common/itkCellInterface.h
M Code/Common/itkCellInterface.txx
M Code/Common/itkHexahedronCell.h
M Code/Common/itkHexahedronCell.txx
M Code/Common/itkLineCell.h
M Code/Common/itkLineCell.txx
M Code/Common/itkMesh.h
M Code/Common/itkMesh.txx
M Code/Common/itkPolygonCell.h
M Code/Common/itkPolygonCell.txx
M Code/Common/itkQuadrilateralCell.h
M Code/Common/itkQuadrilateralCell.txx
M Code/Common/itkTetrahedronCell.h
M Code/Common/itkTetrahedronCell.txx
M Code/Common/itkTriangleCell.h
M Code/Common/itkTriangleCell.txx
M Code/Common/itkVertexCell.h
M Code/Common/itkVertexCell.txx
M Testing/Code/Common/CMakeLists.txt
M Testing/Code/Common/itkCommonTests.cxx
M Testing/Code/Common/itkMeshTest.cxx


Luis


================================================

Aljaz Noe wrote:

> There alerady is a similar thing in FEM code. It's called FEMP (file:
> itklFEMP.h). It basically does what you proposed. In addition to that,
> when the pointer is copied, the object that it's pointing to, is copied
> as well. FEM code uses it to store objects of polymorphic classes in stl
> containers.
> 
> Aljaz
> 
> 


_______________________________________________
Insight-developers mailing list
Insight-developers@public.kitware.com
http://public.kitware.com/mailman/listinfo/insight-developers