VTK  9.0.20200704
vtkTclUtil.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTclUtil.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
16 #ifndef vtkTclUtil_h
17 #define vtkTclUtil_h
18 
19 #include "vtkCommand.h"
20 #include "vtkObject.h"
21 #include "vtkTcl.h"
22 
23 #ifdef _WIN32
24 #define VTKTCL_EXPORT __declspec(dllexport)
25 #else
26 #define VTKTCL_EXPORT
27 #endif
28 
29 extern VTKTCL_EXPORT void vtkTclUpdateCommand(Tcl_Interp* interp, char* name, vtkObject* obj);
30 
32  vtkObject*, unsigned long eventId, void*, void*);
33 extern VTKTCL_EXPORT void vtkTclGenericDeleteObject(ClientData cd);
34 
36  Tcl_Interp* interp, void* temp, const char* targetType);
37 
39  const char* name, const char* result_type, Tcl_Interp* interp, int& error);
40 
41 extern VTKTCL_EXPORT void vtkTclVoidFunc(void*);
42 extern VTKTCL_EXPORT void vtkTclVoidFuncArgDelete(void*);
43 extern VTKTCL_EXPORT void vtkTclListInstances(Tcl_Interp* interp, ClientData arg);
44 extern VTKTCL_EXPORT int vtkTclInDelete(Tcl_Interp* interp);
45 
47  ClientData cd, Tcl_Interp* interp, int argc, char* argv[]);
48 extern VTKTCL_EXPORT void vtkTclDeleteCommandStruct(ClientData cd);
49 extern VTKTCL_EXPORT void vtkTclCreateNew(Tcl_Interp* interp, const char* cname,
50  ClientData (*NewCommand)(),
51  int (*CommandFunction)(ClientData cd, Tcl_Interp* interp, int argc, char* argv[]));
52 
53 class vtkTclCommand : public vtkCommand
54 {
55 public:
56  static vtkTclCommand* New() { return new vtkTclCommand; }
57 
58  void SetStringCommand(const char* arg);
59  void SetInterp(Tcl_Interp* interp) { this->Interp = interp; }
60 
61  void Execute(vtkObject*, unsigned long, void*);
62 
64  Tcl_Interp* Interp;
65 
66 protected:
67  vtkTclCommand();
69 };
70 
71 typedef struct _vtkTclVoidFuncArg
72 {
73  Tcl_Interp* interp;
74  char* command;
76 
78 {
79  void* Pointer;
80  Tcl_Interp* Interp;
81  unsigned long Tag;
82 };
83 
85 {
86  ClientData (*NewCommand)();
87  int (*CommandFunction)(ClientData cd, Tcl_Interp* interp, int argc, char* argv[]);
88 };
89 
91 {
92  Tcl_HashTable InstanceLookup;
93  Tcl_HashTable PointerLookup;
94  Tcl_HashTable CommandLookup;
95 
96  int Number;
97  int DebugOn;
98  int InDelete;
100 };
101 
102 extern VTKTCL_EXPORT void vtkTclApplicationInitExecutable(int argc, const char* const argv[]);
104  Tcl_Interp* interp, const char* const relative_dirs[]);
105 
106 #endif
107 // VTK-HeaderTest-Exclude: vtkTclUtil.h
vtkTclInterpStruct::DebugOn
int DebugOn
Definition: vtkTclUtil.h:97
vtkTclCommand
Definition: vtkTclUtil.h:53
vtkCommand
superclass for callback/observer methods
Definition: vtkCommand.h:377
vtkTclCommand::SetStringCommand
void SetStringCommand(const char *arg)
vtkTclCommandArgStruct::Interp
Tcl_Interp * Interp
Definition: vtkTclUtil.h:80
vtkTclInterpStruct::DeleteExistingObjectOnNew
int DeleteExistingObjectOnNew
Definition: vtkTclUtil.h:99
_vtkTclVoidFuncArg
Definition: vtkTclUtil.h:71
vtkTclCommand::Interp
Tcl_Interp * Interp
Definition: vtkTclUtil.h:64
vtkTclGenericDeleteObject
VTKTCL_EXPORT void vtkTclGenericDeleteObject(ClientData cd)
VTKTCL_EXPORT
#define VTKTCL_EXPORT
Definition: vtkTclUtil.h:26
vtkTclCreateNew
VTKTCL_EXPORT void vtkTclCreateNew(Tcl_Interp *interp, const char *cname, ClientData(*NewCommand)(), int(*CommandFunction)(ClientData cd, Tcl_Interp *interp, int argc, char *argv[]))
vtkTclCommand::vtkTclCommand
vtkTclCommand()
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkCommand.h
vtkTclGetObjectFromPointer
VTKTCL_EXPORT void vtkTclGetObjectFromPointer(Tcl_Interp *interp, void *temp, const char *targetType)
_vtkTclVoidFuncArg::command
char * command
Definition: vtkTclUtil.h:74
vtkTclInterpStruct::Number
int Number
Definition: vtkTclUtil.h:96
vtkTclInterpStruct::InstanceLookup
Tcl_HashTable InstanceLookup
Definition: vtkTclUtil.h:92
vtkTclVoidFuncArg
struct _vtkTclVoidFuncArg vtkTclVoidFuncArg
vtkTclCommand::StringCommand
char * StringCommand
Definition: vtkTclUtil.h:63
vtkTclCommandStruct::NewCommand
ClientData(* NewCommand)()
Definition: vtkTclUtil.h:86
vtkTclInterpStruct::InDelete
int InDelete
Definition: vtkTclUtil.h:98
_vtkTclVoidFuncArg::interp
Tcl_Interp * interp
Definition: vtkTclUtil.h:73
vtkTclDeleteObjectFromHash
VTKTCL_EXPORT void vtkTclDeleteObjectFromHash(vtkObject *, unsigned long eventId, void *, void *)
vtkTclApplicationInitExecutable
VTKTCL_EXPORT void vtkTclApplicationInitExecutable(int argc, const char *const argv[])
vtkTclDeleteCommandStruct
VTKTCL_EXPORT void vtkTclDeleteCommandStruct(ClientData cd)
vtkTclNewInstanceCommand
VTKTCL_EXPORT int vtkTclNewInstanceCommand(ClientData cd, Tcl_Interp *interp, int argc, char *argv[])
vtkTclListInstances
VTKTCL_EXPORT void vtkTclListInstances(Tcl_Interp *interp, ClientData arg)
vtkTcl.h
vtkTclVoidFuncArgDelete
VTKTCL_EXPORT void vtkTclVoidFuncArgDelete(void *)
vtkX3D::name
Definition: vtkX3D.h:225
vtkTclInterpStruct::CommandLookup
Tcl_HashTable CommandLookup
Definition: vtkTclUtil.h:94
vtkTclUpdateCommand
VTKTCL_EXPORT void vtkTclUpdateCommand(Tcl_Interp *interp, char *name, vtkObject *obj)
vtkObject.h
vtkTclGetPointerFromObject
VTKTCL_EXPORT void * vtkTclGetPointerFromObject(const char *name, const char *result_type, Tcl_Interp *interp, int &error)
vtkTclCommandArgStruct
Definition: vtkTclUtil.h:77
vtkTclCommandStruct
Definition: vtkTclUtil.h:84
vtkTclCommand::~vtkTclCommand
~vtkTclCommand()
vtkTclCommandArgStruct::Tag
unsigned long Tag
Definition: vtkTclUtil.h:81
vtkTclApplicationInitTclTk
VTKTCL_EXPORT void vtkTclApplicationInitTclTk(Tcl_Interp *interp, const char *const relative_dirs[])
vtkTclInterpStruct
Definition: vtkTclUtil.h:90
vtkTclInterpStruct::PointerLookup
Tcl_HashTable PointerLookup
Definition: vtkTclUtil.h:93
vtkTclCommandStruct::CommandFunction
int(* CommandFunction)(ClientData cd, Tcl_Interp *interp, int argc, char *argv[])
Definition: vtkTclUtil.h:87
vtkTclCommand::New
static vtkTclCommand * New()
Definition: vtkTclUtil.h:56
vtkTclVoidFunc
VTKTCL_EXPORT void vtkTclVoidFunc(void *)
vtkTclCommandArgStruct::Pointer
void * Pointer
Definition: vtkTclUtil.h:79
vtkTclCommand::SetInterp
void SetInterp(Tcl_Interp *interp)
Definition: vtkTclUtil.h:59
vtkTclCommand::Execute
void Execute(vtkObject *, unsigned long, void *)
All derived classes of vtkCommand must implement this method.
vtkTclInDelete
VTKTCL_EXPORT int vtkTclInDelete(Tcl_Interp *interp)