VTK  9.3.1
vtkDelimitedTextWriter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2009 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
10 #ifndef vtkDelimitedTextWriter_h
11 #define vtkDelimitedTextWriter_h
12 
13 #include "vtkIOCoreModule.h" // For export macro
14 #include "vtkWriter.h"
15 
16 VTK_ABI_NAMESPACE_BEGIN
17 class vtkStdString;
18 class vtkTable;
19 
20 class VTKIOCORE_EXPORT vtkDelimitedTextWriter : public vtkWriter
21 {
22 public:
23  static vtkDelimitedTextWriter* New();
25  void PrintSelf(ostream& os, vtkIndent indent) override;
26 
28 
31  vtkSetStringMacro(FieldDelimiter);
32  vtkGetStringMacro(FieldDelimiter);
34 
36 
40  vtkSetStringMacro(StringDelimiter);
41  vtkGetStringMacro(StringDelimiter);
43 
45 
48  vtkSetFilePathMacro(FileName);
49  vtkGetFilePathMacro(FileName);
51 
53 
57  vtkSetMacro(UseStringDelimiter, bool);
58  vtkGetMacro(UseStringDelimiter, bool);
60 
62 
65  vtkSetMacro(WriteToOutputString, bool);
66  vtkGetMacro(WriteToOutputString, bool);
67  vtkBooleanMacro(WriteToOutputString, bool);
69 
74  char* RegisterAndGetOutputString();
75 
80  vtkStdString GetString(vtkStdString string);
81 
82 protected:
84  ~vtkDelimitedTextWriter() override;
85 
87  char* OutputString;
88 
89  bool OpenStream();
90 
91  void WriteData() override;
92  virtual void WriteTable(vtkTable* table);
93 
94  // see algorithm for more info.
95  // This writer takes in vtkTable.
97 
98  char* FileName;
102 
103  ostream* Stream;
104 
105 private:
107  void operator=(const vtkDelimitedTextWriter&) = delete;
108 };
109 
110 VTK_ABI_NAMESPACE_END
111 #endif
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:28
Store vtkAlgorithm input/output information.
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.
Delimited text writer for vtkTable Writes a vtkTable as a delimited text file (such as CSV)...
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.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:58
static vtkAlgorithm * New()
virtual void WriteData()=0