libPaceventsWriter 2.0(r200)
Library for Writing .pacevents Files
|
00001 // 00002 // C++ Interface: PaceventsWriter 00003 // 00004 // Description: 00005 // 00006 // 00007 // Author: Matthias Nagl <mnagl@uni-goettingen.de>, (C) 2009 00008 // 00009 // Copyright: See COPYING file that comes with this distribution 00010 // 00011 // 00012 #ifndef PACEVENTSWRITER_H 00013 #define PACEVENTSWRITER_H 00014 00027 #include <QtCore/QtGlobal> 00028 #include <QObject> 00029 #include <QDateTime> 00030 #include <QHash> 00031 #include <QMap> 00032 #include "pacDataTypes.h" 00033 00034 #if defined(PACEVENTSWRITER_LIBRARY) 00035 # define PACEVENTSWRITER_EXPORT Q_DECL_EXPORT 00036 #else 00037 # define PACEVENTSWRITER_EXPORT Q_DECL_IMPORT 00038 #endif 00039 00040 class QFile; 00041 class QtIOCompressor; 00042 00127 class PACEVENTSWRITER_EXPORT PaceventsWriter : public QObject 00128 { 00129 Q_OBJECT 00130 public: 00131 00133 00137 PaceventsWriter(QObject *parent = 0); 00138 PaceventsWriter(QFile *file, QObject *parent = 0); 00139 ~PaceventsWriter(); 00140 00144 void useFile(QFile *file); 00148 void finalize(); 00150 00152 00160 void setCompressionLevel(quint8 level); 00165 void setEventsPerChunk(quint64 events); 00171 void setStartOfMeasurement(const QDateTime &starttime); 00177 void setStopOfMeasurement(const QDateTime &stoptime); 00182 void setColumnContents(const QList<Pac::DataFileColumns> &colcontents); 00187 void setColumnTypes(const QList<Pac::DataFileColumType> &coltypes); 00192 void setNodeIds(const QList<quint8> &nodeids); 00198 void setNodeIdsToPhi(const QHash<quint8, float> &phi); 00204 void setNodeIdsToTheta(const QHash<quint8, float> &theta); 00209 void setSetupTree(const QMap<QString, QString> &setuptree); 00215 void setFlags(Pac::DataFileFlags flags); 00220 void setFinalComment(const QString &comment); 00222 00223 00227 void writeEvent(const QByteArray &data); 00229 00230 signals: 00231 void newChunkStarted(); 00232 00233 private: 00234 void writeHeader(); 00235 static const quint32 version = 3; 00236 QFile * file; 00237 quint8 compressionlevel; 00238 quint64 eventsperchunk; 00239 QDateTime start, stop; 00240 QList<Pac::DataFileColumns> colcontents; 00241 QList<Pac::DataFileColumType> coltypes; 00242 QList<quint8> nodeids; 00243 QHash<quint8, float> phi, theta; 00244 QMap<QString, QString> setuptree; 00245 Pac::DataFileFlags flags; 00246 QString comment; 00247 00248 quint64 stoptimepos, numrecordspos, flagspos; 00249 quint64 lastforwardpointer; 00250 bool writingrecords; 00251 QtIOCompressor *compress; 00252 quint64 numrecords; 00253 }; 00254 00255 #endif