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 
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 
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:
132  ~vtkArrayWriter() override;
133 
135  void WriteData() override;
136 
137  char* FileName;
141 
142 private:
143  vtkArrayWriter(const vtkArrayWriter&) = delete;
144  void operator=(const vtkArrayWriter&) = delete;
145 };
146 
147 VTK_ABI_NAMESPACE_END
148 #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:38
Store vtkAlgorithm input/output information.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
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