VTK  9.3.0
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
38#ifndef vtkArrayWriter_h
39#define vtkArrayWriter_h
40
41#include "vtkIOCoreModule.h" // For export macro
42#include "vtkStdString.h" // For string API
43#include "vtkWriter.h"
44
45VTK_ABI_NAMESPACE_BEGIN
46class vtkArray;
47
48class VTKIOCORE_EXPORT vtkArrayWriter : public vtkWriter
49{
50public:
52 vtkTypeMacro(vtkArrayWriter, vtkWriter);
53 void PrintSelf(ostream& os, vtkIndent indent) override;
54
56
62
64
67 vtkSetMacro(Binary, vtkTypeBool);
68 vtkGetMacro(Binary, vtkTypeBool);
69 vtkBooleanMacro(Binary, vtkTypeBool);
71
75 virtual vtkStdString GetOutputString() { return this->OutputString; }
76
78
81 vtkSetMacro(WriteToOutputString, bool);
82 vtkGetMacro(WriteToOutputString, bool);
83 vtkBooleanMacro(WriteToOutputString, bool);
85
86 int Write() override; // This is necessary to get Write() wrapped for scripting languages.
87
91 bool Write(const vtkStdString& FileName, bool WriteBinary = false);
92
96 static bool Write(vtkArray* array, const vtkStdString& file_name, bool WriteBinary = false);
97
102 bool Write(ostream& stream, bool WriteBinary = false);
103
108 static bool Write(vtkArray* array, ostream& stream, bool WriteBinary = false);
109
114 vtkStdString Write(bool WriteBinary);
115
119 static vtkStdString Write(vtkArray* array, bool WriteBinary = false);
120
121protected:
123 ~vtkArrayWriter() override;
124
125 int FillInputPortInformation(int port, vtkInformation* info) override;
126 void WriteData() override;
127
128 char* FileName;
132
133private:
134 vtkArrayWriter(const vtkArrayWriter&) = delete;
135 void operator=(const vtkArrayWriter&) = delete;
136};
137
138VTK_ABI_NAMESPACE_END
139#endif
Serialize sparse and dense arrays to a file or stream.
static vtkArrayWriter * New()
void WriteData() override
vtkSetFilePathMacro(FileName)
Get / set the filename where data will be stored (when used as a filter).
bool Write(ostream &stream, bool WriteBinary=false)
Write input port 0 data to an arbitrary stream.
vtkTypeBool Binary
static bool Write(vtkArray *array, ostream &stream, bool WriteBinary=false)
Write arbitrary data to a stream without using the pipeline.
virtual vtkStdString GetOutputString()
The output string.
vtkStdString OutputString
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int Write() override
Write data to output.
vtkStdString Write(bool WriteBinary)
Write input port 0 data to a string.
static bool Write(vtkArray *array, const vtkStdString &file_name, bool WriteBinary=false)
Write an arbitrary array to a file, without using the pipeline.
vtkGetFilePathMacro(FileName)
Get / set the filename where data will be stored (when used as a filter).
~vtkArrayWriter() override
bool Write(const vtkStdString &FileName, bool WriteBinary=false)
Writes input port 0 data to a file, using an arbitrary filename and binary flag.
static vtkStdString Write(vtkArray *array, bool WriteBinary=false)
Write arbitrary data to a string without using the pipeline.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Abstract interface for N-dimensional arrays.
Definition vtkArray.h:52
a simple class to control print indentation
Definition vtkIndent.h:29
Store vtkAlgorithm input/output information.
Wrapper around std::string to keep symbols short.
abstract class to write data to file(s)
Definition vtkWriter.h:32
int vtkTypeBool
Definition vtkABI.h:64