[Insight-developers] Deriving non-itk classes from itk classes

Brad King brad.king@kitware.com
Wed, 17 Jan 2001 13:33:38 -0500 (EST)


> The NewMacro would look like:
> 
> #define itkNewMacro(x) \
> static Pointer New(void) \
> { \
>   x *ret = itk::ObjectFactory<x>::Create(); \     // Here adding itk::
>   if(ret != NULL) \
>     { \
>     return ret; \
>     } \
>   return new x; \
> }
> Could that be a problem for other classes ?
> Is there a better way around this ?

If we fully qualify the name, as in "::itk::ObjectFactory<x>::Create()"
(note the leading ::), then it should work in all cases.  The purpose of
itkNewMacro, though, is to make a consistent New() method for all itk
classes.  We might want to consider just writing the New() method by hand 
for the new class if it won't be part of itk (?).

-Brad