VTK  9.1.0
vtkXMLDataWriterHelper.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkXMLDataWriterHelper.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=========================================================================*/
27#ifndef vtkXMLDataWriterHelper_h
28#define vtkXMLDataWriterHelper_h
29
30#include "vtkIOParallelXMLModule.h" // For export macro
31#include "vtkXMLWriter.h"
32
35class vtkXMLWriter2;
36
37class VTKIOPARALLELXML_EXPORT vtkXMLDataWriterHelper : public vtkXMLWriter
38{
39public:
42 void PrintSelf(ostream& os, vtkIndent indent) override;
43
45
50 vtkGetObjectMacro(Writer, vtkXMLWriter2);
52
54
61 bool OpenFile();
63 bool EndWriting();
65
70
74 bool AddXML(vtkXMLDataElement* xmlElement);
75
77
83 void SetDataSetName(const std::string& name) { this->DataSetName = name; }
84 void SetDataSetVersion(int major, int minor)
85 {
86 this->DataSetVersion[0] = major;
87 this->DataSetVersion[1] = minor;
88 }
90
91 const char* GetDefaultFileExtension() override { return nullptr; }
92
93protected:
96
97 const char* GetDataSetName() override { return this->DataSetName.c_str(); }
98 int GetDataSetMajorVersion() override { return this->DataSetVersion[0]; }
99 int GetDataSetMinorVersion() override { return this->DataSetVersion[1]; }
100
101private:
103 void operator=(const vtkXMLDataWriterHelper&) = delete;
104
105 vtkXMLWriter2* Writer;
106 std::string DataSetName;
107 int DataSetVersion[2];
108};
109
110#endif
abstract superclass for composite (multi-block or AMR) datasets
a simple class to control print indentation
Definition: vtkIndent.h:113
Represents an XML element and those nested inside.
helper for vtkXMLWriter2 and subclasses
int GetDataSetMinorVersion() override
void SetWriter(vtkXMLWriter2 *)
Get/Set the writer using this helper.
bool OpenFile()
The writing process is split into 4 parts:
bool EndWriting()
The writing process is split into 4 parts:
const char * GetDefaultFileExtension() override
Get the default file extension for files written by this writer.
~vtkXMLDataWriterHelper() override
static vtkXMLDataWriterHelper * New()
void SetDataSetVersion(int major, int minor)
These methods should be used by the caller to provide necessary information to the helper to generate...
int GetDataSetMajorVersion() override
void SetDataSetName(const std::string &name)
These methods should be used by the caller to provide necessary information to the helper to generate...
bool AddGlobalFieldData(vtkCompositeDataSet *dataset)
Adds global field data for composite dataset.
bool AddXML(vtkXMLDataElement *xmlElement)
Serialize and add an XML dom described by the xmlElement to the file.
bool BeginWriting()
The writing process is split into 4 parts:
const char * GetDataSetName() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
base class for new-style XML Writers
Definition: vtkXMLWriter2.h:49
Superclass for VTK's XML file writers.
Definition: vtkXMLWriter.h:62
@ name
Definition: vtkX3D.h:225
@ string
Definition: vtkX3D.h:496