VTK  9.3.20240328
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
29 #ifndef vtkDelimitedTextWriter_h
30 #define vtkDelimitedTextWriter_h
31 
32 #include "vtkIOCoreModule.h" // For export macro
33 #include "vtkWriter.h"
34 
35 VTK_ABI_NAMESPACE_BEGIN
36 class vtkStdString;
37 class vtkTable;
38 
39 class VTKIOCORE_EXPORT vtkDelimitedTextWriter : public vtkWriter
40 {
41 public:
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
47 
50  vtkSetStringMacro(FieldDelimiter);
51  vtkGetStringMacro(FieldDelimiter);
53 
55 
59  vtkSetStringMacro(StringDelimiter);
60  vtkGetStringMacro(StringDelimiter);
62 
64 
70 
72 
76  vtkSetMacro(UseStringDelimiter, bool);
77  vtkGetMacro(UseStringDelimiter, bool);
79 
81 
84  vtkSetMacro(WriteToOutputString, bool);
85  vtkGetMacro(WriteToOutputString, bool);
86  vtkBooleanMacro(WriteToOutputString, bool);
88 
94 
100 
101 protected:
104 
107 
108  bool OpenStream();
109 
110  void WriteData() override;
111  virtual void WriteTable(vtkTable* table);
112 
113  // see algorithm for more info.
114  // This writer takes in vtkTable.
116 
117  char* FileName;
121 
122  ostream* Stream;
123 
124 private:
126  void operator=(const vtkDelimitedTextWriter&) = delete;
127 };
128 
129 VTK_ABI_NAMESPACE_END
130 #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:108
Store vtkAlgorithm input/output information.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:78
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:168
abstract class to write data to file(s)
Definition: vtkWriter.h:35
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447