VTK
dox/IO/vtkXMLCompositeDataReader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   ParaView
00004   Module:    vtkXMLCompositeDataReader.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 =========================================================================*/
00028 #ifndef __vtkXMLCompositeDataReader_h
00029 #define __vtkXMLCompositeDataReader_h
00030 
00031 #include "vtkXMLReader.h"
00032 
00033 class vtkCompositeDataSet;
00034 class vtkInformationIntegerKey;
00035 class vtkInformationIntegerVectorKey;
00036 //BTX
00037 struct vtkXMLCompositeDataReaderInternals;
00038 //ETX
00039 
00040 class VTK_IO_EXPORT vtkXMLCompositeDataReader : public vtkXMLReader
00041 {
00042 public:
00043   vtkTypeMacro(vtkXMLCompositeDataReader,vtkXMLReader);
00044   void PrintSelf(ostream& os, vtkIndent indent);
00045 
00047 
00048   vtkCompositeDataSet* GetOutput();
00049   vtkCompositeDataSet* GetOutput(int);
00051 
00052 protected:
00053   vtkXMLCompositeDataReader();
00054   ~vtkXMLCompositeDataReader();  
00055 
00056   // Get the name of the data set being read.
00057   virtual const char* GetDataSetName();
00058 
00059   // Returns the primary element pass to ReadPrimaryElement().
00060   vtkXMLDataElement* GetPrimaryElement();
00061 
00062   virtual void ReadXMLData();
00063   virtual int ReadPrimaryElement(vtkXMLDataElement* ePrimary);
00064 
00065   // Setup the output with no data available.  Used in error cases.
00066   virtual void SetupEmptyOutput();
00067 
00068   virtual int FillOutputPortInformation(int, vtkInformation* info);
00069 
00070   // Create a default executive.
00071   virtual vtkExecutive* CreateDefaultExecutive();
00072 
00073   vtkXMLReader* GetReaderOfType(const char* type);
00074 
00075   virtual int RequestInformation(vtkInformation*, 
00076                                  vtkInformationVector**, 
00077                                  vtkInformationVector*);
00078 
00079 
00080 
00081   // Adds a child data object to the composite parent. childXML is the XML for
00082   // the child data object need to obtain certain meta-data about the child.
00083   void AddChild(vtkCompositeDataSet* parent, 
00084     vtkDataObject* child, vtkXMLDataElement* childXML);
00085 
00086   // Read the XML element for the subtree of a the composite dataset.
00087   // dataSetIndex is used to rank the leaf nodes in an inorder traversal.
00088   virtual void ReadComposite(vtkXMLDataElement* element, 
00089     vtkCompositeDataSet* composite, const char* filePath, 
00090     unsigned int &dataSetIndex)=0;
00091 
00092   // Read the vtkDataSet (a leaf) in the composite dataset.
00093   virtual vtkDataSet* ReadDataset(vtkXMLDataElement* xmlElem, const char* filePath);
00094 
00095   // Counts "DataSet" elements in the subtree.
00096   unsigned int CountLeaves(vtkXMLDataElement* elem);
00097 
00100   int ShouldReadDataSet(unsigned int datasetIndex);
00101 
00103 
00104   virtual int CanReadFileVersion(int major, int vtkNotUsed(minor))
00105     {
00106     if (major > 1)
00107       {
00108       return 0;
00109       }
00110     return 1;
00111     }
00113 
00114 private:
00115   vtkXMLCompositeDataReader(const vtkXMLCompositeDataReader&);  // Not implemented.
00116   void operator=(const vtkXMLCompositeDataReader&);  // Not implemented.
00117 
00118   vtkXMLCompositeDataReaderInternals* Internal;
00119 };
00120 
00121 #endif