VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/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 
00095   void SetInputString(const char *in);
00096   vtkGetStringMacro(InputString);
00097   void SetInputString(const char *in, int len);
00098   vtkGetMacro(InputStringLength, int);
00099   void SetInputString(const vtkStdString& input)
00100     { this->SetInputString(input.c_str(), static_cast<int>(input.length())); }
00102 
00104 
00106   vtkSetMacro(ReadFromInputString,int);
00107   vtkGetMacro(ReadFromInputString,int);
00108   vtkBooleanMacro(ReadFromInputString,int);
00110 
00112 
00120   vtkGetStringMacro(UnicodeCharacterSet);
00121   vtkSetStringMacro(UnicodeCharacterSet);
00123 
00125 
00128   void SetUTF8RecordDelimiters(const char* delimiters);
00129   const char* GetUTF8RecordDelimiters();
00130   void SetUnicodeRecordDelimiters(const vtkUnicodeString& delimiters);
00131   vtkUnicodeString GetUnicodeRecordDelimiters();
00133 
00135 
00140   vtkSetStringMacro(FieldDelimiterCharacters);
00141   vtkGetStringMacro(FieldDelimiterCharacters);
00143 
00144   void SetUTF8FieldDelimiters(const char* delimiters);
00145   const char* GetUTF8FieldDelimiters();
00146   void SetUnicodeFieldDelimiters(const vtkUnicodeString& delimiters);
00147   vtkUnicodeString GetUnicodeFieldDelimiters();
00148 
00150 
00155   vtkGetMacro(StringDelimiter, char);
00156   vtkSetMacro(StringDelimiter, char);
00158 
00159   void SetUTF8StringDelimiters(const char* delimiters);
00160   const char* GetUTF8StringDelimiters();
00161   void SetUnicodeStringDelimiters(const vtkUnicodeString& delimiters);
00162   vtkUnicodeString GetUnicodeStringDelimiters();
00163 
00165 
00166   vtkSetMacro(UseStringDelimiter, bool);
00167   vtkGetMacro(UseStringDelimiter, bool);
00168   vtkBooleanMacro(UseStringDelimiter, bool);
00170 
00172 
00174   vtkGetMacro(HaveHeaders, bool);
00175   vtkSetMacro(HaveHeaders, bool);
00177 
00179 
00182   vtkSetMacro(MergeConsecutiveDelimiters, bool);
00183   vtkGetMacro(MergeConsecutiveDelimiters, bool);
00184   vtkBooleanMacro(MergeConsecutiveDelimiters, bool);
00186 
00188 
00191   vtkGetMacro(MaxRecords, vtkIdType);
00192   vtkSetMacro(MaxRecords, vtkIdType);
00194 
00196 
00199   vtkSetMacro(DetectNumericColumns, bool);
00200   vtkGetMacro(DetectNumericColumns, bool);
00201   vtkBooleanMacro(DetectNumericColumns, bool);
00203 
00205 
00208   vtkSetMacro(ForceDouble, bool);
00209   vtkGetMacro(ForceDouble, bool);
00210   vtkBooleanMacro(ForceDouble, bool);
00212 
00214 
00223   vtkSetMacro(TrimWhitespacePriorToNumericConversion, bool);
00224   vtkGetMacro(TrimWhitespacePriorToNumericConversion, bool);
00225   vtkBooleanMacro(TrimWhitespacePriorToNumericConversion, bool);
00227 
00229 
00232   vtkSetMacro(DefaultIntegerValue, int);
00233   vtkGetMacro(DefaultIntegerValue, int);
00235 
00237 
00240   vtkSetMacro(DefaultDoubleValue, double);
00241   vtkGetMacro(DefaultDoubleValue, double);
00243 
00245 
00247   vtkSetStringMacro(PedigreeIdArrayName);
00248   vtkGetStringMacro(PedigreeIdArrayName);
00250 
00252 
00254   vtkSetMacro(GeneratePedigreeIds, bool);
00255   vtkGetMacro(GeneratePedigreeIds, bool);
00256   vtkBooleanMacro(GeneratePedigreeIds, bool);
00258 
00260 
00261   vtkSetMacro(OutputPedigreeIds, bool);
00262   vtkGetMacro(OutputPedigreeIds, bool);
00263   vtkBooleanMacro(OutputPedigreeIds, bool);
00265 
00269   vtkStdString GetLastError();
00270 
00272 
00275   vtkSetMacro(ReplacementCharacter, vtkTypeUInt32);
00276   vtkGetMacro(ReplacementCharacter, vtkTypeUInt32);
00278 
00279 //BTX
00280 protected:
00281   vtkDelimitedTextReader();
00282   ~vtkDelimitedTextReader();
00283 
00284   int RequestData(
00285     vtkInformation*,
00286     vtkInformationVector**,
00287     vtkInformationVector*);
00288 
00289   char* FileName;
00290   int ReadFromInputString;
00291   char *InputString;
00292   int InputStringLength;
00293   char* UnicodeCharacterSet;
00294   vtkIdType MaxRecords;
00295   vtkUnicodeString UnicodeRecordDelimiters;
00296   vtkUnicodeString UnicodeFieldDelimiters;
00297   vtkUnicodeString UnicodeStringDelimiters;
00298   vtkUnicodeString UnicodeWhitespace;
00299   vtkUnicodeString UnicodeEscapeCharacter;
00300   bool DetectNumericColumns;
00301   bool ForceDouble;
00302   bool TrimWhitespacePriorToNumericConversion;
00303   int DefaultIntegerValue;
00304   double DefaultDoubleValue;
00305   char* FieldDelimiterCharacters;
00306   char StringDelimiter;
00307   bool UseStringDelimiter;
00308   bool HaveHeaders;
00309   bool UnicodeOutputArrays;
00310   bool MergeConsecutiveDelimiters;
00311   char* PedigreeIdArrayName;
00312   bool GeneratePedigreeIds;
00313   bool OutputPedigreeIds;
00314   vtkStdString LastError;
00315   vtkTypeUInt32 ReplacementCharacter;
00316 
00317 private:
00318   vtkDelimitedTextReader(const vtkDelimitedTextReader&); // Not implemented
00319   void operator=(const vtkDelimitedTextReader&);   // Not implemented
00320 //ETX
00321 };
00322 
00323 #endif
00324