| Line |   | 
|---|
| 1 | #ifndef _QWT_SAMPLING_THREAD_H_
 | 
|---|
| 2 | #define _QWT_SAMPLING_THREAD_H_
 | 
|---|
| 3 | 
 | 
|---|
| 4 | #include "qwt_global.h"
 | 
|---|
| 5 | #include <qthread.h>
 | 
|---|
| 6 | 
 | 
|---|
| 7 | /*!
 | 
|---|
| 8 |   \brief A thread collecting samples at regular intervals.
 | 
|---|
| 9 | 
 | 
|---|
| 10 |   Contiounous signals are converted into a discrete signal by
 | 
|---|
| 11 |   collecting samples at regular intervals. A discrete signal
 | 
|---|
| 12 |   can be displayed by a QwtPlotSeriesItem on a QwtPlot widget.
 | 
|---|
| 13 | 
 | 
|---|
| 14 |   QwtSamplingThread starts a thread calling perodically sample(),
 | 
|---|
| 15 |   to collect and store ( or emit ) a single sample.
 | 
|---|
| 16 | 
 | 
|---|
| 17 |   \sa QwtPlotCurve, QwtPlotSeriesItem
 | 
|---|
| 18 | */
 | 
|---|
| 19 | class QWT_EXPORT QwtSamplingThread: public QThread
 | 
|---|
| 20 | {
 | 
|---|
| 21 |     Q_OBJECT
 | 
|---|
| 22 | 
 | 
|---|
| 23 | public:
 | 
|---|
| 24 |     virtual ~QwtSamplingThread();
 | 
|---|
| 25 | 
 | 
|---|
| 26 |     double interval() const;
 | 
|---|
| 27 |     double elapsed() const;
 | 
|---|
| 28 | 
 | 
|---|
| 29 | public Q_SLOTS:
 | 
|---|
| 30 |     void setInterval( double interval );
 | 
|---|
| 31 |     void stop();
 | 
|---|
| 32 | 
 | 
|---|
| 33 | protected:
 | 
|---|
| 34 |     explicit QwtSamplingThread( QObject *parent = NULL );
 | 
|---|
| 35 | 
 | 
|---|
| 36 |     virtual void run();
 | 
|---|
| 37 | 
 | 
|---|
| 38 |     /*!
 | 
|---|
| 39 |        Collect a sample
 | 
|---|
| 40 | 
 | 
|---|
| 41 |        \param elapsed Time since the thread was started in miliseconds
 | 
|---|
| 42 |      */
 | 
|---|
| 43 |     virtual void sample( double elapsed ) = 0;
 | 
|---|
| 44 | 
 | 
|---|
| 45 | private:
 | 
|---|
| 46 |     class PrivateData;
 | 
|---|
| 47 |     PrivateData *d_data;
 | 
|---|
| 48 | };
 | 
|---|
| 49 | 
 | 
|---|
| 50 | #endif
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.