Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

IO/vtkXMLDataReader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkXMLDataReader.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm 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 =========================================================================*/
00026 #ifndef __vtkXMLDataReader_h
00027 #define __vtkXMLDataReader_h
00028 
00029 #include "vtkXMLReader.h"
00030 
00031 class VTK_IO_EXPORT vtkXMLDataReader : public vtkXMLReader
00032 {
00033 public:
00034   vtkTypeRevisionMacro(vtkXMLDataReader,vtkXMLReader);
00035   void PrintSelf(ostream& os, vtkIndent indent);
00036   
00038   virtual vtkIdType GetNumberOfPoints()=0;
00039   
00041   virtual vtkIdType GetNumberOfCells()=0;
00042   
00043 protected:
00044   vtkXMLDataReader();
00045   ~vtkXMLDataReader();  
00046   
00047   // Add functionality to methods from superclass.
00048   virtual void CreateXMLParser();
00049   virtual void DestroyXMLParser();
00050   int ReadPrimaryElement(vtkXMLDataElement* ePrimary);
00051   void SetupOutputInformation();  
00052   void SetupOutputData();
00053   
00054   // Setup the reader for a given number of pieces.
00055   virtual void SetupPieces(int numPieces);
00056   virtual void DestroyPieces();
00057   
00058   // Read information from the file for the given piece.
00059   int ReadPiece(vtkXMLDataElement* ePiece, int piece);
00060   virtual int ReadPiece(vtkXMLDataElement* ePiece);
00061   
00062   // Read data from the file for the given piece.
00063   int ReadPieceData(int piece);
00064   virtual int ReadPieceData();
00065   
00066   // Read a data array whose tuples coorrespond to points or cells.
00067   virtual int ReadArrayForPoints(vtkXMLDataElement* da,
00068                                  vtkDataArray* outArray);
00069   virtual int ReadArrayForCells(vtkXMLDataElement* da,
00070                                 vtkDataArray* outArray);
00071   
00072   // Read data from a given element.
00073   int ReadData(vtkXMLDataElement* da, void* data, int wordType, int startWord,
00074                int numWords);  
00075   
00076   // Callback registered with the DataProgressObserver.
00077   static void DataProgressCallbackFunction(vtkObject*, unsigned long, void*,
00078                                            void*);
00079   // Progress callback from XMLParser.
00080   virtual void DataProgressCallback();
00081   
00082   // The number of Pieces of data found in the file.
00083   int NumberOfPieces;
00084   
00085   // The PointData and CellData element representations for each piece.
00086   vtkXMLDataElement** PointDataElements;
00087   vtkXMLDataElement** CellDataElements;
00088   
00089   // The piece currently being read.
00090   int Piece;
00091   
00092   // The number of point/cell data arrays in the output.  Valid after
00093   // SetupOutputInformation has been called.
00094   int NumberOfPointArrays;
00095   int NumberOfCellArrays;  
00096   
00097   // Flag for whether DataProgressCallback should actually update
00098   // progress.
00099   int InReadData;
00100   
00101   // The observer to report progress from reading data from XMLParser.
00102   vtkCallbackCommand* DataProgressObserver;  
00103   
00104 private:
00105   vtkXMLDataReader(const vtkXMLDataReader&);  // Not implemented.
00106   void operator=(const vtkXMLDataReader&);  // Not implemented.
00107 };
00108 
00109 #endif