Signals | Public Member Functions

CachedPlotCurveDataModel Class Reference

A cached version of a PlotCurveDataModel which operates on top of BaseQueryModel. More...

#include <cachedplotcurvedatamodel.h>

Inheritance diagram for CachedPlotCurveDataModel:
Inheritance graph
[legend]
Collaboration diagram for CachedPlotCurveDataModel:
Collaboration graph
[legend]

List of all members.

Signals

void signal_dataChanged ()

Public Member Functions

 CachedPlotCurveDataModel (QAbstractItemModel *model, int xColumn, int yColumn)
size_t size () const
double x (size_t i) const
double y (size_t i) const
QwtDatacopy () const

Detailed Description

A cached version of a PlotCurveDataModel which operates on top of BaseQueryModel.


Constructor & Destructor Documentation

CachedPlotCurveDataModel::CachedPlotCurveDataModel ( QAbstractItemModel model,
int  xColumn,
int  yColumn 
)

Referenced by copy().

                                                                                                      : m_size(0)
{
    setModel(model, xColumn, yColumn);
}


Member Function Documentation

QwtData * CachedPlotCurveDataModel::copy (  )  const

Reimplemented from QwtData.

{
    qDebug() << "Copy of CachedPlotCurveDataModel requested: " << this;
    // Dit moet beter geimplementeerd worden zodat de cache meegegeven wordt!
    return new CachedPlotCurveDataModel(model(), xColumn, yColumn);
}

void CachedPlotCurveDataModel::signal_dataChanged (  )  [signal]
size_t CachedPlotCurveDataModel::size (  )  const

Reimplemented from QwtData.

Referenced by x().

{
    return m_size;
}

double CachedPlotCurveDataModel::x ( size_t  i  )  const

Reimplemented from QwtData.

{
    if (i == 0) {
        static int c = 0;
        qDebug() << "REQUESTING DATA: " << c++ << "size: " << size();
        Q_ASSERT(model());
        Q_ASSERT(xColumn < model()->columnCount() && yColumn < model()->columnCount());
    }
    QHash<unsigned int, DataPoint>::const_iterator it(cache.find(i));
    if (it != cache.end()) return it.value().time_t;
    else return updateCache(i).time_t;
}

double CachedPlotCurveDataModel::y ( size_t  i  )  const

Reimplemented from QwtData.

{
    if (i == 0) {
        Q_ASSERT(model());
        Q_ASSERT(xColumn < model()->columnCount() && yColumn < model()->columnCount());
    }
    QHash<unsigned int, DataPoint>::const_iterator it(cache.find(i));
    if (it != cache.end()) return it.value().data;
    else return updateCache(i).data;
}


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