FileReader.h

Go to the documentation of this file.
00001 // FileReader.h: interface for the FileReader class.
00002 //
00004 
00005 #if !defined(AFX_FILEREADER_H__FBE90E13_CC25_465A_9449_79A971DF5770__INCLUDED_)
00006 #define AFX_FILEREADER_H__FBE90E13_CC25_465A_9449_79A971DF5770__INCLUDED_
00007 
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011 
00012 #include <string> 
00013 #include <fstream>
00014 #include <iostream>
00015 #include <algorithm>
00016 #include <sstream>
00017 
00018 #include "FileNotFoundException.h"
00019 #include "ParseException.h"
00020 #include "Interpolator.h"
00021 //using namespace std;
00022 
00023 namespace Interpolator
00024 {
00025 
00030 class FileReader  
00031 {
00032 public:
00033         FileReader();
00034         FileReader(const std::string& sFileName);                                                                       // throw (FileNotFoundException);
00035         FileReader(const std::string& sFileName,long lNbVariables,long lNbDatas);       // throw (FileNotFoundException);
00036         virtual ~FileReader();
00037         
00038         bool isReadable();
00039         
00040         double          extractDouble();
00041         std::string     extractString() ;
00042         int                     extractInt();
00043         std::string     extractLine();
00044         
00045         long    extractFileSize();              // throw (FileNotFoundException);       
00046         long    extractNbFileLines();   // throw (FileNotFoundException);
00047         long    extractBufferSize();
00048 //      long    extractNbData();
00049 //      long    extractNbVariables();
00050 
00051         long    getFileSize()           const;
00052         long    getNbFileLines()        const;
00053         long    getBufferSize()         const;
00054         long    getNbVariables()        const;
00055         long    getNbData()             const;
00056         
00057         void    setFileSize             (long lFileSize);       
00058         void    setNbFileLines  (long lNbFileLines);
00059         void    setBufferSize   (long lBufferSize);
00060         void    setNbVariables  (long lNbVariables);
00061         void    setNbData               (long lNbData);
00062 
00063         void    copyFileToBuffer(); // throw (FileNotFoundException);
00064         
00065         virtual void Parse()=0; // throw (ParseException)=0;
00066         
00067         void extractHeader();
00068 
00069 private:
00070         std::string                     _sFileName;
00071         
00072         long                            _lNbVariables;
00073         long                            _lNbData;
00074 
00075         std::stringstream       _mFileBuffer;
00076         
00077         long                            _lBufferSize;   
00078         long                            _lFileSize;
00079         long                            _lNbFileLines;
00080 
00081 };
00082 }
00083 #endif // !defined(AFX_FILEREADER_H__FBE90E13_CC25_465A_9449_79A971DF5770__INCLUDED_)

Generated on Tue Apr 14 09:50:27 2009 for Interpolator Library by  doxygen 1.4.5