VTK
vtkXMLCompositeDataReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkXMLCompositeDataReader.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
28 #ifndef __vtkXMLCompositeDataReader_h
29 #define __vtkXMLCompositeDataReader_h
30 
31 #include "vtkXMLReader.h"
32 
36 //BTX
37 struct vtkXMLCompositeDataReaderInternals;
38 //ETX
39 
41 {
42 public:
44  void PrintSelf(ostream& os, vtkIndent indent);
45 
47 
48  vtkCompositeDataSet* GetOutput();
49  vtkCompositeDataSet* GetOutput(int);
51 
52 protected:
55 
56  // Get the name of the data set being read.
57  virtual const char* GetDataSetName();
58 
59  // Returns the primary element pass to ReadPrimaryElement().
60  vtkXMLDataElement* GetPrimaryElement();
61 
62  virtual void ReadXMLData();
63  virtual int ReadPrimaryElement(vtkXMLDataElement* ePrimary);
64 
65  // Setup the output with no data available. Used in error cases.
66  virtual void SetupEmptyOutput();
67 
69 
70  // Create a default executive.
72 
73  vtkXMLReader* GetReaderOfType(const char* type);
74 
75  virtual int RequestInformation(vtkInformation*,
78 
79 
80 
81  // Adds a child data object to the composite parent. childXML is the XML for
82  // the child data object need to obtain certain meta-data about the child.
83  void AddChild(vtkCompositeDataSet* parent,
84  vtkDataObject* child, vtkXMLDataElement* childXML);
85 
86  // Read the XML element for the subtree of a the composite dataset.
87  // dataSetIndex is used to rank the leaf nodes in an inorder traversal.
88  virtual void ReadComposite(vtkXMLDataElement* element,
89  vtkCompositeDataSet* composite, const char* filePath,
90  unsigned int &dataSetIndex)=0;
91 
92  // Read the vtkDataSet (a leaf) in the composite dataset.
93  virtual vtkDataSet* ReadDataset(vtkXMLDataElement* xmlElem, const char* filePath);
94 
95  // Counts "DataSet" elements in the subtree.
96  unsigned int CountLeaves(vtkXMLDataElement* elem);
97 
100  int ShouldReadDataSet(unsigned int datasetIndex);
101 
103 
104  virtual int CanReadFileVersion(int major, int vtkNotUsed(minor))
105  {
106  if (major > 1)
107  {
108  return 0;
109  }
110  return 1;
111  }
113 
114 private:
115  vtkXMLCompositeDataReader(const vtkXMLCompositeDataReader&); // Not implemented.
116  void operator=(const vtkXMLCompositeDataReader&); // Not implemented.
117 
118  vtkXMLCompositeDataReaderInternals* Internal;
119 };
120 
121 #endif