1 /*************************************************************************** 2 dmc.h - data source plugin for planck DMC 3 ------------------- 4 begin : Wed July 4 2007 5 copyright : (C) 2007 The University of Toronto 6 email : 7 ***************************************************************************/ 8 9 /*************************************************************************** 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 ***************************************************************************/ 17 18 #ifndef KST_DMCSOURCE_H 19 #define KST_DMCSOURCE_H 20 21 #include "datasource.h" 22 #include "dmcdata.h" 23 #include "dmcobj.h" 24 25 #include "dataplugin.h" 26 27 28 class DataInterfaceDmcVector; 29 30 class DmcSource : public Kst::DataSource { 31 public: 32 DmcSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement &element); 33 34 ~DmcSource(); 35 36 bool initFile(); 37 38 Kst::Object::UpdateType internalDataSourceUpdate(); 39 40 virtual const QString& typeString() const; 41 42 static const QString dmcTypeKey(); 43 44 45 int readScalar(double *v, const QString& field); 46 47 int readString(QString *stringValue, const QString& stringName); 48 49 int readField(double *v, const QString& field, int s, int n); 50 51 int readMatrix(double *v, const QString& field); 52 53 int samplesPerFrame(const QString& field); 54 55 int frameCount(const QString& field = QString()) const; 56 57 QString fileType() const; 58 59 void save(QTextStream &ts, const QString& indent = QString()); 60 61 bool isEmpty() const; 62 63 void reset(); 64 65 private: 66 QMap<QString, int> _frameCounts; 67 int _numFrames; 68 69 QStringList _fieldList; 70 DataInterfaceDmcVector* iv; 71 72 // TODO remove friend 73 friend class DataInterfaceDmcVector; 74 75 76 // from kst1 old dmc code 77 Kst::SharedPtr<DMC::Object> _dmcObject; 78 QString _filename; 79 80 void update(); 81 82 int readField(double *v, const QString& field, int s, int n, int skip, int *lastFrameRead) ; 83 bool isValidField(const QString& field) const; 84 bool supportsTimeConversions() const; 85 int sampleForTime(const QDateTime& time, bool *ok); 86 QDateTime timeForSample(int sample, bool *ok); 87 int sampleForTime(double ms, bool *ok); 88 double relativeTimeForSample(int sample, bool *ok); 89 }; 90 91 92 93 #endif 94 95