00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #ifndef TRACESPROVIDER_H
00019 #define TRACESPROVIDER_H
00020 
00021 
00022 #include <dataprovider.h>
00023 #include <array.h>
00024 #include <types.h>
00025 
00026 
00027 #include <qptrlist.h>
00028 #include <qobject.h>
00029 
00035 class TracesProvider : public DataProvider  {
00036   Q_OBJECT
00037 public:
00038 
00046      TracesProvider(KURL fileUrl,int nbChannels,int resolution,double samplingRate,int offset);
00047      ~TracesProvider();
00048 
00055   void requestData(long startTime,long endTime,QObject* initiator,long startTimeInRecordingUnits);
00056 
00060   inline void setNbChannels(int nb){
00061    nbChannels = nb;
00062    computeRecordingLength();
00063   };
00064 
00068   inline void setResolution(int res){
00069    resolution = res;
00070    computeRecordingLength();
00071   };
00072 
00076   inline void setSamplingRate(double rate){
00077    samplingRate = rate;
00078    computeRecordingLength();
00079   };
00080 
00084   inline void setOffset(int newOffset){offset =  newOffset;};
00085 
00088   inline int getNbChannels() const {return nbChannels;};
00089 
00092   inline int getResolution() const {return resolution;};
00093 
00096   inline double getSamplingRate() const {return samplingRate;};
00097 
00100   inline int getOffset() const {return offset;};
00101 
00103   inline long long recordingLength()const{return length;};
00104 
00111   dataType getNbSamples(long startTime,long endTime,long startTimeInRecordingUnits);
00112 
00114   long getTotalNbSamples();
00115   
00116 signals:
00121   void dataReady(Array<dataType>& data,QObject* initiator);
00122              
00123 private:
00125   int nbChannels;
00126 
00128   int resolution;
00129 
00131   double samplingRate;
00132 
00134   int offset;
00135 
00137   long long length;
00138   
00139   
00140 
00147   void retrieveData(long startTime,long endTime,QObject* initiator,long startTimeInRecordingUnits);
00148 
00150   void computeRecordingLength();
00151   
00152  };
00153 
00154 #endif