00001 /*========================================================================= 00002 00003 Program: ParaView 00004 Module: vtkJavaScriptDataWriter.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 00026 #ifndef __vtkJavaScriptDataWriter_h 00027 #define __vtkJavaScriptDataWriter_h 00028 00029 #include "vtkWriter.h" 00030 00031 class vtkStdString; 00032 class vtkTable; 00033 00034 class VTK_IO_EXPORT vtkJavaScriptDataWriter : public vtkWriter 00035 { 00036 public: 00037 static vtkJavaScriptDataWriter* New(); 00038 vtkTypeMacro(vtkJavaScriptDataWriter, vtkWriter); 00039 void PrintSelf(ostream& os, vtkIndent indent); 00040 00042 00047 vtkSetStringMacro(VariableName); 00048 vtkGetStringMacro(VariableName); 00050 00052 00053 vtkSetStringMacro(FileName); 00054 vtkGetStringMacro(FileName); 00056 00058 00064 vtkSetMacro(IncludeFieldNames, bool); 00065 vtkGetMacro(IncludeFieldNames, bool); 00067 00068 // Get/Set the OutputStream for writing output. 00069 void SetOutputStream(ostream *my_stream); 00070 ostream* GetOutputStream(); 00071 00072 protected: 00073 vtkJavaScriptDataWriter(); 00074 ~vtkJavaScriptDataWriter(); 00075 00076 ofstream* OpenFile(); 00077 00078 virtual void WriteData(); 00079 virtual void WriteTable(vtkTable* table, ostream *stream_ptr); 00080 00081 // see algorithm for more info. 00082 // This writer takes in vtkTable. 00083 virtual int FillInputPortInformation(int port, vtkInformation* info); 00084 00085 char* VariableName; 00086 char* FileName; 00087 bool IncludeFieldNames; 00088 ostream* OutputStream; 00089 private: 00090 vtkJavaScriptDataWriter(const vtkJavaScriptDataWriter&); // Not implemented. 00091 void operator=(const vtkJavaScriptDataWriter&); // Not implemented. 00092 //ETX 00093 }; 00094 00095 00096 00097 #endif 00098