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 
73 class VTKIOINFOVIS_EXPORT vtkDelimitedTextReader : public vtkTableAlgorithm
74 {
75 public:
76  static vtkDelimitedTextReader* New();
78  void PrintSelf(ostream& os, vtkIndent indent) override;
79 
81 
84  vtkGetFilePathMacro(FileName);
85  vtkSetFilePathMacro(FileName);
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);
138  const char* GetUTF8RecordDelimiters();
140 
142 
149  vtkSetStringMacro(FieldDelimiterCharacters);
150  vtkGetStringMacro(FieldDelimiterCharacters);
152 
153  void SetUTF8FieldDelimiters(const char* delimiters);
154  const char* GetUTF8FieldDelimiters();
155 
157 
166  vtkGetMacro(StringDelimiter, char);
167  vtkSetMacro(StringDelimiter, char);
169 
170  void SetUTF8StringDelimiters(const char* delimiters);
171  const char* GetUTF8StringDelimiters();
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 
316  vtkStdString GetLastError();
317 
319 
324  vtkSetMacro(ReplacementCharacter, vtkTypeUInt32);
325  vtkGetMacro(ReplacementCharacter, vtkTypeUInt32);
327 
328 protected:
330  ~vtkDelimitedTextReader() override;
331 
333 
334  // Read the content of the input file.
335  int ReadData(vtkTable* const output_table);
336 
337  char* FileName;
339  char* InputString;
363  vtkTypeUInt32 ReplacementCharacter;
364 
365 private:
367  void operator=(const vtkDelimitedTextReader&) = delete;
368 };
369 
370 #endif
void SetInputString(const vtkStdString &input)
Specify the InputString for use when reading from a character array.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkTableAlgorithm * New()
Store vtkAlgorithm input/output information.
int vtkIdType
Definition: vtkType.h:332
int vtkTypeBool
Definition: vtkABI.h:69
reads in delimited ascii or unicode text files and outputs a vtkTable data structure.
a simple class to control print indentation
Definition: vtkIndent.h:39
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:73
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
Superclass for algorithms that produce only vtkTables as output.
Store zero or more vtkInformation instances.