VTK
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
vtkDelimitedTextReader Class Reference

reads in delimited ascii or unicode text files and outputs a vtkTable data structure. More...

#include <vtkDelimitedTextReader.h>

Inheritance diagram for vtkDelimitedTextReader:
Inheritance graph
[legend]
Collaboration diagram for vtkDelimitedTextReader:
Collaboration graph
[legend]

List of all members.

Public Types

typedef vtkTableAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkDelimitedTextReaderNewInstance () const
void PrintSelf (ostream &os, vtkIndent indent)
void SetUTF8FieldDelimiters (const char *delimiters)
const char * GetUTF8FieldDelimiters ()
void SetUnicodeFieldDelimiters (const vtkUnicodeString &delimiters)
vtkUnicodeString GetUnicodeFieldDelimiters ()
void SetUTF8StringDelimiters (const char *delimiters)
const char * GetUTF8StringDelimiters ()
void SetUnicodeStringDelimiters (const vtkUnicodeString &delimiters)
vtkUnicodeString GetUnicodeStringDelimiters ()
vtkStdString GetLastError ()
virtual char * GetFileName ()
virtual void SetFileName (const char *)
virtual char * GetUnicodeCharacterSet ()
virtual void SetUnicodeCharacterSet (const char *)
void SetUTF8RecordDelimiters (const char *delimiters)
const char * GetUTF8RecordDelimiters ()
void SetUnicodeRecordDelimiters (const vtkUnicodeString &delimiters)
vtkUnicodeString GetUnicodeRecordDelimiters ()
virtual void SetFieldDelimiterCharacters (const char *)
virtual char * GetFieldDelimiterCharacters ()
virtual char GetStringDelimiter ()
virtual void SetStringDelimiter (char)
virtual void SetUseStringDelimiter (bool)
virtual bool GetUseStringDelimiter ()
virtual void UseStringDelimiterOn ()
virtual void UseStringDelimiterOff ()
virtual bool GetHaveHeaders ()
virtual void SetHaveHeaders (bool)
virtual void SetMergeConsecutiveDelimiters (bool)
virtual bool GetMergeConsecutiveDelimiters ()
virtual void MergeConsecutiveDelimitersOn ()
virtual void MergeConsecutiveDelimitersOff ()
virtual vtkIdType GetMaxRecords ()
virtual void SetMaxRecords (vtkIdType)
virtual void SetDetectNumericColumns (bool)
virtual bool GetDetectNumericColumns ()
virtual void DetectNumericColumnsOn ()
virtual void DetectNumericColumnsOff ()
virtual void SetForceDouble (bool)
virtual bool GetForceDouble ()
virtual void ForceDoubleOn ()
virtual void ForceDoubleOff ()
virtual void SetTrimWhitespacePriorToNumericConversion (bool)
virtual bool GetTrimWhitespacePriorToNumericConversion ()
virtual void TrimWhitespacePriorToNumericConversionOn ()
virtual void TrimWhitespacePriorToNumericConversionOff ()
virtual void SetDefaultIntegerValue (int)
virtual int GetDefaultIntegerValue ()
virtual void SetDefaultDoubleValue (double)
virtual double GetDefaultDoubleValue ()
virtual void SetPedigreeIdArrayName (const char *)
virtual char * GetPedigreeIdArrayName ()
virtual void SetGeneratePedigreeIds (bool)
virtual bool GetGeneratePedigreeIds ()
virtual void GeneratePedigreeIdsOn ()
virtual void GeneratePedigreeIdsOff ()
virtual void SetOutputPedigreeIds (bool)
virtual bool GetOutputPedigreeIds ()
virtual void OutputPedigreeIdsOn ()
virtual void OutputPedigreeIdsOff ()
virtual void SetReplacementCharacter (vtkTypeUInt32)
virtual vtkTypeUInt32 GetReplacementCharacter ()

Static Public Member Functions

static vtkDelimitedTextReaderNew ()
static int IsTypeOf (const char *type)
static vtkDelimitedTextReaderSafeDownCast (vtkObjectBase *o)

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 vtkDelimitedTextReader ()
 ~vtkDelimitedTextReader ()
