[Insight-developers] Best method for a do-nothing return-valuefunction
M Stauffer (V)
mstauff at verizon.net
Fri Dec 17 21:03:16 EST 2010
Yes, it should simply return the input value. This is so the base class
can be used by default w/out it actually doing anything.
Cheers,
Michael
>-----Original Message-----
>From: Hans Johnson [mailto:hans-johnson at uiowa.edu]
>Sent: Friday, December 17, 2010 7:29 PM
>To: M Stauffer (V); ITK
>Subject: Re: [Insight-developers] Best method for a do-nothing
>return-valuefunction
>
>Do you ever intend to use the base class Evaluate? If not, you should
>probably make it an abstract member function that only defines
>the intended
>interface.
>
>TValue Evaluate( TValue value ) = 0;
>
>Hans
>--
>Hans J. Johnson, Ph.D.
>Hans-johnson at uiowa.edu
>
>278 GH
>The University of Iowa
>Iowa City, IA 52241
>(319) 353 8587
>
>
>> From: "M Stauffer (V)" <mstauff at verizon.net>
>> Date: Fri, 17 Dec 2010 18:09:34 -0500
>> To: ITK <insight-developers at itk.org>
>> Subject: [Insight-developers] Best method for a do-nothing
>> return-valuefunction
>>
>> Hi,
>>
>> I'm not sure how to phrase the subject. I'm creating a function base
>> class whose "Evaluate", i.e. do-its-thing, method needs to
>simply return
>> the input value. Derived classes will modify the value in
>some way, not
>> surprisingly.
>>
>> Is there a more efficient way to implement this than what I
>have below?
>> I figure most compilers will actually make this inline, but maybe not
>> all?
>>
>> < typename TValue >
>> class FunctionBase {
>>
>> ...
>> inline TValue Evaluate( TValue value ) { return value; }
>> ...
>>
>> };
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>
More information about the Insight-developers
mailing list