00001 /*========================================================================= 00002 00003 Program: ParaView 00004 Module: vtkDelimitedTextWriter.h 00005 00006 Copyright (c) Kitware, Inc. 00007 All rights reserved. 00008 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 2009 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 00032 #ifndef __vtkDelimitedTextWriter_h 00033 #define __vtkDelimitedTextWriter_h 00034 00035 #include "vtkWriter.h" 00036 00037 class vtkStdString; 00038 class vtkTable; 00039 00040 class VTK_IO_EXPORT vtkDelimitedTextWriter : public vtkWriter 00041 { 00042 public: 00043 static vtkDelimitedTextWriter* New(); 00044 vtkTypeMacro(vtkDelimitedTextWriter, vtkWriter); 00045 void PrintSelf(ostream& os, vtkIndent indent); 00046 00048 00049 vtkSetStringMacro(FieldDelimiter); 00050 vtkGetStringMacro(FieldDelimiter); 00052 00054 00056 vtkSetStringMacro(StringDelimiter); 00057 vtkGetStringMacro(StringDelimiter); 00059 00061 00062 vtkSetStringMacro(FileName); 00063 vtkGetStringMacro(FileName); 00065 00067 00069 vtkSetMacro(UseStringDelimiter, bool); 00070 vtkGetMacro(UseStringDelimiter, bool); 00072 00074 00075 vtkSetMacro(WriteToOutputString,bool); 00076 vtkGetMacro(WriteToOutputString,bool); 00077 vtkBooleanMacro(WriteToOutputString,bool); 00079 00082 char *RegisterAndGetOutputString(); 00083 00085 00087 vtkStdString GetString(vtkStdString string); 00088 protected: 00089 vtkDelimitedTextWriter(); 00090 ~vtkDelimitedTextWriter(); 00092 00093 bool WriteToOutputString; 00094 char* OutputString; 00095 00096 bool OpenStream(); 00097 00098 virtual void WriteData(); 00099 virtual void WriteTable(vtkTable* rectilinearGrid); 00100 00101 // see algorithm for more info. 00102 // This writer takes in vtkTable. 00103 virtual int FillInputPortInformation(int port, vtkInformation* info); 00104 00105 char* FileName; 00106 char* FieldDelimiter; 00107 char* StringDelimiter; 00108 bool UseStringDelimiter; 00109 //BTX 00110 ostream* Stream; 00111 //ETX 00112 private: 00113 vtkDelimitedTextWriter(const vtkDelimitedTextWriter&); // Not implemented. 00114 void operator=(const vtkDelimitedTextWriter&); // Not implemented. 00115 }; 00116 00117 00118 00119 #endif 00120