The Parametric Pseudo-Manifold (PPS) Library 1.0
reader.h
Go to the documentation of this file.
00001 
00026 #ifndef READER_H
00027 #define READER_H
00028 
00029 #include "lexer.h"
00030 
00031 #include <fstream>
00032 #include <string>
00033 
00034 
00048 namespace offlib {
00049 
00056   class Reader {
00057   public:
00058     // ---------------------------------------------------------------
00059     //
00060     // Public methods
00061     //
00062     // ---------------------------------------------------------------
00063 
00071     Reader( const std::string& fn ) : _is( 0 )
00072     {
00073       _fname = fn + std::string( ".off" ) ;
00074     }
00075 
00076 
00082     ~Reader()
00083     {
00084       if ( _is != 0 ) delete _is ; 
00085     }
00086 
00087 
00101     void read(
00102               unsigned& nv ,
00103               double*& vset ,
00104               unsigned& nf ,
00105               unsigned*& fset 
00106              ) ; 
00107 
00108 
00109   private:
00110 
00111     // ---------------------------------------------------------------
00112     //
00113     // Private methods
00114     //
00115     // ---------------------------------------------------------------
00116 
00126     void read_header( 
00127                      unsigned& nv , 
00128                      unsigned& nf 
00129                     ) ;
00130 
00131 
00141     void read_vertices( 
00142                        unsigned nv , 
00143                        double*& vset 
00144                       ) ;
00145 
00146 
00157     void read_faces( 
00158                     unsigned nf , 
00159                     unsigned nv , 
00160                     unsigned*& fset 
00161                    ) ;
00162 
00163 
00164     // ---------------------------------------------------------------
00165     //
00166     // Private data members
00167     //
00168     // ---------------------------------------------------------------
00169 
00170     std::string _fname ;   
00171 
00172     Lexer* _is ;           
00173 
00174   } ;
00175 
00176 } 
00177  //end of group class.
00179 
00180 #endif   // READER_H