VTK  9.2.5
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 
105 #ifndef vtkDelimitedTextReader_h
106 #define vtkDelimitedTextReader_h
107 
108 #include "vtkIOInfovisModule.h" // For export macro
109 #include "vtkStdString.h" // Needed for vtkStdString
110 #include "vtkTableAlgorithm.h"
111 
112 class VTKIOINFOVIS_EXPORT vtkDelimitedTextReader : public vtkTableAlgorithm
113 {
114 public:
117  void PrintSelf(ostream& os, vtkIndent indent) override;
118 
120 
126 
128 
134  void SetInputString(const char* in);
135  vtkGetStringMacro(InputString);
136  void SetInputString(const char* in, int len);
137  vtkGetMacro(InputStringLength, int);
138  void SetInputString(const vtkStdString& input)
139  {
140  this->SetInputString(input.c_str(), static_cast<int>(input.length()));
141  }
143 
145 
149  vtkSetMacro(ReadFromInputString, vtkTypeBool);
150  vtkGetMacro(ReadFromInputString, vtkTypeBool);
151  vtkBooleanMacro(ReadFromInputString, vtkTypeBool);
153 
155 
166  vtkGetStringMacro(UnicodeCharacterSet);
167  vtkSetStringMacro(UnicodeCharacterSet);
169 
171 
176  void SetUTF8RecordDelimiters(const char* delimiters);
177  const char* GetUTF8RecordDelimiters();
179 
181 
188  vtkSetStringMacro(FieldDelimiterCharacters);
189  vtkGetStringMacro(FieldDelimiterCharacters);
191 
192  void SetUTF8FieldDelimiters(const char* delimiters);
193  const char* GetUTF8FieldDelimiters();
194 
196 
205  vtkGetMacro(StringDelimiter, char);
206  vtkSetMacro(StringDelimiter, char);
208 
209  void SetUTF8StringDelimiters(const char* delimiters);
210  const char* GetUTF8StringDelimiters();
211 
213 
216  vtkSetMacro(UseStringDelimiter, bool);
217  vtkGetMacro(UseStringDelimiter, bool);
218  vtkBooleanMacro(UseStringDelimiter, bool);
220 
222 
226  vtkGetMacro(HaveHeaders, bool);
227  vtkSetMacro(HaveHeaders, bool);
229 
231 
236  vtkSetMacro(MergeConsecutiveDelimiters, bool);
237  vtkGetMacro(MergeConsecutiveDelimiters, bool);
238  vtkBooleanMacro(MergeConsecutiveDelimiters, bool);
240 
242 
246  vtkGetMacro(MaxRecords, vtkIdType);
247  vtkSetMacro(MaxRecords, vtkIdType);
249 
251 
256  vtkSetMacro(DetectNumericColumns, bool);
257  vtkGetMacro(DetectNumericColumns, bool);
258  vtkBooleanMacro(DetectNumericColumns, bool);
260 
262 
267  vtkSetMacro(ForceDouble, bool);
268  vtkGetMacro(ForceDouble, bool);
269  vtkBooleanMacro(ForceDouble, bool);
271 
273 
288  vtkSetMacro(TrimWhitespacePriorToNumericConversion, bool);
289  vtkGetMacro(TrimWhitespacePriorToNumericConversion, bool);
290  vtkBooleanMacro(TrimWhitespacePriorToNumericConversion, bool);
292 
294 
298  vtkSetMacro(DefaultIntegerValue, int);
299  vtkGetMacro(DefaultIntegerValue, int);
301 
303 
307  vtkSetMacro(DefaultDoubleValue, double);
308  vtkGetMacro(DefaultDoubleValue, double);
310 
312 
316  vtkSetStringMacro(PedigreeIdArrayName);
317  vtkGetStringMacro(PedigreeIdArrayName);
319 
321 
325  vtkSetMacro(GeneratePedigreeIds, bool);
326  vtkGetMacro(GeneratePedigreeIds, bool);
327  vtkBooleanMacro(GeneratePedigreeIds, bool);
329 
331 
334  vtkSetMacro(OutputPedigreeIds, bool);
335  vtkGetMacro(OutputPedigreeIds, bool);
336  vtkBooleanMacro(OutputPedigreeIds, bool);
338 
340 
345  vtkSetMacro(AddTabFieldDelimiter, bool);
346  vtkGetMacro(AddTabFieldDelimiter, bool);
347  vtkBooleanMacro(AddTabFieldDelimiter, bool);
349 
356 
358 
363  vtkSetMacro(ReplacementCharacter, vtkTypeUInt32);
364  vtkGetMacro(ReplacementCharacter, vtkTypeUInt32);
366 
367 protected:
370 
372 
373  // Read the content of the input file.
374  int ReadData(vtkTable* const output_table);
375 
376  char* FileName;
378  char* InputString;
402  vtkTypeUInt32 ReplacementCharacter;
403 
404 private:
406  void operator=(const vtkDelimitedTextReader&) = delete;
407 };
408 
409 #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.
const char * GetUTF8StringDelimiters()
static vtkDelimitedTextReader * New()
~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.
int ReadData(vtkTable *const output_table)
vtkSetFilePathMacro(FileName)
Specifies the delimited text file to be loaded.
void SetInputString(const vtkStdString &input)
Specify the InputString for use when reading from a character array.
const char * GetUTF8FieldDelimiters()
void SetUTF8FieldDelimiters(const char *delimiters)
const char * GetUTF8RecordDelimiters()
Specify the character(s) that will be used to separate records.
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:108
Superclass for algorithms that produce only vtkTables as output.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:183
@ string
Definition: vtkX3D.h:496
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332