int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *)

Protected Attributes

char * FileName
char * UnicodeCharacterSet
vtkIdType MaxRecords
vtkUnicodeString UnicodeRecordDelimiters
vtkUnicodeString UnicodeFieldDelimiters
vtkUnicodeString UnicodeStringDelimiters
vtkUnicodeString UnicodeWhitespace
vtkUnicodeString UnicodeEscapeCharacter
bool DetectNumericColumns
bool ForceDouble
bool TrimWhitespacePriorToNumericConversion
int DefaultIntegerValue
double DefaultDoubleValue
char * FieldDelimiterCharacters
char StringDelimiter
bool UseStringDelimiter
bool HaveHeaders
bool UnicodeOutputArrays
bool MergeConsecutiveDelimiters
char * PedigreeIdArrayName
bool GeneratePedigreeIds
bool OutputPedigreeIds
vtkStdString LastError
vtkTypeUInt32 ReplacementCharacter

Detailed Description

reads in delimited ascii or unicode text files and outputs a vtkTable data structure.

vtkDelimitedTextReader is an interface for pulling in data from a flat, delimited ascii or unicode text file (delimiter can be any character).

The behavior of the reader with respect to ascii or unicode input is controlled by the SetUnicodeCharacterSet() method. By default (without calling SetUnicodeCharacterSet()), the reader will expect to read ascii text and will output vtkStdString columns. Use the Set and Get methods to set delimiters that do not contain UTF8 in the name when operating the reader in default ascii mode. If the SetUnicodeCharacterSet() method is called, the reader will output vtkUnicodeString columns in the output table. In addition, it is necessary to use the Set and Get methods that contain UTF8 in the name to specify delimiters when operating in unicode mode.

There is also a special character set US-ASCII-WITH-FALLBACK that will treat the input text as ASCII no matter what. If and when it encounters a character with its 8th bit set it will replace that character with the code point ReplacementCharacter. You may use this if you have text that belongs to a code page like LATIN9 or ISO-8859-1 or friends: mostly ASCII but not entirely. Eventually this class will acquire the ability to read gracefully text from any code page, making this option obsolete.

This class emits ProgressEvent for every 100 lines it reads.

