FileWriter.h

Go to the documentation of this file.
00001 // FileWriter.h: interface for the FileWriter class.
00002 //
00004 
00005 #if !defined(AFX_FILEWRITER_H__3BD13DC0_CE2D_4FA4_991A_2B1C637F1686__INCLUDED_)
00006 #define AFX_FILEWRITER_H__3BD13DC0_CE2D_4FA4_991A_2B1C637F1686__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 <gsl/gsl_vector.h>
00021 
00022 #include "GenericFileReader1D.h"
00023 namespace Interpolator
00024 {
00029 class FileWriter  
00030 {
00031 public:
00032         FileWriter();
00033         FileWriter(const std::string& sPath,const std::string& sFileName);                                                                      // throw (FileNotFoundException);
00034         FileWriter(const std::string& sPath,const std::string& sFileName,long lNbVariables,long lNbDatas);      // throw (FileNotFoundException);
00035 
00036         FileWriter(const std::string& sPath,const std::string& sFileName,long lNbDatas, double* mXdata, double* mYdata);        
00037         FileWriter(const std::string& sCompleteFilePath,long lNbDatas, double* mXdata, double* mYdata);
00038         FileWriter(const std::string& sPath,
00039                                            const std::string& sFileName,
00040                                            long lIndex,
00041                                            std::string& sExtension,
00042                                            long lNbDatas, double* mXdata, double* mYdata);
00043 
00044 
00045         FileWriter(const std::string& sCompleteFilePath,gsl_vector* mXdata, gsl_vector* mYdata);
00046         FileWriter(const std::string& sPath,
00047                                            const std::string& sFileName,
00048                                            long lIndex,
00049                                            const std::string& sExtension,
00050                                            gsl_vector* mXdata, gsl_vector* mYdata);
00051 
00052 
00053         FileWriter(     const std::string& sCompleteFilePath,
00054                                 double dThetaTheorical,
00055                                 double dThetaMechanical,
00056                                 double dTolerance);
00057 
00058         long FileWriter::FindLine(GenericFileReader1D* mFile,double dThetaTheorical,double dTolerance);
00059 
00060         bool isWritable();
00061 
00062         virtual ~FileWriter();
00063 
00064         double                  writeDouble();
00065         std::string             writeString() ;
00066         int                             writeInt();
00067         std::string             writeLine();
00068         
00069         long    extractFileSize();              // throw (FileNotFoundException);       
00070         long    extractNbFileLines();   // throw (FileNotFoundException);
00071         long    extractBufferSize();
00072 //      long    extractNbData();
00073 //      long    extractNbVariables();
00074 
00075         long    getFileSize()           const;
00076         long    getNbFileLines()        const;
00077         long    getBufferSize()         const;
00078         long    getNbVariables()        const;
00079         long    getNbData()                     const;
00080         
00081         void    setFileSize             (long lFileSize);       
00082         void    setNbFileLines  (long lNbFileLines);
00083         void    setBufferSize   (long lBufferSize);
00084         void    setNbVariables  (long lNbVariables);
00085         void    setNbData               (long lNbData);
00086 
00087         void    copyFileToBuffer(); // throw (FileNotFoundException);
00088         
00089         //virtual void Write(); // throw (ParseException)=0;
00090         
00091         void    extractHeader();
00092 
00093 private:
00094         std::string                     _sFileName;
00095         
00096         long                            _lNbVariables;
00097         long                            _lNbData;
00098 
00099         std::stringstream       _mFileBuffer;
00100         
00101         long                            _lBufferSize;   
00102         long                            _lFileSize;
00103         long                            _lNbFileLines;
00104 };
00105 }
00106 #endif // !defined(AFX_FILEWRITER_H__3BD13DC0_CE2D_4FA4_991A_2B1C637F1686__INCLUDED_)

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