[vtk-developers] [Paraview-developers] Moving vtkMemberFunctionCommand to VTK

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Tue Oct 5 18:16:22 EDT 2010


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
>>>>
>>>
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: application/octet-stream
Size: 4933 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20101005/0d9b84f1/attachment-0001.obj>


More information about the vtk-developers mailing list