File indexing completed on 2024-12-22 04:17:04

0001 /***************************************************************************
0002                          dmcobj.h  -  Part of KST
0003                              -------------------
0004     begin                : Mon Oct 06 2003
0005     copyright            : (C) 2003 The University of Toronto
0006     email                :
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #ifndef KST_DMOBJECT_H
0019 #define KST_DMOBJECT_H
0020 
0021 #include "dmcdata.h"
0022 
0023 #include <QMap>
0024 
0025 
0026 namespace DMC
0027 {
0028     enum TimeType { Undetermined = -1, Unknown = 0, TimeSec = 1, TimesOfSamples = 2 };
0029 
0030 class ObjectGroup;
0031 
0032 class Object : public Source
0033 {
0034   public:
0035     Object();
0036     virtual ~Object();
0037 
0038     virtual bool setGroup(const QString& group);
0039  
0040     virtual QStringList fields() const;
0041 
0042     virtual void reset();
0043 
0044     virtual bool updated() const;
0045 
0046     virtual int readObject(const QString& object, double *buf, long start, long end);
0047 
0048     // FIXME: QSize is a bogus class to use here
0049     virtual QSize range(const QString& object) const;
0050 
0051     TimeType typeOfTime();
0052     double fetchTimePoint(PIOLONG);
0053 
0054     int sampleForTime(double ms, bool *ok);
0055     int sampleForTimeRelative(double ms, bool *ok);
0056     double timeForSample(int sample);
0057 
0058   private:
0059     // We lazy load the groups, hence mutable
0060     mutable QMap<QString, ObjectGroup*> _groupInfo;
0061     ObjectGroup *findGroup(const QString& group) const;
0062     TimeType _tt;
0063 };
0064 
0065 }
0066 
0067 #endif
0068