SpectraPac 2.0(r200)
Evaluates PAC Measurements
|
00001 /*************************************************************************** 00002 * Copyright (C) 2008-2010 by Matthias Nagl * 00003 * mnagl@uni-goettingen.de * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00021 #ifndef PACDATAREADER_H 00022 #define PACDATAREADER_H 00023 00024 #include <QThread> 00025 #include <QSemaphore> 00026 #include <QHash> 00027 #include "pacDataTypes.h" 00028 #include "pacDefinitions.h" 00029 00030 class PacBasicMeasurementInfo; 00031 00042 class PacDataReader : public QThread 00043 { 00044 Q_OBJECT 00045 public: 00046 00047 PacDataReader( 00048 const PacBasicMeasurementInfo *basicinfo, 00049 QObject *parent = 0 00050 ); 00051 00052 ~PacDataReader(); 00053 00061 void setReadoutParameters(Pac::ReadoutRange range, quint64 numchunks); 00062 00067 void setReadoutStartPosition(quint64 startpointer = 0); 00068 00075 const Pac::Event * nextEventPointer(); 00076 00077 int progress(bool beginningandend); 00078 00085 quint64 nextChunkPosPointerPos() const; 00086 00091 bool paceventsFileStillWritten() const; 00092 00093 protected: 00094 void run(); 00095 00096 private: 00098 00099 const PacBasicMeasurementInfo *basicinfo; 00100 quint64 eventsperchunk; 00101 quint64 numofrecords; 00102 00104 00106 00107 static const quint64 tryreadoutatonce; 00108 quint64 numchunks; 00109 Pac::ReadoutRange range; 00110 quint64 startpointer; 00111 quint64 nextchunkpospointerpos; 00112 bool stillwritten; 00113 quint64 currentreadpercentageestimate; 00114 00115 00117 00118 static const quint32 buffersize; 00119 static const quint32 acquireatonce; 00120 Pac::Event ** buffer; 00121 quint32 nextwritepos, nextreadpos; 00122 QSemaphore free, used; 00123 qint32 remainingacquired; 00124 qint32 numacquired; 00125 bool readerisactive; 00126 00127 00129 00130 quint64 totaleventsread; 00131 QAtomicInt stopthread; 00133 }; 00134 00135 #endif // PACDATAREADER_H