VTK: IO/Core/vtkArrayWriter.h Source File

| VTK 9.3.1

vtkArrayWriter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
4
47 #ifndef vtkArrayWriter_h
48 #define vtkArrayWriter_h
49
50 #include "vtkIOCoreModule.h" // For export macro
51 #include "vtkStdString.h" // For string API
52 #include "vtkWriter.h"
53
54 VTK_ABI_NAMESPACE_BEGIN
55 class vtkArray;
56
57 class VTKIOCORE_EXPORT vtkArrayWriter : public vtkWriter
58 {
59 public:
60 static vtkArrayWriter* New();
61 vtkTypeMacro(vtkArrayWriter, vtkWriter);
62 void PrintSelf(ostream& os, vtkIndent indent) override;
63
65
68 vtkSetFilePathMacro(FileName);
69 vtkGetFilePathMacro(FileName);
71
73
76 vtkSetMacro(Binary, vtkTypeBool);
77 vtkGetMacro(Binary, vtkTypeBool);
78 vtkBooleanMacro(Binary, vtkTypeBool);
80
84 virtual vtkStdString GetOutputString() { return this->OutputString; }
85
87
90 vtkSetMacro(WriteToOutputString, bool);
91 vtkGetMacro(WriteToOutputString, bool);
92 vtkBooleanMacro(WriteToOutputString, bool);
94
95 int Write() override; // This is necessary to get Write() wrapped for scripting languages.
96
100 bool Write(const vtkStdString& FileName, bool WriteBinary = false);
101
105 static bool Write(vtkArray* array, const vtkStdString& file_name, bool WriteBinary = false);
106
111 bool Write(ostream& stream, bool WriteBinary = false);
112
117 static bool Write(vtkArray* array, ostream& stream, bool WriteBinary = false);
118
123 vtkStdString Write(bool WriteBinary);
124
128 static vtkStdString Write(vtkArray* array, bool WriteBinary = false);
129
130 protected:
131 vtkArrayWriter();
132 ~vtkArrayWriter() override;
133
134 int FillInputPortInformation(int port, vtkInformation* info) override;
135 void WriteData() override;
136
137 char* FileName;
138 vtkTypeBool Binary;
139 bool WriteToOutputString;
140 vtkStdString OutputString;
141
142 private:
143 vtkArrayWriter(const vtkArrayWriter&) = delete;
144 void operator=(const vtkArrayWriter&) = delete;
145 };
146
147 VTK_ABI_NAMESPACE_END
148 #endif
vtkArrayWriter
Serialize sparse and dense arrays to a file or stream.
Definition: vtkArrayWriter.h:58
vtkArrayWriter::FileName
char * FileName
Definition: vtkArrayWriter.h:137
vtkArrayWriter::WriteData
void WriteData() override
vtkArrayWriter::vtkSetFilePathMacro
vtkSetFilePathMacro(FileName)
Get / set the filename where data will be stored (when used as a filter).
vtkArrayWriter::Write
bool Write(ostream &stream, bool WriteBinary=false)
Write input port 0 data to an arbitrary stream.
vtkArrayWriter::Binary
vtkTypeBool Binary
Definition: vtkArrayWriter.h:138
vtkArrayWriter::Write
static bool Write(vtkArray *array, ostream &stream, bool WriteBinary=false)
Write arbitrary data to a stream without using the pipeline.
vtkArrayWriter::GetOutputString
virtual vtkStdString GetOutputString()
The output string.
Definition: vtkArrayWriter.h:84
vtkArrayWriter::OutputString
vtkStdString OutputString
Definition: vtkArrayWriter.h:140
vtkArrayWriter::vtkArrayWriter
vtkArrayWriter()
vtkArrayWriter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkArrayWriter::Write
int Write() override
Write data to output.
vtkArrayWriter::WriteToOutputString
bool WriteToOutputString
Definition: vtkArrayWriter.h:139
vtkArrayWriter::Write
vtkStdString Write(bool WriteBinary)
Write input port 0 data to a string.
vtkArrayWriter::Write
static bool Write(vtkArray *array, const vtkStdString &file_name, bool WriteBinary=false)
Write an arbitrary array to a file, without using the pipeline.
vtkArrayWriter::vtkGetFilePathMacro
vtkGetFilePathMacro(FileName)
Get / set the filename where data will be stored (when used as a filter).
vtkArrayWriter::~vtkArrayWriter
~vtkArrayWriter() override
vtkArrayWriter::Write
bool Write(const vtkStdString &FileName, bool WriteBinary=false)
Writes input port 0 data to a file, using an arbitrary filename and binary flag.
vtkArrayWriter::New
static vtkArrayWriter * New()
vtkArrayWriter::Write
static vtkStdString Write(vtkArray *array, bool WriteBinary=false)
Write arbitrary data to a string without using the pipeline.
vtkArrayWriter::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkArray
Abstract interface for N-dimensional arrays.
Definition: vtkArray.h:52
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
vtkWriter
abstract class to write data to file(s)
Definition: vtkWriter.h:35
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkStdString.h
vtkWriter.h