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

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Tue Oct 5 18:13:45 EDT 2010


Attached another patch which keeps the same API, but that compiles :).

Sample usage:

class vtkSomeClass : public vtkObject
{
public:
  ....
   void OnEvent()
    {
    cout << "Callback invoked" << endl;
    }
};

int TestObserver()
{

   object->AddObserver<A>(vtkCommand::AnyEvent,
    object, &A::Callback);
  object->InvokeEvent(vtkCommand::ModifiedEvent);
  object->Delete();
}


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