A cached version of a PlotCurveDataModel which operates on top of BaseQueryModel. More...
#include <cachedplotcurvedatamodel.h>


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 |
| QwtData * | copy () const |
A cached version of a PlotCurveDataModel which operates on top of BaseQueryModel.
| CachedPlotCurveDataModel::CachedPlotCurveDataModel | ( | QAbstractItemModel * | model, | |
| int | xColumn, | |||
| int | yColumn | |||
| ) |
Referenced by copy().
: m_size(0)
{
setModel(model, xColumn, yColumn);
}
| 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 |
| 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;
}
1.7.1