[Insight-developers] SmartPointer comparison operators

Luis Ibanez luis.ibanez@kitware.com
Thu, 09 May 2002 13:46:49 -0400


Hi Josh,


There is a new convention.  

1) Methods receiving pointers are  still receiving
     raw pointers ('const' whenever possible).

2) Methods returning itk::Objects should return
     them  as raw pointers unless the object has
     been constructed inside the method and no
      ivar is holding a smart pointer to it.

3) When the returned object is an ivar. The
     class should just use: itkGetObjectMacro()
    (that has been modified to return raw pointers).

4)  The reception of the method's result can still
      be used with a SmartPointer:  for example:.

ImagePointer myImage  = filter->GetOutput();

 but the actual type returned by GetOutput() is now

                  ImageType *

4) Polymorphism will be easier since most of
the returned types are now raw pointers.
As part of the changes, a lot of "GetPointer()"
calls are being removed because they are
unecessary.

5)  Some of the methods in the Watershed
 framework, the Classification framework
and the SpatialObject framwork were left
returning smartpointers because it wan't clear
for us how the changes could affect other
classes interacting with them That will probably
be done in a second pass.



Thanks


     Luis


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

Joshua Cates wrote:

>Hi Luis,
>
>>At this moment we are changing all the GetOutput() and GetInput()
>>methods on the toolkit for returning raw pointers instead of SmartPointer.
>>
>
>
>Does this extend to other methods?  Currently, the convention is:
>
> smartpointer Function( pointer ) { return smartpointer; }
>
>And for polymorphism you call GetPointer() on the smart pointer.
>
>
>Is there a new convention?
>
>Josh.
>
>
>
>
>______________________________
> Josh Cates
> School of Computer Science
> University of Utah
> Email: cates@sci.utah.edu <mailto:cates@sci.utah.edu>
> Phone: (801) 587-7697
> URL:   www.cs.utk.edu/~cates <http://www.cs.utk.edu/%7Ecates>
>
>
>
>_______________________________________________
>Insight-developers mailing list
>Insight-developers@public.kitware.com <mailto:Insight-developers@public.kitware.com>
>http://pub
>lic.kitware.com/mailman/listinfo/insight-developers <http://public.kitware.com/mailman/listinfo/insight-developers>
>