VTK  9.3.20240417
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 
57 #ifndef vtkArrayWriter_h
58 #define vtkArrayWriter_h
59 
60 #include "vtkIOCoreModule.h" // For export macro
61 #include "vtkStdString.h" // For string API
62 #include "vtkWriter.h"
63 
64 VTK_ABI_NAMESPACE_BEGIN
65 class vtkArray;
66 
67 class VTKIOCORE_EXPORT vtkArrayWriter : public vtkWriter
68 {
69 public:
70  static vtkArrayWriter* New();
71  vtkTypeMacro(vtkArrayWriter, vtkWriter);
72  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
75 
81 
83 
86  vtkSetMacro(Binary, vtkTypeBool);
87  vtkGetMacro(Binary, vtkTypeBool);
88  vtkBooleanMacro(Binary, vtkTypeBool);
90 
94  virtual vtkStdString GetOutputString() { return this->OutputString; }
95 
97 
100  vtkSetMacro(WriteToOutputString, bool);
101  vtkGetMacro(WriteToOutputString, bool);
102  vtkBooleanMacro(WriteToOutputString, bool);
104 
105  int Write() override; // This is necessary to get Write() wrapped for scripting languages.
106 
110  bool Write(const vtkStdString& FileName, bool WriteBinary = false);
111 
115  static bool Write(vtkArray* array, const vtkStdString& file_name, bool WriteBinary = false);
116 
121  bool Write(ostream& stream, bool WriteBinary = false);
122 
127  static bool Write(vtkArray* array, ostream& stream, bool WriteBinary = false);
128 
133  vtkStdString Write(bool WriteBinary);
134 
138  static vtkStdString Write(vtkArray* array, bool WriteBinary = false);
139 
140 protected:
142  ~vtkArrayWriter() override;
143 
145  void WriteData() override;
146 
147  char* FileName;
151 
152 private:
153  vtkArrayWriter(const vtkArrayWriter&) = delete;
154  void operator=(const vtkArrayWriter&) = delete;
155 };
156 
157 VTK_ABI_NAMESPACE_END
158 #endif
Serialize sparse and dense arrays to a file or stream.
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 vtkArrayWriter * New()
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:108
Store vtkAlgorithm input/output information.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:78
abstract class to write data to file(s)
Definition: vtkWriter.h:35
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
int vtkTypeBool
Definition: vtkABI.h:64