VTK: Common/Python/vtkPythonArchiver.h Source File

| VTK 9.3.1

vtkPythonArchiver.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
28 #ifndef vtkPythonArchiver_h
29 #define vtkPythonArchiver_h
30 #if !defined(__VTK_WRAP__) || defined(__VTK_WRAP_HIERARCHY__) || defined(__VTK_WRAP_PYTHON__)
31
32 #include "vtkPython.h" // Must be first
33
34 #include "vtkArchiver.h"
35 #include "vtkCommonPythonModule.h" // For export macro
36
37 VTK_ABI_NAMESPACE_BEGIN
38 class vtkSmartPyObject;
39
40 class VTKCOMMONPYTHON_EXPORT vtkPythonArchiver : public vtkArchiver
41 {
42 public:
43 static vtkPythonArchiver* New();
44 vtkTypeMacro(vtkPythonArchiver, vtkArchiver);
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
51 void SetPythonObject(PyObject* obj);
52
54
57 void OpenArchive() override;
59
61
64 void CloseArchive() override;
66
68
71 void InsertIntoArchive(
72 const std::string& relativePath, const char* data, std::size_t size) override;
74
76
79 bool Contains(const std::string& relativePath) override;
81
82 protected:
83 vtkPythonArchiver();
84 ~vtkPythonArchiver() override;
85
86 private:
87 vtkPythonArchiver(const vtkPythonArchiver&) = delete;
88 void operator=(const vtkPythonArchiver&) = delete;
89
90 int CheckResult(const char* method, const vtkSmartPyObject& res);
91
92 PyObject* Object;
93 };
94
95 VTK_ABI_NAMESPACE_END
96 #endif
97 #endif
vtkArchiver
Writes an archive.
Definition: vtkArchiver.h:29
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkPythonArchiver
A version of vtkArchiver that can be implemented in Python.
Definition: vtkPythonArchiver.h:41
vtkPythonArchiver::New
static vtkPythonArchiver * New()
vtkPythonArchiver::vtkPythonArchiver
vtkPythonArchiver()
vtkPythonArchiver::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPythonArchiver::Contains
bool Contains(const std::string &relativePath) override
Checks if relativePath represents an entry in the archive.
vtkPythonArchiver::InsertIntoArchive
void InsertIntoArchive(const std::string &relativePath, const char *data, std::size_t size) override
Insert data of size size into the archive at relativePath.
vtkPythonArchiver::~vtkPythonArchiver
~vtkPythonArchiver() override
vtkPythonArchiver::SetPythonObject
void SetPythonObject(PyObject *obj)
Specify the Python object to use to perform the archiving.
vtkPythonArchiver::OpenArchive
void OpenArchive() override
Open the archive for writing.
vtkPythonArchiver::CloseArchive
void CloseArchive() override
Close the archive.
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkArchiver.h
PyObject
struct _object PyObject
Definition: vtkMatplotlibMathTextUtilities.h:44