VTK: IO/ParallelXML/vtkXMLDataWriterHelper.h Source File

| VTK 9.3.1

vtkXMLDataWriterHelper.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 #ifndef vtkXMLDataWriterHelper_h
16 #define vtkXMLDataWriterHelper_h
17
18 #include "vtkIOParallelXMLModule.h" // For export macro
19 #include "vtkXMLWriter.h"
20
21 VTK_ABI_NAMESPACE_BEGIN
22 class vtkCompositeDataSet;
23 class vtkXMLDataElement;
24 class vtkXMLWriter2;
25
26 class VTKIOPARALLELXML_EXPORT vtkXMLDataWriterHelper : public vtkXMLWriter
27 {
28 public:
29 static vtkXMLDataWriterHelper* New();
30 vtkTypeMacro(vtkXMLDataWriterHelper, vtkXMLWriter);
31 void PrintSelf(ostream& os, vtkIndent indent) override;
32
34
38 void SetWriter(vtkXMLWriter2*);
39 vtkGetObjectMacro(Writer, vtkXMLWriter2);
41
43
50 bool OpenFile();
51 bool BeginWriting();
52 bool EndWriting();
54
58 bool AddGlobalFieldData(vtkCompositeDataSet* dataset);
59
63 bool AddXML(vtkXMLDataElement* xmlElement);
64
66
72 void SetDataSetName(const std::string& name) { this->DataSetName = name; }
73 void SetDataSetVersion(int major, int minor)
74 {
75 this->DataSetVersion[0] = major;
76 this->DataSetVersion[1] = minor;
77 }
79
80 const char* GetDefaultFileExtension() override { return nullptr; }
81
82 protected:
83 vtkXMLDataWriterHelper();
84 ~vtkXMLDataWriterHelper() override;
85
86 const char* GetDataSetName() override { return this->DataSetName.c_str(); }
87 int GetDataSetMajorVersion() override { return this->DataSetVersion[0]; }
88 int GetDataSetMinorVersion() override { return this->DataSetVersion[1]; }
89
90 private:
91 vtkXMLDataWriterHelper(const vtkXMLDataWriterHelper&) = delete;
92 void operator=(const vtkXMLDataWriterHelper&) = delete;
93
94 vtkXMLWriter2* Writer;
95 std::string DataSetName;
96 int DataSetVersion[2];
97 };
98
99 VTK_ABI_NAMESPACE_END
100 #endif
vtkCompositeDataSet
abstract superclass for composite (multi-block or AMR) datasets
Definition: vtkCompositeDataSet.h:51
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkXMLDataElement
Represents an XML element and those nested inside.
Definition: vtkXMLDataElement.h:26
vtkXMLDataWriterHelper
helper for vtkXMLWriter2 and subclasses
Definition: vtkXMLDataWriterHelper.h:27
vtkXMLDataWriterHelper::vtkXMLDataWriterHelper
vtkXMLDataWriterHelper()
vtkXMLDataWriterHelper::New
static vtkXMLDataWriterHelper * New()
vtkXMLDataWriterHelper::GetDataSetMinorVersion
int GetDataSetMinorVersion() override
Definition: vtkXMLDataWriterHelper.h:88
vtkXMLDataWriterHelper::SetWriter
void SetWriter(vtkXMLWriter2 *)
Get/Set the writer using this helper.
vtkXMLDataWriterHelper::GetDefaultFileExtension
const char * GetDefaultFileExtension() override
Get the default file extension for files written by this writer.
Definition: vtkXMLDataWriterHelper.h:80
vtkXMLDataWriterHelper::OpenFile
bool OpenFile()
The writing process is split into 4 parts:
vtkXMLDataWriterHelper::EndWriting
bool EndWriting()
The writing process is split into 4 parts:
vtkXMLDataWriterHelper::GetDataSetName
const char * GetDataSetName() override
Definition: vtkXMLDataWriterHelper.h:86
vtkXMLDataWriterHelper::~vtkXMLDataWriterHelper
~vtkXMLDataWriterHelper() override
vtkXMLDataWriterHelper::SetDataSetVersion
void SetDataSetVersion(int major, int minor)
These methods should be used by the caller to provide necessary information to the helper to generate...
Definition: vtkXMLDataWriterHelper.h:73
vtkXMLDataWriterHelper::GetDataSetMajorVersion
int GetDataSetMajorVersion() override
Definition: vtkXMLDataWriterHelper.h:87
vtkXMLDataWriterHelper::SetDataSetName
void SetDataSetName(const std::string &name)
These methods should be used by the caller to provide necessary information to the helper to generate...
Definition: vtkXMLDataWriterHelper.h:72
vtkXMLDataWriterHelper::AddGlobalFieldData
bool AddGlobalFieldData(vtkCompositeDataSet *dataset)
Adds global field data for composite dataset.
vtkXMLDataWriterHelper::AddXML
bool AddXML(vtkXMLDataElement *xmlElement)
Serialize and add an XML dom described by the xmlElement to the file.
vtkXMLDataWriterHelper::BeginWriting
bool BeginWriting()
The writing process is split into 4 parts:
vtkXMLDataWriterHelper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkXMLWriter2
base class for new-style XML Writers
Definition: vtkXMLWriter2.h:38
vtkXMLWriter
Superclass for VTK's XML file writers.
Definition: vtkXMLWriter.h:54
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkXMLWriter.h