[Insight-developers] Re: Modification to GetClassName and eliminiation of itkTypeMacro ?

Luis Ibanez luis . ibanez at kitware . com
Thu, 26 Jun 2003 17:46:07 -0400


Bill,

I'm not sure if this should replace the GetClassName().

We added the RTTI  symbol mostly for low-level debugging
pursposes.

One of the disadvantages of the RTTI symbol is that it
is not always easy to read, in  some platforms it returns
the C++ mangling of the type.

For example in Linux, the typeid().name() of the class

    itk::MeanImageFilter<
                 itk::Image<unsigned short, (unsigned)2>,
                 itk::Image<unsigned short, (unsigned)2>   >

will look like:

       N3itk15MeanImageFilterINS_5ImageItLj2EEES2_EE

Using the "c++filt" command it is possible to convert the
mangled name to the original one.

Another factor to consider is that the mangling itself is
platform specific, and sometimes Compiler-version
specific. E.g. the mangling of gcc 2.95 is different from
the one of gcc 3.2. If an application is relying on the name
of the class, this is something to take into account.

RTTI will also print the actual class being instantiated
(with all is template parameters) as opposed to GetClassName()
which will print just the name of the templated class.  e.g.

                      "MeanImageFilter"

This can be good or bad depending on what the purpose
of the Print() invokation is.

It will be probably a matter of checking what are the current
uses of  GetClassName()  method and see if the RTTI mangled
class name can substitute them.


My guess is that we may want to keep both of them,..



   Luis



---------------------------------------------------
Lorensen, William E (Research) wrote:

>Luis,
>I like the addition of RTTI type info to the PrintSelf.
>
>Should we replace the implementation of GetNameOfClass with 
> typeid( *this ).name()
>
>Then, we could eliminate the itkTypeMacro, which just implements a
>GetNameOfClass method.
>
>Bill
>
>  
>