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 
55 #ifndef vtkArrayWriter_h
56 #define vtkArrayWriter_h
57 
58 #include "vtkIOCoreModule.h" // For export macro
59 #include "vtkStdString.h" // For string API
60 #include "vtkWriter.h"
61 
62 class vtkArray;
63 
64 class VTKIOCORE_EXPORT vtkArrayWriter : public vtkWriter
65 {
66 public:
67  static vtkArrayWriter* New();
68  vtkTypeMacro(vtkArrayWriter, vtkWriter);
69  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
72 
75  vtkSetFilePathMacro(FileName);
76  vtkGetFilePathMacro(FileName);
78 
80 
83  vtkSetMacro(Binary, vtkTypeBool);
84  vtkGetMacro(Binary, vtkTypeBool);
85  vtkBooleanMacro(Binary, vtkTypeBool);
87 
91  virtual vtkStdString GetOutputString() { return this->OutputString; }
92 
94 
97  vtkSetMacro(WriteToOutputString, bool);
98  vtkGetMacro(WriteToOutputString, bool);
99  vtkBooleanMacro(WriteToOutputString, bool);
101 
102  int Write() override; // This is necessary to get Write() wrapped for scripting languages.
103 
107  bool Write(const vtkStdString& FileName, bool WriteBinary = false);
108 
112  static bool Write(vtkArray* array, const vtkStdString& file_name, bool WriteBinary = false);
113 
118  bool Write(ostream& stream, bool WriteBinary = false);
119 
124  static bool Write(vtkArray* array, ostream& stream, bool WriteBinary = false);
125 
130  vtkStdString Write(bool WriteBinary);
131 
135  static vtkStdString Write(vtkArray* array, bool WriteBinary = false);
136 
137 protected:
138  vtkArrayWriter();
139  ~vtkArrayWriter() override;
140 
141  int FillInputPortInformation(int port, vtkInformation* info) override;
142  void WriteData() override;
143 
144  char* FileName;
148 
149 private:
150  vtkArrayWriter(const vtkArrayWriter&) = delete;
151  void operator=(const vtkArrayWriter&) = delete;
152 };
153 
154 #endif
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
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:67
int vtkTypeBool
Definition: vtkABI.h:69
abstract class to write data to file(s)
Definition: vtkWriter.h:45
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:39
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.