VTK  9.4.20241218
vtkX3DExporterWriter.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
12#ifndef vtkX3DExporterWriter_h
13#define vtkX3DExporterWriter_h
14
15#include "vtkIOExportModule.h" // For export macro
16#include "vtkObject.h"
17
18// Forward declarations
19VTK_ABI_NAMESPACE_BEGIN
20class vtkDataArray;
22class vtkCellArray;
23
24class VTKIOEXPORT_EXPORT vtkX3DExporterWriter : public vtkObject
25{
26public:
28 void PrintSelf(ostream& os, vtkIndent indent) override;
29
34 virtual int OpenFile(const char* file) = 0;
35
39 virtual int OpenStream() = 0;
40
42
45 vtkSetMacro(WriteToOutputString, vtkTypeBool);
46 vtkGetMacro(WriteToOutputString, vtkTypeBool);
47 vtkBooleanMacro(WriteToOutputString, vtkTypeBool);
49
51
56 vtkGetMacro(OutputStringLength, vtkIdType);
57 vtkGetStringMacro(OutputString);
58 unsigned char* GetBinaryOutputString()
59 {
60 return reinterpret_cast<unsigned char*>(this->OutputString);
61 }
63
70
71 // Closes the file if open
72 virtual void CloseFile() = 0;
73 // Flush can be called optionally after some operations to
74 // flush the buffer to the filestream. A writer not necessarily
75 // implements this function
76 virtual void Flush() {}
77
82 virtual void StartDocument() = 0;
83
88 virtual void EndDocument() = 0;
89
91
97 virtual void StartNode(int nodeID) = 0;
98 virtual void EndNode() = 0;
100
107 virtual void SetField(int attributeID, const char* value, bool mfstring = false) = 0;
108
114 virtual void SetField(int attributeID, int) = 0;
115
121 virtual void SetField(int attributeID, float) = 0;
122
128 virtual void SetField(int attributeID, double) = 0;
129
135 virtual void SetField(int attributeID, bool) = 0;
136
143 virtual void SetField(int attributeID, int type, const double* a) = 0;
144
151 virtual void SetField(int attributeID, int type, vtkDataArray* a) = 0;
152
159 virtual void SetField(int attributeID, const double* values, size_t size) = 0;
160
169 virtual void SetField(int attributeID, const int* values, size_t size, bool image = false) = 0;
170
171 /*
172 * Sets the field specified with attributeID
173 * of the active node to the given value.
174 * The type of the field is specified with type
175 * Supported types: MFString
176 */
177 // virtual void SetField(int attributeID, int type, std::string) = 0;
178
179protected:
182
186
187private:
189 void operator=(const vtkX3DExporterWriter&) = delete;
190};
191VTK_ABI_NAMESPACE_END
192#endif
object to represent cell connectivity
abstract superclass for arrays of numeric data
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
dynamic, self-adjusting array of unsigned char
X3D Exporter Writer.
virtual void SetField(int attributeID, float)=0
Sets the field specified with attributeID of the active node to the given value.
unsigned char * GetBinaryOutputString()
When WriteToOutputString in on, then a string is allocated, written to, and can be retrieved with the...
virtual void EndNode()=0
Starts/ends a new X3D node specified via nodeID.
virtual void SetField(int attributeID, int)=0
Sets the field specified with attributeID of the active node to the given value.
virtual void StartDocument()=0
Starts a document and sets all necessary information, i.e.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int OpenStream()=0
Init data support to be a stream instead of a file.
virtual void SetField(int attributeID, int type, vtkDataArray *a)=0
Sets the field specified with attributeID of the active node to the given value.
virtual void SetField(int attributeID, int type, const double *a)=0
Sets the field specified with attributeID of the active node to the given value.
virtual void SetField(int attributeID, const double *values, size_t size)=0
Sets the field specified with attributeID of the active node to the given value.
char * RegisterAndGetOutputString()
This convenience method returns the string, sets the IVAR to nullptr, so that the user is responsible...
virtual int OpenFile(const char *file)=0
Opens the file specified with file returns 1 if successful otherwise 0.
virtual void SetField(int attributeID, const char *value, bool mfstring=false)=0
Sets the field specified with attributeID of the active node to the given value.
virtual void CloseFile()=0
~vtkX3DExporterWriter() override
virtual void SetField(int attributeID, double)=0
Sets the field specified with attributeID of the active node to the given value.
virtual void SetField(int attributeID, const int *values, size_t size, bool image=false)=0
Sets the field specified with attributeID of the active node to the given value.
virtual void SetField(int attributeID, bool)=0
Sets the field specified with attributeID of the active node to the given value.
virtual void StartNode(int nodeID)=0
Starts/ends a new X3D node specified via nodeID.
virtual void EndDocument()=0
Ends a document and sets all necessary information or necessary bytes to finish the encoding correctl...
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:315