VTK: Common/Core/vtkCallbackCommand.h Source File

| VTK 9.3.1

vtkCallbackCommand.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
41 #ifndef vtkCallbackCommand_h
42 #define vtkCallbackCommand_h
43
44 #include "vtkCommand.h"
45 #include "vtkCommonCoreModule.h" // For export macro
46
47 VTK_ABI_NAMESPACE_BEGIN
48 class VTKCOMMONCORE_EXPORT vtkCallbackCommand : public vtkCommand
49 {
50 public:
51 vtkTypeMacro(vtkCallbackCommand, vtkCommand);
52
53 static vtkCallbackCommand* New() { return new vtkCallbackCommand; }
54
61 void Execute(vtkObject* caller, unsigned long eid, void* callData) override;
62
67 virtual void SetClientData(void* cd) { this->ClientData = cd; }
68 virtual void* GetClientData() { return this->ClientData; }
69 virtual void SetCallback(
70 void (*f)(vtkObject* caller, unsigned long eid, void* clientdata, void* calldata))
71 {
72 this->Callback = f;
73 }
74 virtual void SetClientDataDeleteCallback(void (*f)(void*)) { this->ClientDataDeleteCallback = f; }
75
81 void SetAbortFlagOnExecute(int f) { this->AbortFlagOnExecute = f; }
82 int GetAbortFlagOnExecute() { return this->AbortFlagOnExecute; }
83 void AbortFlagOnExecuteOn() { this->SetAbortFlagOnExecute(1); }
84 void AbortFlagOnExecuteOff() { this->SetAbortFlagOnExecute(0); }
85
86 void (*Callback)(vtkObject*, unsigned long, void*, void*);
87 void (*ClientDataDeleteCallback)(void*);
88
89 protected:
90 int AbortFlagOnExecute;
91 void* ClientData;
92
93 vtkCallbackCommand();
94 ~vtkCallbackCommand() override;
95 };
96
97 VTK_ABI_NAMESPACE_END
98 #endif
99
100 // VTK-HeaderTest-Exclude: vtkCallbackCommand.h
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:49
vtkCallbackCommand::~vtkCallbackCommand
~vtkCallbackCommand() override
vtkCallbackCommand::SetClientDataDeleteCallback
virtual void SetClientDataDeleteCallback(void(*f)(void *))
Definition: vtkCallbackCommand.h:74
vtkCallbackCommand::New
static vtkCallbackCommand * New()
Definition: vtkCallbackCommand.h:53
vtkCallbackCommand::AbortFlagOnExecuteOn
void AbortFlagOnExecuteOn()
Definition: vtkCallbackCommand.h:83
vtkCallbackCommand::AbortFlagOnExecute
int AbortFlagOnExecute
Definition: vtkCallbackCommand.h:90
vtkCallbackCommand::vtkCallbackCommand
vtkCallbackCommand()
vtkCallbackCommand::GetAbortFlagOnExecute
int GetAbortFlagOnExecute()
Definition: vtkCallbackCommand.h:82
vtkCallbackCommand::SetAbortFlagOnExecute
void SetAbortFlagOnExecute(int f)
Set/Get the abort flag on execute.
Definition: vtkCallbackCommand.h:81
vtkCallbackCommand::SetCallback
virtual void SetCallback(void(*f)(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata))
Definition: vtkCallbackCommand.h:69
vtkCallbackCommand::AbortFlagOnExecuteOff
void AbortFlagOnExecuteOff()
Definition: vtkCallbackCommand.h:84
vtkCallbackCommand::GetClientData
virtual void * GetClientData()
Definition: vtkCallbackCommand.h:68
vtkCallbackCommand::SetClientData
virtual void SetClientData(void *cd)
Methods to set and get client and callback information, and the callback function.
Definition: vtkCallbackCommand.h:67
vtkCallbackCommand::ClientData
void * ClientData
Definition: vtkCallbackCommand.h:91
vtkCallbackCommand::Execute
void Execute(vtkObject *caller, unsigned long eid, void *callData) override
Satisfy the superclass API for callbacks.
vtkCommand
superclass for callback/observer methods
Definition: vtkCommand.h:384
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkCommand.h