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 
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 
45 VTK_ABI_NAMESPACE_BEGIN
46 class vtkArray;
47 
48 class VTKIOCORE_EXPORT vtkArrayWriter : public vtkWriter
49 {
50 public:
51  static vtkArrayWriter* New();
52  vtkTypeMacro(vtkArrayWriter, vtkWriter);
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
56 
59  vtkSetFilePathMacro(FileName);
60  vtkGetFilePathMacro(FileName);
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 
121 protected:
122  vtkArrayWriter();
123  ~vtkArrayWriter() override;
124 
125  int FillInputPortInformation(int port, vtkInformation* info) override;
126  void WriteData() override;
127 
128  char* FileName;
132 
133 private:
134  vtkArrayWriter(const vtkArrayWriter&) = delete;
135  void operator=(const vtkArrayWriter&) = delete;
136 };
137 
138 VTK_ABI_NAMESPACE_END
139 #endif
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:28
Serialize sparse and dense arrays to a file or stream.
Store vtkAlgorithm input/output information.
vtkTypeBool Binary
Abstract interface for N-dimensional arrays.
Definition: vtkArray.h:51
int vtkTypeBool
Definition: vtkABI.h:64
abstract class to write data to file(s)
Definition: vtkWriter.h:34
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
virtual int Write()
Write data to output.
vtkStdString OutputString
static vtkAlgorithm * New()
virtual void WriteData()=0
virtual vtkStdString GetOutputString()
The output string.