VTK  9.2.6
vtkDelimitedTextReader.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkDelimitedTextReader.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15/*-------------------------------------------------------------------------
16 Copyright 2008 Sandia Corporation.
17 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18 the U.S. Government retains certain rights in this software.
19-------------------------------------------------------------------------*/
20
66#ifndef vtkDelimitedTextReader_h
67#define vtkDelimitedTextReader_h
68
69#include "vtkIOInfovisModule.h" // For export macro
70#include "vtkStdString.h" // Needed for vtkStdString
71#include "vtkTableAlgorithm.h"
72
73class VTKIOINFOVIS_EXPORT vtkDelimitedTextReader : public vtkTableAlgorithm
74{
75public:
78 void PrintSelf(ostream& os, vtkIndent indent) override;
79
81
87
89
95 void SetInputString(const char* in);
96 vtkGetStringMacro(InputString);
97 void SetInputString(const char* in, int len);
98 vtkGetMacro(InputStringLength, int);
99 void SetInputString(const vtkStdString& input)
100 {
101 this->SetInputString(input.c_str(), static_cast<int>(input.length()));
102 }
104
106
110 vtkSetMacro(ReadFromInputString, vtkTypeBool);
111 vtkGetMacro(ReadFromInputString, vtkTypeBool);
112 vtkBooleanMacro(ReadFromInputString, vtkTypeBool);
114
116
127 vtkGetStringMacro(UnicodeCharacterSet);
128 vtkSetStringMacro(UnicodeCharacterSet);
130
132
137 void SetUTF8RecordDelimiters(const char* delimiters);
140
142
149 vtkSetStringMacro(FieldDelimiterCharacters);
150 vtkGetStringMacro(FieldDelimiterCharacters);
152
153 void SetUTF8FieldDelimiters(const char* delimiters);
155
157
166 vtkGetMacro(StringDelimiter, char);
167 vtkSetMacro(StringDelimiter, char);
169
170 void SetUTF8StringDelimiters(const char* delimiters);
172
174
177 vtkSetMacro(UseStringDelimiter, bool);
178 vtkGetMacro(UseStringDelimiter, bool);
179 vtkBooleanMacro(UseStringDelimiter, bool);
181
183
187 vtkGetMacro(HaveHeaders, bool);
188 vtkSetMacro(HaveHeaders, bool);
190
192
197 vtkSetMacro(MergeConsecutiveDelimiters, bool);
198 vtkGetMacro(MergeConsecutiveDelimiters, bool);
199 vtkBooleanMacro(MergeConsecutiveDelimiters, bool);
201
203
207 vtkGetMacro(MaxRecords, vtkIdType);
208 vtkSetMacro(MaxRecords, vtkIdType);
210
212
217 vtkSetMacro(DetectNumericColumns, bool);
218 vtkGetMacro(DetectNumericColumns, bool);
219 vtkBooleanMacro(DetectNumericColumns, bool);
221
223
228 vtkSetMacro(ForceDouble, bool);
229 vtkGetMacro(ForceDouble, bool);
230 vtkBooleanMacro(ForceDouble, bool);
232
234
249 vtkSetMacro(TrimWhitespacePriorToNumericConversion, bool);
250 vtkGetMacro(TrimWhitespacePriorToNumericConversion, bool);
251 vtkBooleanMacro(TrimWhitespacePriorToNumericConversion, bool);
253
255
259 vtkSetMacro(DefaultIntegerValue, int);
260 vtkGetMacro(DefaultIntegerValue, int);
262
264
268 vtkSetMacro(DefaultDoubleValue, double);
269 vtkGetMacro(DefaultDoubleValue, double);
271
273
277 vtkSetStringMacro(PedigreeIdArrayName);
278 vtkGetStringMacro(PedigreeIdArrayName);
280
282
286 vtkSetMacro(GeneratePedigreeIds, bool);
287 vtkGetMacro(GeneratePedigreeIds, bool);
288 vtkBooleanMacro(GeneratePedigreeIds, bool);
290
292
295 vtkSetMacro(OutputPedigreeIds, bool);
296 vtkGetMacro(OutputPedigreeIds, bool);
297 vtkBooleanMacro(OutputPedigreeIds, bool);
299
301
306 vtkSetMacro(AddTabFieldDelimiter, bool);
307 vtkGetMacro(AddTabFieldDelimiter, bool);
308 vtkBooleanMacro(AddTabFieldDelimiter, bool);
310
317
319
324 vtkSetMacro(ReplacementCharacter, vtkTypeUInt32);
325 vtkGetMacro(ReplacementCharacter, vtkTypeUInt32);
327
328protected:
331
333
334 // Read the content of the input file.
335 int ReadData(vtkTable* const output_table);
336
337 char* FileName;
346 std::string UnicodeWhitespace;
363 vtkTypeUInt32 ReplacementCharacter;
364
365private:
367 void operator=(const vtkDelimitedTextReader&) = delete;
368};
369
370#endif
reads in delimited ascii or unicode text files and outputs a vtkTable data structure.
void SetInputString(const char *in, int len)
Specify the InputString for use when reading from a character array.
~vtkDelimitedTextReader() override
void SetUTF8RecordDelimiters(const char *delimiters)
Specify the character(s) that will be used to separate records.
vtkStdString GetLastError()
Returns a human-readable description of the most recent error, if any.
void SetInputString(const char *in)
Specify the InputString for use when reading from a character array.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void SetUTF8StringDelimiters(const char *delimiters)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkGetFilePathMacro(FileName)
Specifies the delimited text file to be loaded.
const char * GetUTF8StringDelimiters()
int ReadData(vtkTable *const output_table)
vtkSetFilePathMacro(FileName)
Specifies the delimited text file to be loaded.
static vtkDelimitedTextReader * New()
const char * GetUTF8RecordDelimiters()
Specify the character(s) that will be used to separate records.
void SetInputString(const vtkStdString &input)
Specify the InputString for use when reading from a character array.
const char * GetUTF8FieldDelimiters()
void SetUTF8FieldDelimiters(const char *delimiters)
a simple class to control print indentation
Definition vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Wrapper around std::string to keep symbols short.
Superclass for algorithms that produce only vtkTables as output.
A table, which contains similar-typed columns of data.
Definition vtkTable.h:74
int vtkTypeBool
Definition vtkABI.h:69
int vtkIdType
Definition vtkType.h:332