[vtk-developers] [Paraview-developers] Moving vtkMemberFunctionCommand to VTK
David Gobbi
david.gobbi at gmail.com
Tue Oct 5 18:31:53 EDT 2010
In the example, is the <A> needed?
object->AddObserver<A>(vtkCommand::AnyEvent, handler, &vtkSomeClass::OnEvent);
David
On Tue, Oct 5, 2010 at 4:16 PM, Utkarsh Ayachit
<utkarsh.ayachit at kitware.com> wrote:
> Oops hit send accidentally, here's the intended message:
> ------------------------------------------------------------------------------------------------------
> Attached another patch which keeps the same API, but that compiles :).
>
> Sample usage:
>
> class vtkSomeClass : public vtkObject
> {
> public:
> ....
> void OnEvent()
> {
> cout << "Callback invoked" << endl;
> }
> };
>
> void TestObserver()
> {
> vtkSomeOtherClass* object = vtkSomeOtherClass::New();
> vtkSomeClass* handler = vtkSomeClass::New();
> object->AddObserver<A>(vtkCommand::AnyEvent, handler, &vtkSomeClass::OnEvent);
> ..
> }
>
>>
>> On Mon, Oct 4, 2010 at 9:47 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>> Having a templated public class method seems to be essential in
>>> order for this to work. I'd vote for having it committed as-is.
>>> This is adding a feature that is already taken for granted in the
>>> wrapper languages, kind of like vtkSmartPointer.
>>>
>>> David
>>>
>>> On Mon, Oct 4, 2010 at 7:20 PM, Utkarsh Ayachit
>>> <utkarsh.ayachit at kitware.com> wrote:
>>>> Cool. There is some implementation nuances that need to be ironed out
>>>> (template visibility etc. etc.). Once I have it figured out, I'll
>>>> commit it.
>>>>
>>>> Utkarsh
>>>>
>>>> On Mon, Oct 4, 2010 at 5:42 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>>>> Nice, it hides the vtkCommand mechanism and makes AddObserver()
>>>>> much easier to use. In fact this makes AddObserver() work the same
>>>>> as it does in the wrapper languages. It looks like the right thing to do.
>>>>>
>>>>> David
>>>>>
>>>>>
>>>>> On Mon, Oct 4, 2010 at 10:29 AM, Utkarsh Ayachit
>>>>> <utkarsh.ayachit at kitware.com> wrote:
>>>>>> Folks,
>>>>>>
>>>>>> Attached is an possible implementation for the same.
>>>>>>
>>>>>> Any comments?
>>>>>>
>>>>>> Utkarsh
>>>>>
>>>>
>>>
>>
>
More information about the vtk-developers
mailing list