vtkXMLCollectionReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
17 #ifndef vtkXMLCollectionReader_h
18 #define vtkXMLCollectionReader_h
19 
20 #include "vtkPVVTKExtensionsIOCoreModule.h" //needed for exports
21 #include "vtkXMLReader.h"
22 
23 class vtkXMLCollectionReaderInternals;
24 
26 {
27 public:
28  static vtkXMLCollectionReader* New();
30  void PrintSelf(ostream& os, vtkIndent indent) override;
31 
33 
39  virtual void SetRestriction(const char* name, const char* value);
40  virtual const char* GetRestriction(const char* name);
42 
44 
51  virtual void SetRestrictionAsIndex(const char* name, int index);
52  virtual int GetRestrictionAsIndex(const char* name);
54 
59  int GetNumberOfAttributes();
60 
66  const char* GetAttributeName(int attribute);
67 
72  int GetAttributeIndex(const char* name);
73 
77  int GetNumberOfAttributeValues(int attribute);
78 
80 
86  const char* GetAttributeValue(int attribute, int index);
87  const char* GetAttributeValue(const char* name, int index);
89 
91 
95  int GetAttributeValueIndex(int attribute, const char* value);
96  int GetAttributeValueIndex(const char* name, const char* value);
98 
105  vtkXMLDataElement* GetOutputXMLDataElement(int index);
106 
108 
112  vtkSetMacro(ForceOutputTypeToMultiBlock, int);
113  vtkGetMacro(ForceOutputTypeToMultiBlock, int);
114  vtkBooleanMacro(ForceOutputTypeToMultiBlock, int);
116 
117 protected:
119  ~vtkXMLCollectionReader() override;
120 
121  void BuildRestrictedDataSets();
122 
125 
126  // Get the name of the data set being read.
127  const char* GetDataSetName() override;
128 
129  int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
130  int FillOutputPortInformation(int, vtkInformation* info) override;
131 
132  vtkDataObject* SetupOutput(const std::string& filePath, int index);
133 
137  vtkXMLReader* SetupReader(const std::string& filePath, int index);
138 
139  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
140  vtkInformationVector* outputVector) override;
141 
142  // Overload of vtkXMLReader function, so we can handle updating the
143  // information on multiple outputs
144  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
145  vtkInformationVector* outputVector) override;
146 
147  // Setup the output with no data available. Used in error cases.
148  void SetupEmptyOutput() override;
149 
150  void ReadXMLData() override;
151  void ReadXMLDataImpl();
152 
153  // Progress callback from XMLParser.
154  virtual void InternalProgressCallback();
155 
156  // Internal implementation details.
157  vtkXMLCollectionReaderInternals* Internal;
158 
159  void AddAttributeNameValue(const char* name, const char* value);
160 
161  virtual void SetRestrictionImpl(const char* name, const char* value, bool doModify);
162 
163  void ReadAFile(int index, int updatePiece, int updateNumPieces, int updateGhostLevels,
164  vtkDataObject* actualOutput);
165 
171  void FillArraySelectionUsingReaders(const std::string& filePath);
172 
173 private:
175  void operator=(const vtkXMLCollectionReader&) = delete;
176 
177  int CurrentOutput;
178 };
179 
180 #endif
virtual const char * GetDataSetName()=0
virtual void SetupEmptyOutput()=0
void PrintSelf(ostream &os, vtkIndent indent)
#define VTKPVVTKEXTENSIONSIOCORE_EXPORT
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
virtual void ReadXMLData()
Read a file wrapping many other XML files.
virtual int FillOutputPortInformation(int port, vtkInformation *info)
vtkXMLCollectionReaderInternals * Internal
virtual int ReadPrimaryElement(vtkXMLDataElement *ePrimary)
virtual int RequestDataObject(vtkInformation *vtkNotUsed(request), vtkInformationVector **vtkNotUsed(inputVector), vtkInformationVector *vtkNotUsed(outputVector))
static vtkAlgorithm * New()
void operator=(const vtkObjectBase &)