+1, can we add virtual keyword in front of the <span class="pun" style="color:rgb(102,102,0);font-family:'Lucida Console','Lucida Sans Typewriter',Monaco,monospace;font-size:10.909090995788574px;white-space:pre">~</span><span class="pln" style="font-family:'Lucida Console','Lucida Sans Typewriter',Monaco,monospace;font-size:10.909090995788574px;white-space:pre">className</span><span class="pun" style="color:rgb(102,102,0);font-family:'Lucida Console','Lucida Sans Typewriter',Monaco,monospace;font-size:10.909090995788574px;white-space:pre">()? </span><div>
<br></div><div>Or are you going to rely on the fact that the parent class has defined its destructor virtual (like vtkObject?) </div><div><br></div><div>Thanks!</div><div><div><font color="#666600" face="Lucida Console, Lucida Sans Typewriter, Monaco, monospace" size="1"><span style="white-space:pre"><br>
</span></font><br><div class="gmail_quote">On Thu, Sep 13, 2012 at 9:36 AM, Kyle Lutz <span dir="ltr"><<a href="mailto:kyle.lutz@kitware.com" target="_blank">kyle.lutz@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'd like to propose a new macro to ease the development of new<br>
vtkObject derived classes. When implementing new<br>
filters/algorithms/etc. a lot of boiler plate code is required and<br>
most often just copy-pasted from other similar classes. I've<br>
implemented a new macro named vtkObjectMacro() which reduces this<br>
boilerplate to a single line of code to be included in the class's<br>
declaration. This was inspired by the similar Q_OBJECT macro in Qt.<br>
<br>
Here is the documentation for the macro:<br>
<br>
// Description:<br>
// Declares a vtkObject subclass.<br>
//<br>
// Notably, performs the following actions:<br>
//   - invokes the vtkTypeMacro()<br>
//   - declares its constructor and destructor as protected<br>
//   - disables its copy constructor and assignment operator<br>
//   - declares its static *New() method<br>
//   - declares its PrintSelf() method<br>
#define vtkObjectMacro(className, parentClassName)<br>
<br>
For example, here is how it would be used when creating a new<br>
poly-data algorithm named MyFilter:<br>
<br>
// in myfilter.h<br>
class MyFilter : public vtkPolyDataAlgorithm<br>
{<br>
public:<br>
  vtkObjectMacro(MyFilter, vtkPolyDataAlgorithm)<br>
};<br>
<br>
// in myfilter.cxx<br>
vtkStandardNewMacro(MyFilter)<br>
MyFilter::MyFilter() { /* ... */ }<br>
MyFilter::~MyFilter() { /* ... */ }<br>
void MyFilter::PrintSelf(ostream &o, vtkIndent indent) { /* ... */ }<br>
<br>
I've pushed a topic to gerrit with the implementation:<br>
<a href="http://review.source.kitware.com/#/t/1276/" target="_blank">http://review.source.kitware.com/#/t/1276/</a><br>
<br>
Thoughts? Comments? Concerns?<br>
<br>
Thanks,<br>
Kyle<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>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>| Aashish Chaudhary <br>| R&D Engineer         <br>| Kitware Inc.            <br>| <a href="http://www.kitware.com">www.kitware.com</a>    <br>
</div></div>