forked from Kitware/ParaView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paraview_plugin.cxx.in
172 lines (152 loc) · 5.36 KB
/
paraview_plugin.cxx.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#include "@_paraview_build_plugin@Plugin.h"
#include "vtkObjectFactory.h"
#include "vtkPVPluginLoader.h"
#cmakedefine01 _paraview_add_plugin_EULA
#cmakedefine01 _paraview_add_plugin_SERVER_MANAGER_XML
#cmakedefine01 _paraview_add_plugin_MODULES
#cmakedefine01 _paraview_add_plugin_UI_INTERFACES
#cmakedefine01 _paraview_add_plugin_with_resources
#if !_paraview_add_plugin_built_shared && _paraview_add_plugin_with_resources
// For Q_INIT_RESOURCE
#include <QtCore/QtGlobal>
#endif
#if _paraview_add_plugin_EULA
#include "@_paraview_add_plugin_eula_header@"
#endif
@_paraview_add_plugin_includes@
namespace
{
// This ensures that when the shared library for this plugin is
// unloaded during finalization sequence, it notifies the vtkPVPluginLoader
// so it does not double-dlclose() an already unloaded plugin.
// This does not affect static builds and hence we don't need to worry about
// making sure this instance gets created in static builds.
class @_paraview_build_plugin@PluginCleaner
{
public:
@_paraview_build_plugin@PluginCleaner() = default;
~@_paraview_build_plugin@PluginCleaner()
{
// The plugin library is being unloaded.
// Let the plugin loader know so it doesn't try to unload it again.
vtkPVPluginLoader::PluginLibraryUnloaded("@_paraview_build_plugin@");
}
} @_paraview_build_plugin@PluginCleaner_Instance;
}
//-----------------------------------------------------------------------------
#if _paraview_add_plugin_SERVER_MANAGER_XML
#include "@_paraview_build_plugin@_server_manager.h"
#endif
#if _paraview_add_plugin_MODULES
#include "@_paraview_build_plugin@_server_manager_modules.h"
#include "@_paraview_build_plugin@_client_server.h"
#endif
//-----------------------------------------------------------------------------
void @_paraview_build_plugin@Plugin::GetBinaryResources(
std::vector<std::string>& resources)
{
@_paraview_add_plugin_binary_resources@
(void)resources;
}
//-----------------------------------------------------------------------------
#if _paraview_add_plugin_with_ui
@_paraview_add_plugin_include_interfaces@
@_paraview_add_plugin_push_back_interfaces@
#endif
//-----------------------------------------------------------------------------
#if _paraview_add_plugin_with_xml
vtkClientServerInterpreterInitializer::InterpreterInitializationCallback
@_paraview_build_plugin@Plugin::GetInitializeInterpreterCallback()
{
#if _paraview_add_plugin_MODULES
return @_paraview_build_plugin@_client_server_initialize;
#else
return nullptr;
#endif
}
//-----------------------------------------------------------------------------
void @_paraview_build_plugin@Plugin::GetXMLs(std::vector<std::string> &xmls)
{
(void)xmls;
#if _paraview_add_plugin_SERVER_MANAGER_XML
@_paraview_build_plugin@_server_manager_initialize(xmls);
#endif
#if _paraview_add_plugin_MODULES
@_paraview_build_plugin@_server_manager_modules_initialize(xmls);
#endif
}
#endif
//-----------------------------------------------------------------------------
#if _paraview_add_plugin_with_ui
QObjectList @_paraview_build_plugin@Plugin::interfaces()
{
QObjectList ifaces;
#if _paraview_add_plugin_UI_INTERFACES
PARAVIEW_ADD_INTERFACES(ifaces);
#endif
return ifaces;
}
#endif
//-----------------------------------------------------------------------------
#if _paraview_add_plugin_with_initializers
void @_paraview_build_plugin@Plugin::Initialize()
{
@_paraview_add_plugin_invoke_initializers@
}
#endif
//-----------------------------------------------------------------------------
#if _paraview_add_plugin_with_python
@_paraview_add_plugin_python_includes@
void @_paraview_build_plugin@Plugin::GetPythonSourceList(std::vector<std::string>& modules,
std::vector<std::string>& sources,
std::vector<int> &package_flags)
{
const char *moduleNames[] = {
@_paraview_add_plugin_python_modules@
};
char *moduleSources[] = {
@_paraview_add_plugin_python_module_sources@
};
const int packageFlags[] = {
@_paraview_add_plugin_python_package_flags@
};
for (int cc=0; moduleNames[cc]; cc++)
{
modules.push_back(moduleNames[cc]);
sources.push_back(moduleSources[cc]);
package_flags.push_back(packageFlags[cc]);
// free allocated memory.
delete[] moduleSources[cc];
moduleSources[cc] = nullptr;
}
}
#endif
//-----------------------------------------------------------------------------
static void initialize_@_paraview_build_plugin@_plugin_qt_resources()
{
#if !_paraview_add_plugin_built_shared && _paraview_add_plugin_with_resources
// For static builds, initialize the Qt resources.
@_paraview_add_plugin_resources_init@
#endif
#if !_paraview_add_plugin_built_shared && _paraview_add_plugin_with_ui
// For static builds, initialize the Qt plugin.
Q_IMPORT_PLUGIN(@_paraview_build_plugin@Plugin)
#endif
}
//-----------------------------------------------------------------------------
@_paraview_build_plugin@Plugin::@_paraview_build_plugin@Plugin()
{
initialize_@_paraview_build_plugin@_plugin_qt_resources();
}
//-----------------------------------------------------------------------------
const char* @_paraview_build_plugin@Plugin::GetEULA()
{
#if _paraview_add_plugin_EULA
return @_paraview_build_plugin@_EULA;
#else
return nullptr;
#endif
}
//-----------------------------------------------------------------------------
// Mark this as a ParaView-ServerManager plugin.
PV_PLUGIN_EXPORT(@_paraview_build_plugin@, @_paraview_build_plugin@Plugin)