<div class="gmail_quote">On Sat, Aug 15, 2009 at 8:52 AM, David Doria <span dir="ltr"><<a href="mailto:daviddoria%2Bvtk@gmail.com">daviddoria+vtk@gmail.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;">
<br><br><div class="gmail_quote"><div class="im">On Fri, Aug 14, 2009 at 11:38 PM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.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;">
David,<br>
<br>
Be aware that adding a const version of the get macro may affect<br>
wrapping. I believe that vtkParse.l handles vtkGetMacro, but there is<br>
not provision to handle a GetConstMacro.<br>
<br>
Bill<br>
<div><div></div><div></div></div></blockquote></div><div><br>In /..../itk/src/Code/Common/itkMacro.h there is simply<br>
<br>
#define itkGetConstMacro(name,type) \<br>
virtual type Get##name () const \<br>
{ \<br>
itkDebugMacro("returning " << #name " of " << this->m_##name ); \<br>
return this->m_##name; \<br>
}<br>
<br>
To make the const macro, this could just be changed to:<br>
<br>
#define vtkGetConstMacro(name,type) \<br>
virtual type Get##name () const { \<br>
vtkDebugMacro(<< this->GetClassName() << " ("
<< this << "): returning " << #name " of " <<
this->m_name ); \<br>
return this->m_name; \<br>
}<br>
<br>
(copied from /..../vtk/src/Common/vtkSetGet.h ) which was:<br>
#define vtkGetMacro(name,type) \<br>
virtual type Get##name () { \<br>
vtkDebugMacro(<< this->GetClassName() << " (" <<
this << "): returning " << #name " of " <<
this->name ); \<br>
return this->name; \<br>
} <br>
<br>
@Bill, I have no idea about wrapping - so if someone sees a problem can
you please take a look? Was there a reason that this const get method
was omited in the first place?<br>
<br>
Object macros :<br>
<br>
I am a bit confused about the ObjectMacros. In vtkSetGet.h, it says
vtkSetObjectMacro should be used in the h file and vtkCxxSetObjectMacro
should be used in the cxx file. But the comment for
vtkCxxSetObjectMacro says you have to actually put<br>
virtual void Set"name"("type" *);<br>
in the header file... so then what would be the use of vtkSetObjectMacro? and why is there no vtkCxxGetObjectMacro?<br>
<br>
Thanks,<br><br>David <br></div></div>
</blockquote></div><br>Ok so what is the bottom line? Just don't use const get functions? Or
just write them manually (but then the class cannot be wrapped, is that correct?)<br>
<br>
<span style="line-height: 15px; white-space: pre-wrap;">Any comments on the missing vtkCxxGetObjectMacro ? I was looking for this to try to make an accessor for a custom type variable - am I misunderstanding the ObjectMacro idea?<br>
<br clear="all"><br></span>Thanks,<br><br>David<br>