VTK  9.7.20261008
vtkXMLWriterBase.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
15
16#ifndef vtkXMLWriterBase_h
17#define vtkXMLWriterBase_h
18
19#include "vtkAlgorithm.h"
20#include "vtkIOXMLModule.h" // For export macro
21#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
22
23#include <string> // for std::string
24
25VTK_ABI_NAMESPACE_BEGIN
27
28class VTKIOXML_EXPORT VTK_MARSHALAUTO vtkXMLWriterBase : public vtkAlgorithm
29{
30public:
32 void PrintSelf(ostream& os, vtkIndent indent) override;
33
37 enum
38 {
41 };
42
49 enum
50 {
54 };
55
61 enum
62 {
63 Int32 = 32,
64 Int64 = 64
65 };
66
72 enum
73 {
74 UInt32 = 32,
75 UInt64 = 64
76 };
77
79
83 vtkSetMacro(ByteOrder, int);
84 vtkGetMacro(ByteOrder, int);
88
90
94 virtual void SetHeaderType(int);
95 vtkGetMacro(HeaderType, int);
99
101
105 virtual void SetIdType(int);
106 vtkGetMacro(IdType, int);
110
112
118
120
123 vtkSetMacro(WriteToOutputString, bool);
124 vtkGetMacro(WriteToOutputString, bool);
125 vtkBooleanMacro(WriteToOutputString, bool);
126 std::string GetOutputString() { return this->OutputString; }
128
130
135 vtkGetObjectMacro(Compressor, vtkDataCompressor);
137
145
147
150 void SetCompressorType(int compressorType);
156
158
162 void SetCompressionLevel(int compressorLevel);
163 vtkGetMacro(CompressionLevel, int);
165
167
173 virtual void SetBlockSize(size_t blockSize);
174 vtkGetMacro(BlockSize, size_t);
176
178
183 vtkSetMacro(DataMode, int);
184 vtkGetMacro(DataMode, int);
189
191
198 vtkSetMacro(EncodeAppendedData, bool);
199 vtkGetMacro(EncodeAppendedData, bool);
200 vtkBooleanMacro(EncodeAppendedData, bool);
202
204
209 vtkGetMacro(WriteTimeValue, bool);
210 vtkSetMacro(WriteTimeValue, bool);
211 vtkBooleanMacro(WriteTimeValue, bool);
213
217 virtual const char* GetDefaultFileExtension() = 0;
218
223 int Write();
224
225protected:
228
229 // Methods to define the file's major and minor version numbers.
232
233 // The name of the output file.
234 char* FileName;
235
236 // Whether this object is writing to a string or a file.
237 // Default is 0: write to file.
239
240 // The output string.
241 std::string OutputString;
242
243 // The output byte order.
245
246 // The output binary header word type.
248
249 // The output vtkIdType.
251
252 // The form of binary data to write. Used by subclasses to choose
253 // how to write data.
255
256 // Whether to base64-encode the appended data section.
258
259 // Compression information.
261 size_t BlockSize;
262
263 // Compression Level for vtkDataCompressor objects
264 // 1 (worst compression, fastest) ... 9 (best compression, slowest)
266
267 // This variable is used to ease transition to new versions of VTK XML files.
268 // If data that needs to be written satisfies certain conditions,
269 // the writer can use the previous file version version.
270 // For version change 0.1 -> 2.0 (UInt32 header) and 1.0 -> 2.0
271 // (UInt64 header), if data does not have a vtkGhostType array,
272 // the file is written with version: 0.1/1.0.
274
275private:
276 vtkXMLWriterBase(const vtkXMLWriterBase&) = delete;
277 void operator=(const vtkXMLWriterBase&) = delete;
278
279 bool WriteTimeValue = true;
280};
281
282VTK_ABI_NAMESPACE_END
283#endif
Abstract interface for data compression classes.
a simple class to control print indentation
Definition vtkIndent.h:108
void SetByteOrderToBigEndian()
Get/Set the byte order of data written to the file.
virtual void SetIdType(int)
Get/Set the size of the vtkIdType values stored in the file.
vtkDataCompressor * Compressor
vtkGetFilePathMacro(FileName)
Get/Set the name of the output file.
int Write()
Invoke the writer.
vtkSetFilePathMacro(FileName)
Get/Set the name of the output file.
virtual int GetDataSetMajorVersion()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetHeaderType(int)
Get/Set the binary data header word type.
void SetIdTypeToInt32()
Get/Set the size of the vtkIdType values stored in the file.
void SetDataModeToBinary()
Get/Set the data mode used for the file's data.
void SetDataModeToAscii()
Get/Set the data mode used for the file's data.
void SetCompressionLevel(int compressorLevel)
Get/Set compression level.
virtual void SetDataMode(int)
Get/Set the data mode used for the file's data.
void SetCompressorTypeToLZMA()
Convenience functions to set the compressor to certain known types.
virtual int GetDataSetMinorVersion()
void SetCompressorTypeToNone()
Convenience functions to set the compressor to certain known types.
void SetHeaderTypeToUInt32()
Get/Set the binary data header word type.
void SetCompressorTypeToLZ4()
Convenience functions to set the compressor to certain known types.
virtual void SetCompressor(vtkDataCompressor *)
Get/Set the compressor used to compress binary and appended data before writing to the file.
void SetIdTypeToInt64()
Get/Set the size of the vtkIdType values stored in the file.
std::string OutputString
virtual const char * GetDefaultFileExtension()=0
Get the default file extension for files written by this writer.
~vtkXMLWriterBase() override
void SetHeaderTypeToUInt64()
Get/Set the binary data header word type.
void SetCompressorTypeToZLib()
Convenience functions to set the compressor to certain known types.
virtual void SetByteOrder(int)
Get/Set the byte order of data written to the file.
virtual void SetBlockSize(size_t blockSize)
Get/Set the block size used in compression.
void SetByteOrderToLittleEndian()
Get/Set the byte order of data written to the file.
void SetCompressorType(int compressorType)
Convenience functions to set the compressor to certain known types.
void SetDataModeToAppended()
Get/Set the data mode used for the file's data.
std::string GetOutputString()
Enable writing to an OutputString instead of the default, a file.
#define VTK_UNBLOCKTHREADS
#define VTK_MARSHALAUTO