VTK  9.0.1
vtkPythonArchiver.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkArchiver.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 =========================================================================*/
37 #ifndef vtkPythonArchiver_h
38 #define vtkPythonArchiver_h
39 #if !defined(__VTK_WRAP__) || defined(__VTK_WRAP_HIERARCHY__) || defined(__VTK_WRAP_PYTHON__)
40 
41 #include "vtkPython.h" // Must be first
42 
43 #include "vtkArchiver.h"
44 #include "vtkCommonPythonModule.h" // For export macro
45 
46 class vtkSmartPyObject;
47 
48 class VTKCOMMONPYTHON_EXPORT vtkPythonArchiver : public vtkArchiver
49 {
50 public:
51  static vtkPythonArchiver* New();
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
59  void SetPythonObject(PyObject* obj);
60 
62 
65  void OpenArchive() override;
67 
69 
72  void CloseArchive() override;
74 
76 
79  void InsertIntoArchive(
80  const std::string& relativePath, const char* data, std::size_t size) override;
82 
84 
87  bool Contains(const std::string& relativePath) override;
89 
90 protected:
92  ~vtkPythonArchiver() override;
93 
94 private:
95  vtkPythonArchiver(const vtkPythonArchiver&) = delete;
96  void operator=(const vtkPythonArchiver&) = delete;
97 
98  int CheckResult(const char* method, const vtkSmartPyObject& res);
99 
100  PyObject* Object;
101 };
102 
103 #endif
104 #endif
vtkArchiver::New
static vtkArchiver * New()
vtkPythonArchiver
A version of vtkArchiver that can be implemented in Python.
Definition: vtkPythonArchiver.h:48
vtkArchiver::InsertIntoArchive
virtual void InsertIntoArchive(const std::string &relativePath, const char *data, std::size_t size)
Insert data of size size into the archive at relativePath.
vtkArchiver::CloseArchive
virtual void CloseArchive()
Close the arhive.
vtkX3D::data
@ data
Definition: vtkX3D.h:321
PyObject
struct _object PyObject
Definition: vtkMatplotlibMathTextUtilities.h:35
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkArchiver::Contains
virtual bool Contains(const std::string &relativePath)
Checks if relativePath represents an entry in the archive.
vtkArchiver.h
vtkX3D::size
@ size
Definition: vtkX3D.h:259
vtkArchiver::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkArchiver
Writes an archive.
Definition: vtkArchiver.h:36
vtkX3D::string
@ string
Definition: vtkX3D.h:496
vtkArchiver::OpenArchive
virtual void OpenArchive()
Open the arhive for writing.