DinverCore/ReportReader.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of DinverCore.
00004 **
00005 **  This file may be distributed and/or modified under the terms of the
00006 **  GNU General Public License version 2 or 3 as published by the Free
00007 **  Software Foundation and appearing in the file LICENSE.GPL included
00008 **  in the packaging of this file.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
00013 **  more details.
00014 **
00015 **  You should have received a copy of the GNU General Public License
00016 **  along with this program. If not, see <http://www.gnu.org/licenses/>.
00017 **
00018 **  See http://www.geopsy.org for more information.
00019 **
00020 **  Created : 2005-12-20
00021 **  Authors:
00022 **    Marc Wathelet
00023 **    Marc Wathelet (LGIT, Grenoble, France)
00024 **
00025 ***************************************************************************/
00026 
00027 #ifndef REPORTREADER_H
00028 #define REPORTREADER_H
00029 
00030 #include <QGpCoreTools.h>
00031 #include "DinverCoreDLLExport.h"
00032 
00033 namespace DinverCore {
00034 
00035 class DINVERCORE_EXPORT ReportReader : public SharedObject
00036 {
00037   TRANSLATIONS("ReportReader");
00038 public:
00039   ReportReader() {}
00040   ReportReader(QString fileName);
00041   ~ReportReader() {}
00042 
00043   void setFileName(QString fileName) {_f.setFileName(fileName);}
00044   QString fileName() {return _f.fileName();}
00045 
00046   static bool isReportFormat(QString fileName);
00047   bool open();
00048   void close() {_f.close();}
00049   void synchronize();
00050   int nModels() {return _offsets.count();}
00051 
00052   double misfit(int index);
00053   void modelBlock(int index) {_f.seek(_offsets.at(index));}
00054   int userBlockVersion(const char * tag);
00055   inline  int userBlockVersion(int index, const char * tag);
00056   QDataStream& stream() {return _s;}
00057   int version() const {return _version;}
00058 
00059   qint64 lastBlockOffset();
00060 private:
00061   QFile _f;
00062   QDataStream _s;
00063 
00064   QList<qint64> _offsets;
00065   int _version;
00066 };
00067 
00068 
00069 inline int ReportReader::userBlockVersion(int index, const char * tag)
00070 {
00071   TRACE;
00072   _f.seek(_offsets.at(index)+8);
00073   return userBlockVersion(tag);
00074 }
00075 
00076 } // namespace DinverCore
00077 
00078 #endif // REPORTREADER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines