VTK
|
00001 /*========================================================================= 00002 00003 Program: ParaView 00004 Module: vtkXMLCompositeDataWriter.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 =========================================================================*/ 00025 #ifndef __vtkXMLCompositeDataWriter_h 00026 #define __vtkXMLCompositeDataWriter_h 00027 00028 #include "vtkXMLWriter.h" 00029 #include "vtkStdString.h" // needed for vtkStdString. 00030 00031 class vtkCallbackCommand; 00032 class vtkCompositeDataSet; 00033 class vtkXMLDataElement; 00034 class vtkXMLCompositeDataWriterInternals; 00035 00036 class VTK_IO_EXPORT vtkXMLCompositeDataWriter : public vtkXMLWriter 00037 { 00038 public: 00039 vtkTypeMacro(vtkXMLCompositeDataWriter,vtkXMLWriter); 00040 void PrintSelf(ostream& os, vtkIndent indent); 00041 00043 virtual const char* GetDefaultFileExtension(); 00044 00049 vtkGetMacro(GhostLevel, int); 00050 vtkSetMacro(GhostLevel, int); 00052 00054 00055 vtkGetMacro(WriteMetaFile, int); 00056 virtual void SetWriteMetaFile(int flag); 00058 00060 00061 int ProcessRequest(vtkInformation*, 00062 vtkInformationVector**, 00063 vtkInformationVector*); 00065 00066 protected: 00067 vtkXMLCompositeDataWriter(); 00068 ~vtkXMLCompositeDataWriter(); 00069 00071 00074 virtual int GetDataSetMajorVersion() { return 1; } 00075 virtual int GetDataSetMinorVersion() { return 0; } 00077 00079 vtkStdString CreatePieceFileName(int Piece); 00080 00081 // see algorithm for more info 00082 virtual int FillInputPortInformation(int port, vtkInformation* info); 00083 00084 int RequestData( 00085 vtkInformation* , vtkInformationVector** , vtkInformationVector*); 00086 int RequestUpdateExtent( 00087 vtkInformation* , vtkInformationVector** , vtkInformationVector*); 00088 00089 virtual int WriteData(); 00090 virtual const char* GetDataSetName(); 00091 00092 // Create a default executive. 00093 virtual vtkExecutive* CreateDefaultExecutive(); 00094 00095 vtkInformation* InputInformation; 00096 00098 virtual void FillDataTypes(vtkCompositeDataSet*); 00099 00101 unsigned int GetNumberOfDataTypes(); 00102 00104 int* GetDataTypesPointer(); 00105 00106 // Methods to create the set of writers matching the set of inputs. 00107 void CreateWriters(vtkCompositeDataSet*); 00108 vtkXMLWriter* GetWriter(int index); 00109 00110 // Methods to help construct internal file names. 00111 void SplitFileName(); 00112 const char* GetFilePrefix(); 00113 const char* GetFilePath(); 00114 00118 int WriteMetaFileIfRequested(); 00119 00120 // Make a directory. 00121 void MakeDirectory(const char* name); 00122 00123 // Remove a directory. 00124 void RemoveADirectory(const char* name); 00125 00126 // Internal implementation details. 00127 vtkXMLCompositeDataWriterInternals* Internal; 00128 00129 // The number of ghost levels to write for unstructured data. 00130 int GhostLevel; 00131 00135 int WriteMetaFile; 00136 00137 // Callback registered with the ProgressObserver. 00138 static void ProgressCallbackFunction(vtkObject*, unsigned long, void*, 00139 void*); 00140 // Progress callback from internal writer. 00141 virtual void ProgressCallback(vtkAlgorithm* w); 00142 00143 // The observer to report progress from the internal writer. 00144 vtkCallbackCommand* ProgressObserver; 00145 00146 // Garbage collection support. 00147 virtual void ReportReferences(vtkGarbageCollector*); 00148 00150 00156 virtual int WriteComposite(vtkCompositeDataSet* compositeData, 00157 vtkXMLDataElement* element, int &writerIdx)=0; 00159 00161 00168 virtual int WriteNonCompositeData( 00169 vtkDataObject* dObj, vtkXMLDataElement* element, 00170 int& writerIdx, const char* FileName); 00172 00175 virtual void RemoveWrittenFiles(const char* SubDirectory); 00176 00177 private: 00178 vtkXMLCompositeDataWriter(const vtkXMLCompositeDataWriter&); // Not implemented. 00179 void operator=(const vtkXMLCompositeDataWriter&); // Not implemented. 00180 }; 00181 00182 #endif