VTK  9.3.0
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
19 #ifndef vtkDelimitedTextWriter_h
20 #define vtkDelimitedTextWriter_h
21 
22 #include "vtkIOCoreModule.h" // For export macro
23 #include "vtkWriter.h"
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkStdString;
27 class vtkTable;
28 
29 class VTKIOCORE_EXPORT vtkDelimitedTextWriter : public vtkWriter
30 {
31 public:
34  void PrintSelf(ostream& os, vtkIndent indent) override;
35 
37 
40  vtkSetStringMacro(FieldDelimiter);
41  vtkGetStringMacro(FieldDelimiter);
43 
45 
49  vtkSetStringMacro(StringDelimiter);
50  vtkGetStringMacro(StringDelimiter);
52 
54 
60 
62 
66  vtkSetMacro(UseStringDelimiter, bool);
67  vtkGetMacro(UseStringDelimiter, bool);
69 
71 
74  vtkSetMacro(WriteToOutputString, bool);
75  vtkGetMacro(WriteToOutputString, bool);
76  vtkBooleanMacro(WriteToOutputString, bool);
78 
84 
90 
91 protected:
94 
96  char* OutputString;
97 
98  bool OpenStream();
99 
100  void WriteData() override;
101  virtual void WriteTable(vtkTable* table);
102 
103  // see algorithm for more info.
104  // This writer takes in vtkTable.
106 
107  char* FileName;
111 
112  ostream* Stream;
113 
114 private:
116  void operator=(const vtkDelimitedTextWriter&) = delete;
117 };
118 
119 VTK_ABI_NAMESPACE_END
120 #endif
Delimited text writer for vtkTable Writes a vtkTable as a delimited text file (such as CSV).
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void WriteTable(vtkTable *table)
void WriteData() override
vtkGetFilePathMacro(FileName)
Get/Set the filename for the file.
static vtkDelimitedTextWriter * New()
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
~vtkDelimitedTextWriter() override
vtkStdString GetString(vtkStdString string)
Internal method: Returns the "string" with the "StringDelimiter" if UseStringDelimiter is true.
char * RegisterAndGetOutputString()
This convenience method returns the string, sets the IVAR to nullptr, so that the user is responsible...
vtkSetFilePathMacro(FileName)
Get/Set the filename for the file.
a simple class to control print indentation
Definition: vtkIndent.h:38
Store vtkAlgorithm input/output information.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:68
abstract class to write data to file(s)
Definition: vtkWriter.h:35
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447