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 
58  void GetXMLs(std::vector<std::string>& xmls) override;
59 
65  {
66  return nullptr;
67  }
68 
73  static bool InitializeFromStringAndGetXMLs(
74  const char* moduleName, const char* pythonSourceCode, std::vector<std::string>& xmls);
75 
76 private:
78  void operator=(const vtkPVPythonAlgorithmPlugin&) = delete;
79 
80  class vtkInternals;
81  std::unique_ptr<vtkInternals> Internals;
82 
88  static bool LoadPlugin(const char* pname);
98  void Initialize(
99  const char* moduleNameOrFilePath, const char* loadPluginFunction, const char* pythonSourceCode);
100 };
101 
102 // Schwartz counter idiom to register loader for Python plugins (based on Python
103 // algorithm).
105 {
106 public:
109 
111 
112 #endif
113 // 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
Implementation of the vtkPVServerManagerPluginInterface.
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.