VTK
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 "vtkObject.h"
20 #include "vtkCommand.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,
30  char *name,
31  vtkObject *obj);
32 
34  unsigned long eventId,
35  void *, void *);
36 extern VTKTCL_EXPORT void vtkTclGenericDeleteObject(ClientData cd);
37 
38 extern VTKTCL_EXPORT void
39 vtkTclGetObjectFromPointer(Tcl_Interp *interp, void *temp,
40  const char *targetType);
41 
42 extern VTKTCL_EXPORT void *
43 vtkTclGetPointerFromObject(const char *name, const char *result_type,
44  Tcl_Interp *interp, int &error);
45 
46 extern VTKTCL_EXPORT void vtkTclVoidFunc(void *);
47 extern VTKTCL_EXPORT void vtkTclVoidFuncArgDelete(void *);
48 extern VTKTCL_EXPORT void vtkTclListInstances(Tcl_Interp *interp,
49  ClientData arg);
50 extern VTKTCL_EXPORT int vtkTclInDelete(Tcl_Interp *interp);
51 
52 extern VTKTCL_EXPORT int vtkTclNewInstanceCommand(ClientData cd,
53  Tcl_Interp *interp,
54  int argc, char *argv[]);
55 extern VTKTCL_EXPORT void vtkTclDeleteCommandStruct(ClientData cd);
56 extern VTKTCL_EXPORT
57 void vtkTclCreateNew(Tcl_Interp *interp, const char *cname,
58  ClientData (*NewCommand)(),
59  int (*CommandFunction)(ClientData cd,
60  Tcl_Interp *interp,
61  int argc, char *argv[]));
62 
63 class vtkTclCommand : public vtkCommand
64 {
65 public:
66  static vtkTclCommand *New() { return new vtkTclCommand; };
67 
68  void SetStringCommand(const char *arg);
69  void SetInterp(Tcl_Interp *interp) { this->Interp = interp; };
70 
71  void Execute(vtkObject *, unsigned long, void *);
72 
74  Tcl_Interp *Interp;
75 protected:
76  vtkTclCommand();
78 };
79 
80 typedef struct _vtkTclVoidFuncArg
81 {
82  Tcl_Interp *interp;
83  char *command;
85 
87 {
88  void *Pointer;
89  Tcl_Interp *Interp;
90  unsigned long Tag;
91 };
92 
94 {
95  ClientData (*NewCommand)();
96  int (*CommandFunction)(ClientData cd, Tcl_Interp *interp,
97  int argc, char *argv[]);
98 };
99 
101 {
102  Tcl_HashTable InstanceLookup;
103  Tcl_HashTable PointerLookup;
104  Tcl_HashTable CommandLookup;
105 
106  int Number;
107  int DebugOn;
108  int InDelete;
110 };
111 
112 extern VTKTCL_EXPORT
113 void vtkTclApplicationInitExecutable(int argc, const char* const argv[]);
114 extern VTKTCL_EXPORT
115 void vtkTclApplicationInitTclTk(Tcl_Interp* interp,
116  const char* const relative_dirs[]);
117 
118 #endif
VTKTCL_EXPORT void vtkTclVoidFunc(void *)
int DeleteExistingObjectOnNew
Definition: vtkTclUtil.h:109
VTKTCL_EXPORT void vtkTclUpdateCommand(Tcl_Interp *interp, char *name, vtkObject *obj)
VTKTCL_EXPORT int vtkTclNewInstanceCommand(ClientData cd, Tcl_Interp *interp, int argc, char *argv[])
VTKTCL_EXPORT int vtkTclInDelete(Tcl_Interp *interp)
abstract base class for most VTK objects
Definition: vtkObject.h:59
struct _vtkTclVoidFuncArg vtkTclVoidFuncArg
Tcl_Interp * Interp
Definition: vtkTclUtil.h:74
VTKTCL_EXPORT void vtkTclCreateNew(Tcl_Interp *interp, const char *cname, ClientData(*NewCommand)(), int(*CommandFunction)(ClientData cd, Tcl_Interp *interp, int argc, char *argv[]))
Tcl_Interp * Interp
Definition: vtkTclUtil.h:89
VTKTCL_EXPORT void vtkTclListInstances(Tcl_Interp *interp, ClientData arg)
static vtkTclCommand * New()
Definition: vtkTclUtil.h:66
#define VTKTCL_EXPORT
Definition: vtkTclUtil.h:26
Tcl_HashTable PointerLookup
Definition: vtkTclUtil.h:103
superclass for callback/observer methods
Definition: vtkCommand.h:370
VTKTCL_EXPORT void vtkTclApplicationInitExecutable(int argc, const char *const argv[])
char * StringCommand
Definition: vtkTclUtil.h:73
VTKTCL_EXPORT void vtkTclDeleteCommandStruct(ClientData cd)
VTKTCL_EXPORT void vtkTclVoidFuncArgDelete(void *)
void Execute(vtkObject *, unsigned long, void *)
All derived classes of vtkCommand must implement this method.
void SetStringCommand(const char *arg)
unsigned long Tag
Definition: vtkTclUtil.h:90
VTKTCL_EXPORT void vtkTclGetObjectFromPointer(Tcl_Interp *interp, void *temp, const char *targetType)
VTKTCL_EXPORT void * vtkTclGetPointerFromObject(const char *name, const char *result_type, Tcl_Interp *interp, int &error)
Tcl_HashTable InstanceLookup
Definition: vtkTclUtil.h:102
void SetInterp(Tcl_Interp *interp)
Definition: vtkTclUtil.h:69
VTKTCL_EXPORT void vtkTclDeleteObjectFromHash(vtkObject *, unsigned long eventId, void *, void *)
Tcl_HashTable CommandLookup
Definition: vtkTclUtil.h:104
VTKTCL_EXPORT void vtkTclApplicationInitTclTk(Tcl_Interp *interp, const char *const relative_dirs[])
VTKTCL_EXPORT void vtkTclGenericDeleteObject(ClientData cd)
Tcl_Interp * interp
Definition: vtkTclUtil.h:82