VTK  9.0.2
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:
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
60 
62 
65  void OpenArchive() override;
67 
69 
72  void CloseArchive() override;
74 
76 
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
Writes an archive.
Definition: vtkArchiver.h:37
a simple class to control print indentation
Definition: vtkIndent.h:34
A version of vtkArchiver that can be implemented in Python.
static vtkPythonArchiver * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool Contains(const std::string &relativePath) override
Checks if relativePath represents an entry in the archive.
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() override
void SetPythonObject(PyObject *obj)
Specify the Python object to use to perform the archiving.
void OpenArchive() override
Open the arhive for writing.
void CloseArchive() override
Close the arhive.
@ size
Definition: vtkX3D.h:259
@ data
Definition: vtkX3D.h:321
@ string
Definition: vtkX3D.h:496
struct _object PyObject