<span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px;background-color:rgb(255,255,255)">vtkClassMacro is probably better (keeping in mind that would like to add something like vtkAbstractClassMacro) </span><br>
<br><div class="gmail_quote">On Thu, Sep 13, 2012 at 9:55 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">
<div class="im">On Thu, Sep 13, 2012 at 6:49 AM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<br>
</div><div class="im">> I think it's a great idea.  An additional macro would be needed for<br>
> abstract classes.  Actually, because these macros are used in class<br>
> definition (not object declarations per se), I would propose:<br>
><br>
> vtkClassMacro(class,superclass);<br>
> vtkAbstractClassMacro(class,superclass);<br>
<br>
</div>We were talking about adding an additional macro for abstract classes<br>
but I wanted to start with just one. Later a macro for abstract<br>
classes could be added.<br>
<br>
I am also open to changing the name depending on what the consensus is.<br>
<span class="HOEnZb"><font color="#888888"><br>
-kyle<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
>  - David<br>
><br>
> On Thu, Sep 13, 2012 at 7:36 AM, Kyle Lutz <<a href="mailto:kyle.lutz@kitware.com">kyle.lutz@kitware.com</a>> wrote:<br>
>> 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>
_______________________________________________<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>
</div></div></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>