[vtkusers] Determining Actor type

Kenneth Porter shiva at sewingwitch.com
Sun Feb 21 06:15:45 EST 2010


--On Saturday, February 20, 2010 4:44 PM -0800 Kenneth Porter 
<shiva at sewingwitch.com> wrote:

> Sorry, I just did an eyeball inspection of the implementation. I guess I
> need to go back and see how this works with an intermediate class.

Ok, my mistake, I missed the treewalker line in the IsTypeOf implementation:

  static int IsTypeOf(const char *type) \
  { \
    if ( !strcmp(#thisClass,type) ) \
      { \
      return 1; \
      } \
    return superclass::IsTypeOf(type); \
  } \

The last line that invokes the superclass handles the intermediate classes 
by walking down the inheritance tree.

I would speculate that dynamic_cast is more efficient if you're already 
building with RTTI enabled. (It can do a pointer comparison instead of a 
string comparison.) If you suppress RTTI with a compiler option (for 
example, to reduce space in the binary) then the VTK implementation reduces 
the memory footprint to just providing the RTTI info for the VTK library. 
Is there another advantage to using the VTK mechanism?





More information about the vtkusers mailing list