VTK
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 "vtkWriter.h"
60 #include "vtkStdString.h" // For string API
61 
62 class vtkArray;
63 
64 class VTKIOCORE_EXPORT vtkArrayWriter :
65  public vtkWriter
66 {
67 public:
68  static vtkArrayWriter *New();
69  vtkTypeMacro(vtkArrayWriter, vtkWriter);
70  void PrintSelf(ostream& os, vtkIndent indent) override;
71 
73 
76  vtkSetStringMacro(FileName);
77  vtkGetStringMacro(FileName);
79 
81 
84  vtkSetMacro(Binary, vtkTypeBool);
85  vtkGetMacro(Binary, vtkTypeBool);
86  vtkBooleanMacro(Binary, vtkTypeBool);
88 
93  { return this->OutputString; }
94 
96 
99  vtkSetMacro(WriteToOutputString, bool);
100  vtkGetMacro(WriteToOutputString, bool);
101  vtkBooleanMacro(WriteToOutputString, bool);
103 
104  int Write() override; // This is necessary to get Write() wrapped for scripting languages.
105 
109  bool Write(const vtkStdString& FileName, bool WriteBinary = false);
110 
114  static bool Write(vtkArray* array, const vtkStdString& file_name, bool WriteBinary = false);
115 
120  bool Write(ostream& stream, bool WriteBinary = false);
121 
126  static bool Write(vtkArray* array, ostream& stream, bool WriteBinary = false);
127 
132  vtkStdString Write(bool WriteBinary);
133 
137  static vtkStdString Write(vtkArray* array, bool WriteBinary = false);
138 
139 protected:
140  vtkArrayWriter();
141  ~vtkArrayWriter() override;
142 
143  int FillInputPortInformation(int port, vtkInformation* info) override;
144  void WriteData() override;
145 
146  char* FileName;
150 
151 private:
152  vtkArrayWriter(const vtkArrayWriter&) = delete;
153  void operator=(const vtkArrayWriter&) = delete;
154 };
155 
156 #endif
157 
vtkStdString.h
vtkAlgorithm::FillInputPortInformation
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
vtkWriter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkWriter::Write
virtual int Write()
Write data to output.
vtkArrayWriter::OutputString
vtkStdString OutputString
Definition: vtkArrayWriter.h:149
vtkX3D::port
Definition: vtkX3D.h:447
vtkWriter::WriteData
virtual void WriteData()=0
vtkArrayWriter::FileName
char * FileName
Definition: vtkArrayWriter.h:146
vtkArrayWriter
Serialize sparse and dense arrays to a file or stream.
Definition: vtkArrayWriter.h:64
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkWriter
abstract class to write data to file(s)
Definition: vtkWriter.h:42
vtkArray
Abstract interface for N-dimensional arrays.
Definition: vtkArray.h:70
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkX3D::info
Definition: vtkX3D.h:376
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkWriter.h
vtkArrayWriter::Binary
vtkTypeBool Binary
Definition: vtkArrayWriter.h:147
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
vtkArrayWriter::WriteToOutputString
bool WriteToOutputString
Definition: vtkArrayWriter.h:148
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkArrayWriter::GetOutputString
virtual vtkStdString GetOutputString()
The output string.
Definition: vtkArrayWriter.h:92