[Insight-developers] Function hooks in itk::ProcessObject: (function pointers vs virtual methods)

Luis Ibanez ibanez at cs.unc.edu
Tue Sep 12 11:29:59 EDT 2000


Hi,

There is a set of hooks for functions on itk::ProcessObject.
Most of them intended for getting some feedback from the
state of the process that can potentially be used for GUI.

Among them:

ProgressMethod()
StartMethod()
EndMethod()

This is implemented now as a  set of pointers to functions
of type  :        void  f(void);

In order to plug the particular functions, there are two choices

A) they are standard functions (not methods of any class)
B) they are static functions of a class.

The first option disrupts a little an Object Oriented design.
The second limits the kind of things that can be done on this
functions.


A possible better way to implement these hooks is just as
virtual methods that can be overloaded in a class deriving
from the itk::ProcessObject.

So, instead of passing pointers to functions to a particular filter.
We'll derive the filter and reimplement some of these functions.

The Execute() method will then be able to call all these functions
in a more natural (and secure) way.

If our particular implementation uses these methods to communicate
with other classes, the references (or smart pointers) to these
classes will be stored in the class deriving from itk::ProcessObject.


What do you say ?


Luis






More information about the Insight-developers mailing list