VTK  9.2.6
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 =========================================================================*/
40 #ifndef vtkPythonArchiver_h
41 #define vtkPythonArchiver_h
42 #if !defined(__VTK_WRAP__) || defined(__VTK_WRAP_HIERARCHY__) || defined(__VTK_WRAP_PYTHON__)
43 
44 #include "vtkPython.h" // Must be first
45 
46 #include "vtkArchiver.h"
47 #include "vtkCommonPythonModule.h" // For export macro
48 
49 class vtkSmartPyObject;
50 
51 class VTKCOMMONPYTHON_EXPORT vtkPythonArchiver : public vtkArchiver
52 {
53 public:
54  static vtkPythonArchiver* New();
56  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
62  void SetPythonObject(PyObject* obj);
63 
65 
68  void OpenArchive() override;
70 
72 
75  void CloseArchive() override;
77 
79 
82  void InsertIntoArchive(
83  const std::string& relativePath, const char* data, std::size_t size) override;
85 
87 
90  bool Contains(const std::string& relativePath) override;
92 
93 protected:
95  ~vtkPythonArchiver() override;
96 
97 private:
98  vtkPythonArchiver(const vtkPythonArchiver&) = delete;
99  void operator=(const vtkPythonArchiver&) = delete;
100 
101  int CheckResult(const char* method, const vtkSmartPyObject& res);
102 
103  PyObject* Object;
104 };
105 
106 #endif
107 #endif
virtual void CloseArchive()
Close the archive.
A version of vtkArchiver that can be implemented in Python.
a simple class to control print indentation
Definition: vtkIndent.h:39
Writes an archive.
Definition: vtkArchiver.h:39
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual bool Contains(const std::string &relativePath)
Checks if relativePath represents an entry in the archive.
virtual void OpenArchive()
Open the archive for writing.
struct _object PyObject
static vtkArchiver * New()
virtual void InsertIntoArchive(const std::string &relativePath, const char *data, std::size_t size)
Insert data of size size into the archive at relativePath.