[Insight-developers] Roadblock in Filling CSwig wrapping gaps

Brad King brad.king at kitware.com
Wed Jan 12 16:28:47 EST 2005


Kent Williams wrote:
> I'm still having trouble with this.  Since itk::TreeNode is needed in 
> more than one wrapped class, I made a new file, and THAT file gets 
> errors indicating that SpatialObject is getting wrapped even though it 
> isn't in the _cable_ namespace.
[snip]
> Building object file wrap_itkTreeNodeTcl.o...
> /scratch/kent/brains2/iplFreeware/unpackdir/Insight/Code/SpatialObject/itkSpatialObject.txx: In destructor `SwigValueWrapper<T>::~SwigValueWrapper() [with T = itk::SpatialObject<2>]':
> /scratch/kent/brains2/iplFreeware/gcc3/DEBUG/Insight-build/Wrapping/CSwig/Algorithms/wrap_itkTreeNodeTcl.cxx:1571:   instantiated from here

This error reveals that itk::TreeNode< itk::SpatialObject<2> > is not 
actually a valid instantiation.  These methods appear in the TreeNode 
template:

   /** Set the current value of the node */
   TValueType Set(const TValueType data);

   /** Return the child position given a value */
   int ChildPosition( TValueType node ) const;

These pass instances of TValueType by value, which is not allowed for 
itk::SpatialObject<> because it derives from itk::LightObject.  The 
reason an error has not been seen is because no one is calling these 
methods on this instantiation right now.  If we were to be using 
explicit instantiation it would not compile.  The wrapping instantiates 
all methods by explicitly calling each one.  This is the source of the 
problem.

We need to fix this design problem.  Julien, can you comment on this please?

Thanks,
-Brad


More information about the Insight-developers mailing list