Classes | Public Slots | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
QwtSamplingThread Class Referenceabstract

A thread collecting samples at regular intervals. More...

#include <qwt_sampling_thread.h>

Inheritance diagram for QwtSamplingThread:
Inheritance graph
[legend]

Classes

class  PrivateData
 

Public Slots

void setInterval (double interval)
 
void stop ()
 

Public Member Functions

double elapsed () const
 
double interval () const
 
virtual ~QwtSamplingThread ()
 Destructor. More...
 

Protected Member Functions

 QwtSamplingThread (QObject *parent=NULL)
 Constructor. More...
 
virtual void run () QWT_OVERRIDE
 
virtual void sample (double elapsed)=0
 

Private Attributes

PrivateDatam_data
 

Detailed Description

A thread collecting samples at regular intervals.

Continuous signals are converted into a discrete signal by collecting samples at regular intervals. A discrete signal can be displayed by a QwtPlotSeriesItem on a QwtPlot widget.

QwtSamplingThread starts a thread calling periodically sample(), to collect and store ( or emit ) a single sample.

See also
QwtPlotCurve, QwtPlotSeriesItem

Definition at line 28 of file qwt_sampling_thread.h.

Constructor & Destructor Documentation

◆ ~QwtSamplingThread()

QwtSamplingThread::~QwtSamplingThread ( )
virtual

Destructor.

Definition at line 29 of file qwt_sampling_thread.cpp.

◆ QwtSamplingThread()

QwtSamplingThread::QwtSamplingThread ( QObject *  parent = NULL)
explicitprotected

Constructor.

Definition at line 21 of file qwt_sampling_thread.cpp.

Member Function Documentation

◆ elapsed()

double QwtSamplingThread::elapsed ( ) const
Returns
Time (in ms) since the thread was started
See also
QThread::start(), run()

Definition at line 62 of file qwt_sampling_thread.cpp.

◆ interval()

double QwtSamplingThread::interval ( ) const
Returns
Interval (in ms), between 2 calls of sample()
See also
setInterval()

Definition at line 53 of file qwt_sampling_thread.cpp.

◆ run()

void QwtSamplingThread::run ( )
protectedvirtual

Loop collecting samples started from QThread::start()

See also
stop()

Definition at line 83 of file qwt_sampling_thread.cpp.

◆ sample()

virtual void QwtSamplingThread::sample ( double  elapsed)
protectedpure virtual

Collect a sample

Parameters
elapsedTime since the thread was started in seconds
Note
Due to a bug in previous version elapsed was passed as seconds instead of miliseconds. To avoid breaking existing code we stay with seconds for now.

◆ setInterval

void QwtSamplingThread::setInterval ( double  msecs)
slot

Change the interval (in ms), when sample() is called. The default interval is 1000.0 ( = 1s )

Parameters
msecsInterval
See also
interval()

Definition at line 41 of file qwt_sampling_thread.cpp.

◆ stop

void QwtSamplingThread::stop ( )
slot

Terminate the collecting thread

See also
QThread::start(), run()

Definition at line 74 of file qwt_sampling_thread.cpp.

Member Data Documentation

◆ m_data

PrivateData* QwtSamplingThread::m_data
private

Definition at line 65 of file qwt_sampling_thread.h.


The documentation for this class was generated from the following files:


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Aug 11 2024 02:24:30