There are some other exceptions (for which we don't have a solution for wrapping). See the new array classes vtkTypedArray, vtkSparseArray, vtkDenseArray. My expectation that these classes will never be wrapped.<br><br>
-berk<br><br><div class="gmail_quote">On Sat, Feb 6, 2010 at 12:09 PM, David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Sat, Feb 6, 2010 at 11:07 AM, David Doria <span dir="ltr"><<a href="mailto:daviddoria%2Bvtk@gmail.com" target="_blank">daviddoria+vtk@gmail.com</a>></span> wrote:<br></div><div class="gmail_quote">
<div><div></div><div class="h5"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Is there any reason we can't have a templated single input, single output filter?<div><br></div><div>Currently, it looks like the preferred method is to derive from the class *Algorithm of the intended output type and change the input type in the FillInputPortInformation function.</div>



<div><br></div><div>Lets take an example of a filter which takes as input a vtkPointSet and produces a vtkPolyData:</div><div><br></div><div><u><b>Current method:</b></u></div><div><br></div><div>class MyFilter : vtkPolyDataAlgorithm</div>



<div><br></div><div><div>int MyFilter::FillInputPortInformation( int port, vtkInformation* info )</div><div>{</div><div>  if (port == 0)</div><div>    {</div><div>    info->Set( vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPointSet" );</div>



<div>    return 1;</div><div>    }</div><div><br></div><div>  return 0;</div><div>}</div><div><br></div><div><b><u>Proposed method:</u></b></div><div><b><u><br></u></b></div><div>class MyFilter : vtkFilter<vtkPointSet, vtkPolyData></div>



<div><b><u><br></u></b></div><div><b><u><br></u></b></div><div>Thoughts? I may be over my head in template programming and pipeline stuff, but maybe the experts can discuss/comment?</div><div><br></div></div><div>Thanks,<br>


<br>David<br>

</div>
<br></blockquote><div><br></div></div></div><div>As others have commented, please avoid using templates. It complicates the wrapping mechanisms used to build python, java and tcl wrappers for VTK. When wrapped, only concrete instantiations of templates may be wrapped, and since there is usually no template mechanism in the target languages, the only way to do it is to invent a mangled name for use in the target language. It gets pretty ugly pretty fast.</div>

<div><br></div><div>The official policy should be:</div><div>-- no C++ template parameters allowed in:</div><div>  -- class declarations of public classes that derive from vtkObject</div><div>  -- public method signatures of those same classes</div>

<div><br></div><div>Of course, you may use templates internal to a *.cxx file as long as they do not affect the API.</div><div><br></div><div>I don't know if this policy is expressed anywhere, (anybody from the ARB listening?) and there is a single violation of it (that I know of) that we certainly don't want to propagate to other uses.</div>

<div><br></div><div><br></div><div>Thanks,</div><div>David C.</div><div><br></div><div><br></div><div>P.S. - The subclasses of vtkDataArrayTemplate and the trickery we use with #define vtkDataArray are the single violation I speak of. Look it up, it's not pretty.</div>

<div><br></div><div>For example, from vtkLongArray.h:</div><div><p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(0, 132, 0);">
// Fake the superclass for the wrappers.</p>
<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(120, 73, 42);">#define vtkDataArray vtkDataArrayTemplate<long></p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><span style="color: rgb(186, 45, 162);">class</span> VTK_COMMON_EXPORT vtkLongArray : <span style="color: rgb(186, 45, 162);">public</span> vtkDataArray</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(120, 73, 42);">#undef vtkDataArray</p>
<div><font color="#78492a" face="Monaco" size="4"><span style="font-size: 14px;"><br>
</span></font></div></div></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br></blockquote></div><br>