[Insight-developers] Compile time errors for umimplemented methods

Bill Lorensen bill.lorensen at gmail.com
Tue Jul 19 16:09:49 EDT 2011


You may be stuck with runtime exceptions. Unless you can rearrange the
class hierarchy and add another base class.

It's hard to solve with limited info. e-mail is not so good for this.
I suggest a few of you get in a room and figure it out.


On Tue, Jul 19, 2011 at 4:06 PM, Jeffrey Duda <jtduda at seas.upenn.edu> wrote:
> Right. I now realize that my question was incomplete. What we want is to
> have these methods be pure virtual in the base class, implement them in the
> derived classes for which we know how to implement them and have other
> derived classes, that we are still thinking about how to implement
> correctly, throw compile-time errors if the method is referenced. For now we
> could put in run time exceptions for these "in-progress" methods, but we
> were hoping to avoid that since it seems less informative for the user.
> -jeff
>
> On Tue, Jul 19, 2011 at 3:17 PM, Bill Lorensen <bill.lorensen at gmail.com>
> wrote:
>>
>> You could define those required methods as pure virtual in the base
>> class. This would require an implementer to think about what to do in
>> the derived class.
>>
>> Bill
>>
>> On Tue, Jul 19, 2011 at 2:16 PM, Jeffrey Duda <jtduda at seas.upenn.edu>
>> wrote:
>> > Hi,
>> > I've been working on some of the changes related to Transforms and was
>> > hoping for some guidance on how to best deal with umimplemented methods
>> > in
>> > derived classes. This is best described with an example:
>> > in the Transform base class we have two methods for transforming a
>> > vector:
>> > 1 - TransformVector( vector )
>> > 2 - TransformVector( vector, point )
>> > The second is needed for transforms that vary spatially (i.e.
>> > deformation
>> > fields). For linear transforms, the point is simply ignored since it is
>> > unnecessary, however since the point is required for a
>> > DeformationFieldTransform, the implementation of the first method
>> > currently
>> > throws an exception at run time. I was wondering if/how we could have
>> > this
>> > result in a compile-time error instead.
>> > -jeff
>> > _______________________________________________
>> > 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