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

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 =========================================================================*/
00036 #ifndef __vtkXMLDataReader_h
00037 #define __vtkXMLDataReader_h
00038 
00039 #include "vtkXMLReader.h"
00040 
00041 class VTK_IO_EXPORT vtkXMLDataReader : public vtkXMLReader
00042 {
00043 public:
00044   vtkTypeRevisionMacro(vtkXMLDataReader,vtkXMLReader);
00045   void PrintSelf(ostream& os, vtkIndent indent);
00046   
00048   virtual vtkIdType GetNumberOfPoints()=0;
00049   
00051   virtual vtkIdType GetNumberOfCells()=0;
00052   
00053 protected:
00054   vtkXMLDataReader();
00055   ~vtkXMLDataReader();  
00056   
00057   // Add functionality to methods from superclass.
00058   virtual void CreateXMLParser();
00059   virtual void DestroyXMLParser();
00060   int ReadPrimaryElement(vtkXMLDataElement* ePrimary);
00061   void SetupOutputInformation();  
00062   void SetupOutputData();
00063   
00064   // Setup the reader for a given number of pieces.
00065   virtual void SetupPieces(int numPieces);
00066   virtual void DestroyPieces();
00067   
00068   // Read information from the file for the given piece.
00069   int ReadPiece(vtkXMLDataElement* ePiece, int piece);
00070   virtual int ReadPiece(vtkXMLDataElement* ePiece);
00071   
00072   // Read data from the file for the given piece.
00073   int ReadPieceData(int piece);
00074   virtual int ReadPieceData();
00075   
00076   // Read a data array whose tuples coorrespond to points or cells.
00077   virtual int ReadArrayForPoints(vtkXMLDataElement* da,
00078                                  vtkDataArray* outArray);
00079   virtual int ReadArrayForCells(vtkXMLDataElement* da,
00080                                 vtkDataArray* outArray);
00081   
00082   // Read data from a given element.
00083   int ReadData(vtkXMLDataElement* da, void* data, int wordType, int startWord,
00084                int numWords);  
00085   
00086   // Callback registered with the DataProgressObserver.
00087   static void DataProgressCallbackFunction(vtkObject*, unsigned long, void*,
00088                                            void*);
00089   // Progress callback from XMLParser.
00090   virtual void DataProgressCallback();
00091   
00092   // The number of Pieces of data found in the file.
00093   int NumberOfPieces;
00094   
00095   // The PointData and CellData element representations for each piece.
00096   vtkXMLDataElement** PointDataElements;
00097   vtkXMLDataElement** CellDataElements;
00098   
00099   // The piece currently being read.
00100   int Piece;
00101   
00102   // The number of point/cell data arrays in the output.  Valid after
00103   // SetupOutputInformation has been called.
00104   int NumberOfPointArrays;
00105   int NumberOfCellArrays;  
00106   
00107   // Flag for whether DataProgressCallback should actually update
00108   // progress.
00109   int InReadData;
00110   
00111   // The observer to report progress from reading data from XMLParser.
00112   vtkCallbackCommand* DataProgressObserver;  
00113   
00114 private:
00115   vtkXMLDataReader(const vtkXMLDataReader&);  // Not implemented.
00116   void operator=(const vtkXMLDataReader&);  // Not implemented.
00117 };
00118 
00119 #endif