Thanks:
Thanks to Andy Wilson, Brian Wylie, Tim Shead, and Thomas Otahal from Sandia National Laboratories for implementing this class.
Warning:
This reader assumes that the first line in the file (whether that's headers or the first document) contains at least as many fields as any other line in the file.
Examples:
vtkDelimitedTextReader (Examples)
Tests:
vtkDelimitedTextReader (Tests)

Definition at line 77 of file vtkDelimitedTextReader.h.


Member Typedef Documentation

Reimplemented from vtkTableAlgorithm.

Definition at line 81 of file vtkDelimitedTextReader.h.


Constructor & Destructor Documentation


Member Function Documentation

Create an object with Debug turned off, modified time initialized to zero, and reference counting on.

Reimplemented from vtkTableAlgorithm.

static int vtkDelimitedTextReader::IsTypeOf ( const char *  name) [static]

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkTableAlgorithm.

virtual int vtkDelimitedTextReader::IsA ( const char *  name) [virtual]

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkTableAlgorithm.

Reimplemented from vtkTableAlgorithm.

virtual vtkObjectBase* vtkDelimitedTextReader::NewInstanceInternal ( ) const [protected, virtual]

Reimplemented from vtkTableAlgorithm.

Reimplemented from vtkTableAlgorithm.

void vtkDelimitedTextReader::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkTableAlgorithm.

virtual char* vtkDelimitedTextReader::GetFileName ( ) [virtual]

Specifies the delimited text file to be loaded.

virtual void vtkDelimitedTextReader::SetFileName ( const char *  ) [virtual]

Specifies the delimited text file to be loaded.

Specifies the character set used in the input file. Valid character set names will be drawn from the list maintained by the Internet Assigned Name Authority at http://www.iana.org/assignments/character-sets Where multiple aliases are provided for a character set, the preferred MIME name will be used. vtkUnicodeDelimitedTextReader currently supports "US-ASCII", "UTF-8", "UTF-16", "UTF-16BE", and "UTF-16LE" character sets.

virtual void vtkDelimitedTextReader::SetUnicodeCharacterSet ( const char *  ) [virtual]

Specifies the character set used in the input file. Valid character set names will be drawn from the list maintained by the Internet Assigned Name Authority at http://www.iana.org/assignments/character-sets Where multiple aliases are provided for a character set, the preferred MIME name will be used. vtkUnicodeDelimitedTextReader currently supports "US-ASCII", "UTF-8", "UTF-16", "UTF-16BE", and "UTF-16LE" character sets.

void vtkDelimitedTextReader::SetUTF8RecordDelimiters ( const char *  delimiters)

Specify the character(s) that will be used to separate records. The order of characters in the string does not matter. Defaults to "\r\n".

Specify the character(s) that will be used to separate records. The order of characters in the string does not matter. Defaults to "\r\n".

Specify the character(s) that will be used to separate records. The order of characters in the string does not matter. Defaults to "\r\n".

Specify the character(s) that will be used to separate records. The order of characters in the string does not matter. Defaults to "\r\n".

virtual void vtkDelimitedTextReader::SetFieldDelimiterCharacters ( const char *  ) [virtual]

Specify the character(s) that will be used to separate fields. For example, set this to "," for a comma-separated value file. Set it to ".:;" for a file where columns can be separated by a period, colon or semicolon. The order of the characters in the string does not matter. Defaults to a comma.

Specify the character(s) that will be used to separate fields. For example, set this to "," for a comma-separated value file. Set it to ".:;" for a file where columns can be separated by a period, colon or semicolon. The order of the characters in the string does not matter. Defaults to a comma.

void vtkDelimitedTextReader::SetUTF8FieldDelimiters ( const char *  delimiters)
virtual char vtkDelimitedTextReader::GetStringDelimiter ( ) [virtual]

Get/set the character that will begin and end strings. Microsoft Excel, for example, will export the following format: "First Field","Second Field","Field, With, Commas","Fourth Field" The third field has a comma in it. By using a string delimiter, this will be correctly read. The delimiter defaults to '"'.

virtual void vtkDelimitedTextReader::SetStringDelimiter ( char  ) [virtual]

Get/set the character that will begin and end strings. Microsoft Excel, for example, will export the following format: "First Field","Second Field","Field, With, Commas","Fourth Field" The third field has a comma in it. By using a string delimiter, this will be correctly read. The delimiter defaults to '"'.

void vtkDelimitedTextReader::SetUTF8StringDelimiters ( const char *  delimiters)
virtual void vtkDelimitedTextReader::SetUseStringDelimiter ( bool  ) [virtual]

Set/get whether to use the string delimiter. Defaults to on.

Set/get whether to use the string delimiter. Defaults to on.

Set/get whether to use the string delimiter. Defaults to on.

Set/get whether to use the string delimiter. Defaults to on.

virtual bool vtkDelimitedTextReader::GetHaveHeaders ( ) [virtual]

Set/get whether to treat the first line of the file as headers.

virtual void vtkDelimitedTextReader::SetHaveHeaders ( bool  ) [virtual]

Set/get whether to treat the first line of the file as headers.

virtual void vtkDelimitedTextReader::SetMergeConsecutiveDelimiters ( bool  ) [virtual]

Set/get whether to merge successive delimiters. Use this if (for example) your fields are separated by spaces but you don't know exactly how many.

Set/get whether to merge successive delimiters. Use this if (for example) your fields are separated by spaces but you don't know exactly how many.

Set/get whether to merge successive delimiters. Use this if (for example) your fields are separated by spaces but you don't know exactly how many.

Set/get whether to merge successive delimiters. Use this if (for example) your fields are separated by spaces but you don't know exactly how many.

Specifies the maximum number of records to read from the file. Limiting the number of records to read is useful for previewing the contents of a file.

virtual void vtkDelimitedTextReader::SetMaxRecords ( vtkIdType  ) [virtual]

Specifies the maximum number of records to read from the file. Limiting the number of records to read is useful for previewing the contents of a file.

virtual void vtkDelimitedTextReader::SetDetectNumericColumns ( bool  ) [virtual]

When set to true, the reader will detect numeric columns and create vtkDoubleArray or vtkIntArray for those instead of vtkStringArray. Default is off.

When set to true, the reader will detect numeric columns and create vtkDoubleArray or vtkIntArray for those instead of vtkStringArray. Default is off.

When set to true, the reader will detect numeric columns and create vtkDoubleArray or vtkIntArray for those instead of vtkStringArray. Default is off.

When set to true, the reader will detect numeric columns and create vtkDoubleArray or vtkIntArray for those instead of vtkStringArray. Default is off.

virtual void vtkDelimitedTextReader::SetForceDouble ( bool  ) [virtual]

When set to true and DetectNumericColumns is also true, forces all numeric columns to vtkDoubleArray even if they contain only integer values. Default is off.

virtual bool vtkDelimitedTextReader::GetForceDouble ( ) [virtual]

When set to true and DetectNumericColumns is also true, forces all numeric columns to vtkDoubleArray even if they contain only integer values. Default is off.

virtual void vtkDelimitedTextReader::ForceDoubleOn ( ) [virtual]

When set to true and DetectNumericColumns is also true, forces all numeric columns to vtkDoubleArray even if they contain only integer values. Default is off.

virtual void vtkDelimitedTextReader::ForceDoubleOff ( ) [virtual]

When set to true and DetectNumericColumns is also true, forces all numeric columns to vtkDoubleArray even if they contain only integer values. Default is off.

When DetectNumericColumns is set to true, whether to trim whitespace from strings prior to conversion to a numeric. Default is false to preserve backward compatibility. vtkVariant handles whitespace inconsistently, so trim it before we try to convert it. For example: vtkVariant(" 2.0").ToDouble() == 2.0 <-- leading whitespace is not a problem vtkVariant(" 2.0 ").ToDouble() == NaN <-- trailing whitespace is a problem vtkVariant(" infinity ").ToDouble() == NaN <-- any whitespace is a problem In these cases, trimming the whitespace gives us the result we expect: 2.0 and INF respectively.

When DetectNumericColumns is set to true, whether to trim whitespace from strings prior to conversion to a numeric. Default is false to preserve backward compatibility. vtkVariant handles whitespace inconsistently, so trim it before we try to convert it. For example: vtkVariant(" 2.0").ToDouble() == 2.0 <-- leading whitespace is not a problem vtkVariant(" 2.0 ").ToDouble() == NaN <-- trailing whitespace is a problem vtkVariant(" infinity ").ToDouble() == NaN <-- any whitespace is a problem In these cases, trimming the whitespace gives us the result we expect: 2.0 and INF respectively.

When DetectNumericColumns is set to true, whether to trim whitespace from strings prior to conversion to a numeric. Default is false to preserve backward compatibility. vtkVariant handles whitespace inconsistently, so trim it before we try to convert it. For example: vtkVariant(" 2.0").ToDouble() == 2.0 <-- leading whitespace is not a problem vtkVariant(" 2.0 ").ToDouble() == NaN <-- trailing whitespace is a problem vtkVariant(" infinity ").ToDouble() == NaN <-- any whitespace is a problem In these cases, trimming the whitespace gives us the result we expect: 2.0 and INF respectively.

When DetectNumericColumns is set to true, whether to trim whitespace from strings prior to conversion to a numeric. Default is false to preserve backward compatibility. vtkVariant handles whitespace inconsistently, so trim it before we try to convert it. For example: vtkVariant(" 2.0").ToDouble() == 2.0 <-- leading whitespace is not a problem vtkVariant(" 2.0 ").ToDouble() == NaN <-- trailing whitespace is a problem vtkVariant(" infinity ").ToDouble() == NaN <-- any whitespace is a problem In these cases, trimming the whitespace gives us the result we expect: 2.0 and INF respectively.

When DetectNumericColumns is set to true, the reader use this value to populate the vtkIntArray where empty strings are found. Default is 0.

When DetectNumericColumns is set to true, the reader use this value to populate the vtkIntArray where empty strings are found. Default is 0.

When DetectNumericColumns is set to true, the reader use this value to populate the vtkDoubleArray where empty strings are found. Default is 0.0

When DetectNumericColumns is set to true, the reader use this value to populate the vtkDoubleArray where empty strings are found. Default is 0.0

virtual void vtkDelimitedTextReader::SetPedigreeIdArrayName ( const char *  ) [virtual]

The name of the array for generating or assigning pedigree ids (default "id").

The name of the array for generating or assigning pedigree ids (default "id").

virtual void vtkDelimitedTextReader::SetGeneratePedigreeIds ( bool  ) [virtual]

If on (default), generates pedigree ids automatically. If off, assign one of the arrays to be the pedigree id.

If on (default), generates pedigree ids automatically. If off, assign one of the arrays to be the pedigree id.

If on (default), generates pedigree ids automatically. If off, assign one of the arrays to be the pedigree id.

If on (default), generates pedigree ids automatically. If off, assign one of the arrays to be the pedigree id.

virtual void vtkDelimitedTextReader::SetOutputPedigreeIds ( bool  ) [virtual]

If on, assigns pedigree ids to output. Defaults to off.

If on, assigns pedigree ids to output. Defaults to off.

virtual void vtkDelimitedTextReader::OutputPedigreeIdsOn ( ) [virtual]

If on, assigns pedigree ids to output. Defaults to off.

If on, assigns pedigree ids to output. Defaults to off.

Returns a human-readable description of the most recent error, if any. Otherwise, returns an empty string. Note that the result is only valid after calling Update().

virtual void vtkDelimitedTextReader::SetReplacementCharacter ( vtkTypeUInt32  ) [virtual]

Fallback character for use in the US-ASCII-WITH-FALLBACK character set. Any characters that have their 8th bit set will be replaced with this code point. Defaults to 'x'.

virtual vtkTypeUInt32 vtkDelimitedTextReader::GetReplacementCharacter ( ) [virtual]

Fallback character for use in the US-ASCII-WITH-FALLBACK character set. Any characters that have their 8th bit set will be replaced with this code point. Defaults to 'x'.

int vtkDelimitedTextReader::RequestData ( vtkInformation request,
vtkInformationVector **  inputVector,
vtkInformationVector outputVector 
) [protected, virtual]

This is called by the superclass. This is the method you should override.

Reimplemented from vtkTableAlgorithm.


Member Data Documentation

Definition at line 267 of file vtkDelimitedTextReader.h.

Definition at line 268 of file vtkDelimitedTextReader.h.

Definition at line 269 of file vtkDelimitedTextReader.h.

Definition at line 270 of file vtkDelimitedTextReader.h.

Definition at line 271 of file vtkDelimitedTextReader.h.

Definition at line 272 of file vtkDelimitedTextReader.h.

Definition at line 273 of file vtkDelimitedTextReader.h.

Definition at line 274 of file vtkDelimitedTextReader.h.

Definition at line 275 of file vtkDelimitedTextReader.h.

Definition at line 276 of file vtkDelimitedTextReader.h.

Definition at line 277 of file vtkDelimitedTextReader.h.

Definition at line 278 of file vtkDelimitedTextReader.h.

Definition at line 279 of file vtkDelimitedTextReader.h.

Definition at line 280 of file vtkDelimitedTextReader.h.

Definition at line 281 of file vtkDelimitedTextReader.h.

Definition at line 282 of file vtkDelimitedTextReader.h.

Definition at line 283 of file vtkDelimitedTextReader.h.

Definition at line 284 of file vtkDelimitedTextReader.h.

Definition at line 285 of file vtkDelimitedTextReader.h.

Definition at line 286 of file vtkDelimitedTextReader.h.

Definition at line 287 of file vtkDelimitedTextReader.h.

Definition at line 288 of file vtkDelimitedTextReader.h.

Definition at line 289 of file vtkDelimitedTextReader.h.

Definition at line 290 of file vtkDelimitedTextReader.h.


The documentation for this class was generated from the following file: