[Insight-developers] Compile time errors for umimplemented methods

Jeffrey Duda jtduda at seas.upenn.edu
Tue Jul 19 16:06:20 EDT 2011


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
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110719/534b8970/attachment.htm>


More information about the Insight-developers mailing list