vtkPVPythonAlgorithmPlugin.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
13 #ifndef vtkPVPythonAlgorithmPlugin_h
14 #define vtkPVPythonAlgorithmPlugin_h
15 
16 #include "vtkPVPlugin.h"
17 
18 #include "vtkPVServerManagerPluginInterface.h" // for vtkPVServerManagerPluginInterface
19 #include "vtkRemotingServerManagerPythonModule.h" // for exports
20 
21 #include <memory> //for std::unique_ptr.
22 
24 
26  : public vtkPVPlugin
28 {
29 public:
31 
37  vtkPVPythonAlgorithmPlugin(const char* filePath);
38  vtkPVPythonAlgorithmPlugin(const char* moduleName, const char* pythonSourceCode);
40  ~vtkPVPythonAlgorithmPlugin() override;
41 
44  const char* GetPluginName() override;
45  const char* GetPluginVersionString() override;
46  bool GetRequiredOnServer() override { return true; }
47  bool GetRequiredOnClient() override { return false; }
48  const char* GetRequiredPlugins() override { return ""; }
49  const char* GetDescription() override { return ""; }
50  const char* GetEULA() override { return nullptr; }
52 
55  void GetXMLs(std::vector<std::string>& xmls) override;
58  {
59  return nullptr;
60  }
62 
66  static bool InitializeFromStringAndGetXMLs(
67  const char* moduleName, const char* pythonSourceCode, std::vector<std::string>& xmls);
68 
69 private:
71  void operator=(const vtkPVPythonAlgorithmPlugin&) = delete;
72 
73  class vtkInternals;
74  std::unique_ptr<vtkInternals> Internals;
75 
81  static bool LoadPlugin(const char* pname);
91  void Initialize(
92  const char* moduleNameOrFilePath, const char* loadPluginFunction, const char* pythonSourceCode);
93 };
94 
95 // Schwartz counter idiom to register loader for Python plugins (based on Python
96 // algorithm).
98 {
99 public:
102 
104 
105 #endif
106 // VTK-HeaderTest-Exclude: vtkPVPythonAlgorithmPlugin.h
#define VTKREMOTINGSERVERMANAGERPYTHON_EXPORT
vtkPVServerManagerPluginInterface defines the interface needed to be implemented by a server-manager ...
virtual const char * GetPluginName()=0
Returns the name for this plugin.
static class VTKREMOTINGSERVERMANAGERPYTHON_EXPORT vtkPVPythonAlgorithmPluginLoaderInitializer PythonAlgorithmPluginInitializerInstance
defines the core interface for any ParaView plugin.
Definition: vtkPVPlugin.h:38
const char * GetDescription() override
vtkClientServerInterpreterInitializer::InterpreterInitializationCallback GetInitializeInterpreterCallback() override
void(* InterpreterInitializationCallback)(vtkClientServerInterpreter *)
virtual const char * GetPluginVersionString()=0
Returns the version for this plugin.
packages a Python module into a ParaView plugin.
const char * GetRequiredPlugins() override
virtual void GetXMLs(std::vector< std::string > &vtkNotUsed(xmls))=0
Obtain the server-manager configuration xmls, if any.