VTK  9.5.20251112
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
32#ifndef vtkDelimitedTextWriter_h
33#define vtkDelimitedTextWriter_h
34
35#include "vtkIOCoreModule.h" // For export macro
36#include "vtkWriter.h"
37
38VTK_ABI_NAMESPACE_BEGIN
39class vtkStdString;
40class vtkTable;
41
42class VTKIOCORE_EXPORT vtkDelimitedTextWriter : public vtkWriter
43{
44public:
47 void PrintSelf(ostream& os, vtkIndent indent) override;
48
50
53 vtkSetStringMacro(FieldDelimiter);
54 vtkGetStringMacro(FieldDelimiter);
56
58
62 vtkSetStringMacro(StringDelimiter);
63 vtkGetStringMacro(StringDelimiter);
65
67
73
75
79 vtkSetMacro(UseStringDelimiter, bool);
80 vtkGetMacro(UseStringDelimiter, bool);
82
84
87 vtkSetMacro(WriteToOutputString, bool);
88 vtkGetMacro(WriteToOutputString, bool);
89 vtkBooleanMacro(WriteToOutputString, bool);
91
97
103
105
109 vtkSetMacro(Precision, int);
110 vtkGetMacro(Precision, int);
112
114 {
115 STANDARD_NOTATION = 0,
117 FIXED_NOTATION
118 };
119
121
134 vtkSetMacro(Notation, int);
135 vtkGetMacro(Notation, int);
136 virtual void SetNotationToStandard() { this->SetNotation(STANDARD_NOTATION); }
137 virtual void SetNotationToScientific() { this->SetNotation(SCIENTIFIC_NOTATION); }
138 virtual void SetNotationToFixed() { this->SetNotation(FIXED_NOTATION); }
140
141protected:
144
147
149
150 void WriteData() override;
151 virtual void WriteTable(vtkTable* table);
152
153 // see algorithm for more info.
154 // This writer takes in vtkTable.
155 int FillInputPortInformation(int port, vtkInformation* info) override;
156
157 char* FileName;
161 int Precision = 6;
162 int Notation = STANDARD_NOTATION;
163
164 ostream* Stream;
165
166private:
168 void operator=(const vtkDelimitedTextWriter&) = delete;
169};
170
171VTK_ABI_NAMESPACE_END
172#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.
vtkSetFilePathMacro(FileName)
Get/Set the filename for the file.
char * RegisterAndGetOutputString()
This convenience method returns the string, sets the IVAR to nullptr, so that the user is responsible...
a simple class to control print indentation
Definition vtkIndent.h:108
Store vtkAlgorithm input/output information.
Wrapper around std::string to keep symbols short.
A table, which contains similar-typed columns of data.
Definition vtkTable.h:169
abstract class to write data to file(s)
Definition vtkWriter.h:36