VTK
dox/IO/Infovis/vtkDelimitedTextReader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDelimitedTextReader.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00020 
00021 
00069 #ifndef __vtkDelimitedTextReader_h
00070 #define __vtkDelimitedTextReader_h
00071 
00072 #include "vtkIOInfovisModule.h" // For export macro
00073 #include "vtkTableAlgorithm.h"
00074 #include "vtkUnicodeString.h" // Needed for vtkUnicodeString
00075 #include "vtkStdString.h" // Needed for vtkStdString
00076 
00077 class VTKIOINFOVIS_EXPORT vtkDelimitedTextReader : public vtkTableAlgorithm
00078 {
00079 public:
00080   static vtkDelimitedTextReader* New();
00081   vtkTypeMacro(vtkDelimitedTextReader, vtkTableAlgorithm);
00082   void PrintSelf(ostream& os, vtkIndent indent);
00083 
00085 
00086   vtkGetStringMacro(FileName);
00087   vtkSetStringMacro(FileName);
00089 
00091 
00099   vtkGetStringMacro(UnicodeCharacterSet);
00100   vtkSetStringMacro(UnicodeCharacterSet);
00102 
00104 
00107   void SetUTF8RecordDelimiters(const char* delimiters);
00108   const char* GetUTF8RecordDelimiters();
00109   void SetUnicodeRecordDelimiters(const vtkUnicodeString& delimiters);
00110   vtkUnicodeString GetUnicodeRecordDelimiters();
00112 
00114 
00119   vtkSetStringMacro(FieldDelimiterCharacters);
00120   vtkGetStringMacro(FieldDelimiterCharacters);
00122 
00123   void SetUTF8FieldDelimiters(const char* delimiters);
00124   const char* GetUTF8FieldDelimiters();
00125   void SetUnicodeFieldDelimiters(const vtkUnicodeString& delimiters);
00126   vtkUnicodeString GetUnicodeFieldDelimiters();
00127 
00129 
00134   vtkGetMacro(StringDelimiter, char);
00135   vtkSetMacro(StringDelimiter, char);
00137 
00138   void SetUTF8StringDelimiters(const char* delimiters);
00139   const char* GetUTF8StringDelimiters();
00140   void SetUnicodeStringDelimiters(const vtkUnicodeString& delimiters);
00141   vtkUnicodeString GetUnicodeStringDelimiters();
00142 
00144 
00145   vtkSetMacro(UseStringDelimiter, bool);
00146   vtkGetMacro(UseStringDelimiter, bool);
00147   vtkBooleanMacro(UseStringDelimiter, bool);
00149 
00151 
00152   vtkGetMacro(HaveHeaders, bool);
00153   vtkSetMacro(HaveHeaders, bool);
00155 
00157 
00160   vtkSetMacro(MergeConsecutiveDelimiters, bool);
00161   vtkGetMacro(MergeConsecutiveDelimiters, bool);
00162   vtkBooleanMacro(MergeConsecutiveDelimiters, bool);
00164 
00166 
00169   vtkGetMacro(MaxRecords, vtkIdType);
00170   vtkSetMacro(MaxRecords, vtkIdType);
00172 
00174 
00177   vtkSetMacro(DetectNumericColumns, bool);
00178   vtkGetMacro(DetectNumericColumns, bool);
00179   vtkBooleanMacro(DetectNumericColumns, bool);
00181 
00183 
00186   vtkSetMacro(ForceDouble, bool);
00187   vtkGetMacro(ForceDouble, bool);
00188   vtkBooleanMacro(ForceDouble, bool);
00190 
00192 
00201   vtkSetMacro(TrimWhitespacePriorToNumericConversion, bool);
00202   vtkGetMacro(TrimWhitespacePriorToNumericConversion, bool);
00203   vtkBooleanMacro(TrimWhitespacePriorToNumericConversion, bool);
00205 
00207 
00210   vtkSetMacro(DefaultIntegerValue, int);
00211   vtkGetMacro(DefaultIntegerValue, int);
00213 
00215 
00218   vtkSetMacro(DefaultDoubleValue, double);
00219   vtkGetMacro(DefaultDoubleValue, double);
00221 
00223 
00225   vtkSetStringMacro(PedigreeIdArrayName);
00226   vtkGetStringMacro(PedigreeIdArrayName);
00228 
00230 
00232   vtkSetMacro(GeneratePedigreeIds, bool);
00233   vtkGetMacro(GeneratePedigreeIds, bool);
00234   vtkBooleanMacro(GeneratePedigreeIds, bool);
00236 
00238 
00239   vtkSetMacro(OutputPedigreeIds, bool);
00240   vtkGetMacro(OutputPedigreeIds, bool);
00241   vtkBooleanMacro(OutputPedigreeIds, bool);
00243 
00247   vtkStdString GetLastError();
00248 
00250 
00253   vtkSetMacro(ReplacementCharacter, vtkTypeUInt32);
00254   vtkGetMacro(ReplacementCharacter, vtkTypeUInt32);
00256 
00257 //BTX
00258 protected:
00259   vtkDelimitedTextReader();
00260   ~vtkDelimitedTextReader();
00261 
00262   int RequestData(
00263     vtkInformation*,
00264     vtkInformationVector**,
00265     vtkInformationVector*);
00266 
00267   char* FileName;
00268   char* UnicodeCharacterSet;
00269   vtkIdType MaxRecords;
00270   vtkUnicodeString UnicodeRecordDelimiters;
00271   vtkUnicodeString UnicodeFieldDelimiters;
00272   vtkUnicodeString UnicodeStringDelimiters;
00273   vtkUnicodeString UnicodeWhitespace;
00274   vtkUnicodeString UnicodeEscapeCharacter;
00275   bool DetectNumericColumns;
00276   bool ForceDouble;
00277   bool TrimWhitespacePriorToNumericConversion;
00278   int DefaultIntegerValue;
00279   double DefaultDoubleValue;
00280   char* FieldDelimiterCharacters;
00281   char StringDelimiter;
00282   bool UseStringDelimiter;
00283   bool HaveHeaders;
00284   bool UnicodeOutputArrays;
00285   bool MergeConsecutiveDelimiters;
00286   char* PedigreeIdArrayName;
00287   bool GeneratePedigreeIds;
00288   bool OutputPedigreeIds;
00289   vtkStdString LastError;
00290   vtkTypeUInt32 ReplacementCharacter;
00291 
00292 private:
00293   vtkDelimitedTextReader(const vtkDelimitedTextReader&); // Not implemented
00294   void operator=(const vtkDelimitedTextReader&);   // Not implemented
00295 //ETX
00296 };
00297 
00298 #endif
00299