[Insight-developers] MakeOutput : Raw pointer... Smart pointer ?

Antonin Perrot-Audet antonin07130 at gmail.com
Fri Apr 1 11:57:32 EDT 2011


Hello,

I still have trouble understanding the function of
ProcessObject::MakeOutput
method.

I have a filter with multiple outputs, and I must admit that I have 
trouble understanding the principle of the example provided in
itkEigenAnalysis2DImageFilter
MakeOutput seems to *return a RAW pointer instead of a SMART POINTER* ?

template< class TInputImage, class TEigenValueImage, class 
TEigenVectorImage >
DataObject::Pointer
EigenAnalysis2DImageFilter< TInputImage, TEigenValueImage, 
TEigenVectorImage >
::MakeOutput(unsigned int idx)
{
   DataObject::Pointer output;

   switch ( idx )
     {
     case 0:
       output = ( EigenValueImageType::New() ).GetPointer();
       break;
     case 1:
       output = ( EigenValueImageType::New() ).GetPointer();
       break;
     case 2:
       output = ( EigenVectorImageType::New() ).GetPointer();
       break;
     }
   return output.GetPointer();
}

Can anyone give me more insights about *when to return smart pointers 
and raw pointers* ?

Thanks,
-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110401/b7163880/attachment.htm>


More information about the Insight-developers mailing list