VTK  9.2.6
vtkArrayWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkArrayWriter.h
5 
6 -------------------------------------------------------------------------
7  Copyright 2008 Sandia Corporation.
8  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9  the U.S. Government retains certain rights in this software.
10 -------------------------------------------------------------------------
11 
12  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
13  All rights reserved.
14  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
15 
16  This software is distributed WITHOUT ANY WARRANTY; without even
17  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18  PURPOSE. See the above copyright notice for more information.
19 
20 =========================================================================*/
21 
74 #ifndef vtkArrayWriter_h
75 #define vtkArrayWriter_h
76 
77 #include "vtkIOCoreModule.h" // For export macro
78 #include "vtkStdString.h" // For string API
79 #include "vtkWriter.h"
80 
81 class vtkArray;
82 
83 class VTKIOCORE_EXPORT vtkArrayWriter : public vtkWriter
84 {
85 public:
86  static vtkArrayWriter* New();
87  vtkTypeMacro(vtkArrayWriter, vtkWriter);
88  void PrintSelf(ostream& os, vtkIndent indent) override;
89 
91 
97 
99 
102  vtkSetMacro(Binary, vtkTypeBool);
103  vtkGetMacro(Binary, vtkTypeBool);
104  vtkBooleanMacro(Binary, vtkTypeBool);
106 
110  virtual vtkStdString GetOutputString() { return this->OutputString; }
111 
113 
116  vtkSetMacro(WriteToOutputString, bool);
117  vtkGetMacro(WriteToOutputString, bool);
118  vtkBooleanMacro(WriteToOutputString, bool);
120 
121  int Write() override; // This is necessary to get Write() wrapped for scripting languages.
122 
126  bool Write(const vtkStdString& FileName, bool WriteBinary = false);
127 
131  static bool Write(vtkArray* array, const vtkStdString& file_name, bool WriteBinary = false);
132 
137  bool Write(ostream& stream, bool WriteBinary = false);
138 
143  static bool Write(vtkArray* array, ostream& stream, bool WriteBinary = false);
144 
149  vtkStdString Write(bool WriteBinary);
150 
154  static vtkStdString Write(vtkArray* array, bool WriteBinary = false);
155 
156 protected:
158  ~vtkArrayWriter() override;
159 
161  void WriteData() override;
162 
163  char* FileName;
167 
168 private:
169  vtkArrayWriter(const vtkArrayWriter&) = delete;
170  void operator=(const vtkArrayWriter&) = delete;
171 };
172 
173 #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:68
a simple class to control print indentation
Definition: vtkIndent.h:119
Store vtkAlgorithm input/output information.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:108
abstract class to write data to file(s)
Definition: vtkWriter.h:46
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
int vtkTypeBool
Definition: vtkABI.h:69