<div class="gmail_quote">On Fri, Sep 24, 2010 at 12:38 PM, Utkarsh Ayachit <span dir="ltr"><<a href="mailto:utkarsh.ayachit@kitware.com" target="_blank">utkarsh.ayachit@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Couple of suggestions:<br>
<br>
1> I think we should change the API to be:<br>
<br>
SetCallback(ClassT* ...) rather than SetCallback(ClassT& ..)<br>
<br>
That makes the mode more VTK-like when reading:<br>
<br>
I'd prefer:<br>
<br>
obs->SetCallback(this, &vtkMySelf::CallbackHandler);<br>
<br>
to the current implementation i.e.:<br>
<br>
obs->SetCallback(*this, &vtkMySelf::CallbackHandler);<br>
<br>
2> We should use vtkWeakPointer for the Object ptr, to avoid dangling pointers.<br>
<br>
3> The documentation needs to be fixed. Currently there are errors in<br>
it, the usage described does not really match the real usage :).<br>
<br>
4> Another possibility is simply moving the code to vtkCommand.h.<br>
<br>
Like David said, let's wait a week to see if people respond, otherwise<br>
I will make those changes and move the header to VTK/Common.<br>
<font color="#888888"><br>
Utkarsh<br>
</font><div><div></div><div><br></div></div></blockquote><div><br></div>Is there a way to skip the adapter all together? That is, rather than:</div><div class="gmail_quote"><br></div><div class="gmail_quote"><div class="gmail_quote">
adapter = vtkMemberFunctionCommand<CustomStyle>::New();</div><div class="gmail_quote">adapter->SetCallback(*this, &CustomStyle::CatchWidgetEvent);</div><div class="gmail_quote">tracer->AddObserver(vtkCommand::EndInteractionEvent, this->Adapter);</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">could we just do something like:</div><div class="gmail_quote"><br></div>tracer->Add<b>Class</b>Observer(vtkCommand::EndInteractionEvent, CatchWidgetEvent);</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">and have it automatically deal with the 'this' pointer and the name of the class?</div><div class="gmail_quote"><br><div>David</div></div>