20#ifndef JKQTPDATASTORAGE_H
21#define JKQTPDATASTORAGE_H
24#include "jkqtplotter/jkqtplotter_imexport.h"
25#include "jkqtplotter/jkqtptools.h"
26#include "jkqtcommon/jkqtpdebuggingtools.h"
27#include "jkqtcommon/jkqttools.h"
40#include <QAbstractTableModel>
226 QMap<size_t, std::shared_ptr<JKQTPColumn>>
columns;
334 inline size_t getRows(
size_t column)
const;
340 inline size_t getRows(
int column)
const;
380 inline double get(
size_t column,
size_t row)
const ;
383 inline double get(
int column,
size_t row)
const ;
385 inline double get(
int column,
int row)
const ;
387 inline double get(
size_t column,
int row)
const ;
406 inline void set(
size_t column,
size_t row,
double value);
408 inline void set(
int column,
size_t row,
double value);
515 void appendToColumns(
size_t column1,
size_t column2,
size_t column3,
double value1,
double value2,
double value3);
531 void appendToColumns(
size_t column1,
size_t column2,
size_t column3,
size_t column4,
double value1,
double value2,
double value3,
double value4);
548 void appendToColumns(
size_t column1,
size_t column2,
size_t column3,
size_t column4,
size_t column5,
double value1,
double value2,
double value3,
double value4,
double value5);
559 template<
class TContainer>
568 template<
class TIterator>
569 inline void appendToColumn(
size_t column, TIterator first, TIterator last);
572 inline double getPixel(
size_t column,
size_t x,
size_t y)
const ;
574 inline void setPixel(
size_t column,
size_t x,
size_t y,
double value) ;
579 inline void setAll(
size_t column,
double value);
589 inline void inc(
size_t column,
size_t row,
double increment=1);
594 inline void dec(
size_t column,
size_t row,
double decrement=1);
605 size_t addColumn(
size_t rows,
const QString& name=QString(
""),
double initVal=0.0);
632 size_t addColumn(
double* data,
size_t rows,
const QString& name=QString(
""));
697 size_t addImageColumn(
size_t width,
size_t height,
const QString& name=QString(
""));
712 size_t addImageColumn(
double* data,
size_t width,
size_t height,
const QString& name=QString(
""));
747 size_t copyColumn(
size_t old_column,
size_t start,
size_t stride,
const QString& name=QString(
""));
755 size_t copyColumn(
size_t old_column,
const QString& name=QString(
""));
776 std::pair<size_t,size_t>
addCopiedPoints(
const QList<QPointF>& points,
const QString& namex=QString(
""),
const QString &namey=QString(
""));
777 std::pair<size_t,size_t>
addCopiedPoints(
const QList<QPoint>& points,
const QString& namex=QString(
""),
const QString &namey=QString(
""));
778#if QT_VERSION<QT_VERSION_CHECK(6,0,0)
779 std::pair<size_t,size_t>
addCopiedPoints(
const QVector<QPointF>& points,
const QString& namex=QString(
""),
const QString &namey=QString(
""));
780 std::pair<size_t,size_t>
addCopiedPoints(
const QVector<QPoint>& points,
const QString& namex=QString(
""),
const QString &namey=QString(
""));
782 std::pair<size_t,size_t>
addCopiedPoints(
const std::vector<QPointF>& points,
const QString& namex=QString(
""),
const QString &namey=QString(
""));
783 std::pair<size_t,size_t>
addCopiedPoints(
const std::vector<QPoint>& points,
const QString& namex=QString(
""),
const QString &namey=QString(
""));
784 std::pair<size_t,size_t>
addCopiedPoints(
const std::list<QPointF>& points,
const QString& namex=QString(
""),
const QString &namey=QString(
""));
785 std::pair<size_t,size_t>
addCopiedPoints(
const std::list<QPoint>& points,
const QString& namex=QString(
""),
const QString &namey=QString(
""));
811 template <
typename TIterator>
812 size_t addCopiedColumn(TIterator first, TIterator last,
const QString& name=QString(
"")) {
813 const size_t N=
static_cast<size_t>(std::abs(std::distance(first,last)));
814 QVector<double> d; d.reserve(N);
817 for (
auto it=first; it!=last; ++it) {
848 template <
typename TContainer>
875 template <
typename TContainer>
876 size_t addCopiedColumn(
const TContainer& data,
const QString& name,
size_t stride,
size_t start=0) {
877 const size_t N=
static_cast<size_t>(data.size()-start)/stride;
878 QVector<double> d; d.reserve(N);
880 auto it=data.begin();
881 if (start>0) it+=start;
882 for (; it!=data.end(); it+=stride) {
905 QVector<double> d(rows);
907 for (
size_t r=0; r<rows; r++) {
936 size_t addCopiedColumn(
const T* data,
size_t rows,
size_t stride,
int start,
const QString& name) {
937 QVector<double> d; d.reserve(rows);
939 for (
size_t r=0; r<rows; r++) {
940 d.push_back(
jkqtp_todouble(data[
static_cast<size_t>(start+
static_cast<int64_t
>(r*stride))]));
968 size_t addCopiedColumn(
const T* data,
size_t rows,
size_t stride,
const QString& name) {
975 template <
typename T>
976 inline size_t addCopiedImageAsColumn(
const T* data,
size_t width,
size_t height,
const QString& name=QString(
""),
size_t stride=1,
size_t start=0);
987 template <
typename TContainer>
988 inline size_t addCopiedImageAsColumn(
const TContainer& data,
size_t width,
const QString& name=QString(
""));
1006 template <
typename T>
1007 size_t addCopiedImageAsColumnTranspose(
const T* data,
size_t width,
size_t height,
const QString& name=QString(
""),
size_t stride=1,
size_t start=0);
1022 template <
typename T>
1023 inline size_t addCopiedImageAsColumnTranspose(
const QVector<T>& data,
size_t width,
const QString& name=QString(
""));
1037 template <
typename T>
1038 size_t addCopiedColumnMasked(
const T* data,
const bool* mask,
size_t rows,
const QString& name=QString(
""),
bool useIfMaskEquals=
false) {
1039 QVector<double> d; d.reserve(rows);
1041 for (
size_t r=0; r<rows; r++) {
1042 if (!mask || (mask && (mask[r]==useIfMaskEquals))) {
1074 template <
typename TContainer,
typename TContainerMask>
1075 size_t addCopiedColumnMasked(
const TContainer& data,
const TContainerMask& mask,
const QString& name=QString(
""),
bool useIfMaskEquals=
false) {
1076 auto itmask=std::begin(mask);
1077 auto itmaskend=std::end(mask);
1078 auto itdata=std::begin(data);
1079 auto itdataend=std::end(data);
1080 const size_t N=std::min<size_t>(std::distance(itmask,itmaskend),std::distance(itdata,itdataend));
1083 for (
size_t r=0; r<N; r++) {
1084 if (
static_cast<bool>(*itmask)==useIfMaskEquals) {
1119 template <
typename TIterator>
1120 std::pair<size_t, size_t>
addCopiedMap(TIterator first, TIterator last,
const QString& nameKey=QString(
"map_key"),
const QString& nameValue=QString(
"map_value")) {
1121 const size_t N=
static_cast<size_t>(std::abs(std::distance(first,last)));
1122 QVector<double> xvals, yvals;
1125 for (
auto it=first; it!=last; ++it) {
1131 return std::pair<size_t, size_t>(cx,cy);
1157 template <
typename TContainer>
1158 std::pair<size_t, size_t>
addCopiedMap(
const TContainer& c,
const QString& nameKey=QString(
"map_key"),
const QString& nameValue=QString(
"map_value")) {
1159 return addCopiedMap(c.begin(), c.end(), nameKey, nameValue);
1174 size_t addLogColumn(
size_t rows,
double start,
double end,
const QString& name=QString(
""));
1179 size_t addDecadeLogColumn(
size_t rows,
double startDecade,
double endDecade,
const QString& name=QString(
""));
1199 std::pair<size_t,size_t>
addLinearGridColumns(
size_t width,
double startX,
double endX,
size_t height,
double startY,
double endY,
const QString& nameX=QString(
""),
const QString& nameY=QString(
""));
1227 size_t addCalculatedColumn(
size_t rows,
const std::function<
double(
size_t)>& f,
const QString& name=QString(
""));
1242 size_t addCalculatedImageColumn(
size_t cols,
size_t rows,
const std::function<
double(
size_t,
size_t)>& f,
const QString& name=QString(
""));
1272 inline size_t addColumnCalculatedFromColumn(
size_t otherColumnX,
size_t otherColumnY,
const std::function<
double(
double,
double)>& f,
const QString& name=QString(
"")) {
1275 inline size_t addCalculatedColumnFromColumn(
const std::pair<size_t, size_t>& otherColumn,
const std::function<
double(
double,
double)>& f,
const QString& name=QString(
"")) {
1317 void saveCSV(
const QString& filename,
const QSet<int>& userColumns=QSet<int>(),
const QString& separator=QString(
", "),
const QString& decimal_separator=QString(
"."),
const QString& comment=QString(
"#"),
const QString& aroundStrings=QString(
""),
char floatformat=
'g')
const;
1335 void saveCSV(QTextStream& txt,
const QSet<int>& userColumns=QSet<int>(),
const QString& separator=QString(
", "),
const QString& decimal_separator=QString(
"."),
const QString& comment=QString(
"#"),
const QString& aroundStrings=QString(
""),
char floatformat=
'g')
const;
1343 void saveSYLK(
const QString& filename,
const QSet<int>& userColumns=QSet<int>(),
const QString& floatformat=QString(
"%10.10lf"))
const;
1350 QList<QVector<double> >
getData(QStringList* columnNames=
nullptr,
const QSet<int>& userColumns=QSet<int>())
const;
1357 QVector<double>
getData(
size_t column, QString* columnName=
nullptr)
const;
1365 void saveDIF(
const QString& filename,
const QSet<int>& userColumns=QSet<int>(),
const QString& floatformat=QString(
"%10.10lf"))
const;
1372 void saveMatlab(
const QString& filename,
const QSet<int>& userColumns=QSet<int>())
const;
1378 void saveMatlab(QTextStream& txt,
const QSet<int>& userColumns=QSet<int>())
const;
1509 if (!
isValid())
return nullptr;
1511 if (n<=0)
return datavec.data();
1515 if (n<=0)
return data;
1516 else return &(
data[n]);
1522 if (!
isValid())
return nullptr;
1524 if (n<=0)
return datavec.data();
1528 if (n<=0)
return data;
1529 else return &(
data[n]);
1547 inline double getValue(
size_t n)
const;
1555 inline double getValue(
int n)
const;
1561 inline double&
at(
int n);
1567 inline const double&
at(
int n)
const;
1583 inline const double&
operator[](
int n)
const;
1589 inline void setValue(
size_t n,
double val);
1595 inline void incValue(
size_t n,
double increment=1.0);
1652 size_t copy(
const double*
data,
size_t N,
size_t offset=0);
1675 void resize(
size_t new_size,
double added_vala=0.0) {
1677 size_t old_size=
datavec.size();
1679 if (new_size>old_size) {
1680 for (
size_t i=old_size; i<new_size; i++)
datavec[i]=added_vala;
1686 inline quint16 calculateChecksum()
const;
1690 inline iterator begin();
1693 inline iterator end();
1697 inline const_iterator begin()
const;
1700 inline const_iterator end()
const;
1715 inline void eraseFromVectorColumn(
size_t row);
1719 inline void eraseFromVectorColumn(
size_t row,
size_t rowEnd);
1798 pos_++;
return *
this;
1806 pos_=
static_cast<int>(
col_->getRows())-1;
1815 pos_=
static_cast<int>(
col_->getRows())-1;
1824 pos_=
static_cast<int>(
col_->getRows())+inc;
1833 pos_=
static_cast<int>(
col_->getRows())-dec;
1893 return col_->at(
static_cast<int>(
col_->getRows())+off);
1983 inline operator bool()
const {
return isValid(); }
1991 if (!
isValid())
return QPoint(-1,-1);
1992 return QPoint(
pos_ %
static_cast<int>(
col_->getImageColumns()),
pos_ /
static_cast<int>(
col_->getImageColumns()));
1997 return pos_ %
static_cast<int>(
col_->getImageColumns());
2002 return pos_ /
static_cast<int>(
col_->getImageColumns());
2008 return col_->getImageColumns();
2014 return col_->getRows() /
col_->getImageColumns();
2062 ds_->appendToColumn(
col_, val);
2067 ds_->appendToColumn(
col_, std::move(val));
2133 pos_++;
return *
this;
2141 pos_=
static_cast<int>(
col_->getRows())-1;
2150 pos_=
static_cast<int>(
col_->getRows())-1;
2159 pos_=
static_cast<int>(
col_->getRows())+inc;
2168 pos_=
static_cast<int>(
col_->getRows())-dec;
2228 return col_->at(
static_cast<int>(
col_->getRows())+off);
2325 inline operator bool()
const {
return isValid(); }
2333 if (!
isValid())
return QPoint(-1,-1);
2334 return QPoint(
pos_ %
static_cast<int>(
col_->getImageColumns()),
pos_ /
static_cast<int>(
col_->getImageColumns()));
2339 return pos_ %
static_cast<int>(
col_->getImageColumns());
2344 return pos_ /
static_cast<int>(
col_->getImageColumns());
2350 return col_->getImageColumns();
2356 return col_->getRows() /
col_->getImageColumns();
2383 virtual QVariant
data(
const QModelIndex &index,
int role)
const override;
2384 virtual Qt::ItemFlags
flags(
const QModelIndex &index)
const override;
2385 virtual QVariant
headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
2386 virtual int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
2387 virtual int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
2426 return jkqtp_checksum(
reinterpret_cast<const char*
>(p),
static_cast<uint
>(
getRows()*
sizeof(
double)));
2485 return getValue(
static_cast<size_t>(n));
2525 return columns[column]->getRows();
2531 if (column<0)
return nullptr;
2532 return columns[
static_cast<size_t>(column)]->getPointer(row);
2538 if (column<0)
return nullptr;
2539 return columns[
static_cast<size_t>(column)]->getPointer(row);
2544 if (column<0)
return 0;
2551 return columns[column]->getPointer(row);
2557 return columns[column]->getPointer(row);
2562 return columns[column]->getValue(row);
2568 return get(
static_cast<size_t>(column),
static_cast<size_t>(row));
2575 return get(
static_cast<size_t>(column),
static_cast<size_t>(row));
2582 return get(
static_cast<size_t>(column),
static_cast<size_t>(row));
2587 columns[column]->setValue(row, value);
2592 set(
static_cast<size_t>(column),
static_cast<size_t>(row), value);
2597template<
class TContainer>
2604template<
class TIterator>
2607 for(
auto it=first; it!=last; it++) {
2615 return columns[column]->getPixelValue(x, y);
2620 return columns[column]->setPixelValue(x, y, value);
2626 columns[column]->setAll(value);
2632 columns[column]->scale(factor);
2638 columns[column]->incValue(row, increment);
2644 columns[column]->decValue(row, decrement);
2649template <
typename T>
2652 columns[col]->setImageColumns(width);
2657template <
typename TContainer>
2660 columns[col]->setImageColumns(width);
2666template <
typename T>
2668 QVector<double> temp(width*height);
2670 for (
size_t x=0; x<width; x++) {
2671 for (
size_t y=0; y<height; y++) {
2677 columns[idx]->setImageColumns(width);
2683template <
typename T>
iterator, which allows to insert into a column of a JKQTPDatastore
Definition jkqtpdatastorage.h:2037
JKQTPColumnBackInserter & operator=(JKQTPColumnBackInserter &&)=default
JKQTPColumnBackInserter(JKQTPDatastore *ds, size_t col)
constructs an iterator for the data represented by col, starting with row startpos
Definition jkqtpdatastorage.h:2045
JKQTPColumnBackInserter & operator=(double &&val)
Definition jkqtpdatastorage.h:2065
double * pointer
Definition jkqtpdatastorage.h:2051
int difference_type
Definition jkqtpdatastorage.h:2053
JKQTPColumnBackInserter & operator=(const JKQTPColumnBackInserter &)=default
double value_type
Definition jkqtpdatastorage.h:2048
const double & const_reference
Definition jkqtpdatastorage.h:2050
std::output_iterator_tag iterator_category
Definition jkqtpdatastorage.h:2052
JKQTPDatastore * ds_
references the datastore to access
Definition jkqtpdatastorage.h:2040
self_type operator++()
Definition jkqtpdatastorage.h:2071
friend class JKQTPDatastore
Definition jkqtpdatastorage.h:2075
JKQTPColumnBackInserter(const JKQTPColumnBackInserter &)=default
JKQTPColumnBackInserter(JKQTPColumnBackInserter &&)=default
double & reference
Definition jkqtpdatastorage.h:2049
size_t col_
references the column to access
Definition jkqtpdatastorage.h:2042
JKQTPColumnBackInserter self_type
Definition jkqtpdatastorage.h:2047
JKQTPColumnBackInserter & operator=(const double &val)
Definition jkqtpdatastorage.h:2060
self_type operator*()
Definition jkqtpdatastorage.h:2072
JKQTPColumnBackInserter()
constructs an invalid iterator
Definition jkqtpdatastorage.h:2055
self_type operator++(int)
Definition jkqtpdatastorage.h:2070
iterator over the data in the column of a JKQTPDatastore
Definition jkqtpdatastorage.h:2083
difference_type operator-(self_type rhs) const
Definition jkqtpdatastorage.h:2207
const_reference operator*() const
dereferences the iterator, throws an exception if the iterator is invalid (see isValid() ) or the val...
Definition jkqtpdatastorage.h:2236
JKQTPColumnConstIterator & operator=(nonconst_variant_type &&rhs)
Definition jkqtpdatastorage.h:2119
reference operator*()
dereferences the iterator, throws an exception if the iterator is invalid (see isValid() ) or the val...
Definition jkqtpdatastorage.h:2218
JKQTPColumnConstIterator(const JKQTPColumnConstIterator &)=default
friend self_type operator-(difference_type off, const self_type &right)
Definition jkqtpdatastorage.h:2182
bool operator<(const self_type &rhs) const
comparison operator (less than)
Definition jkqtpdatastorage.h:2252
bool operator>=(const self_type &rhs) const
comparison operator (larger than, or equal)
Definition jkqtpdatastorage.h:2293
const double & reference
Definition jkqtpdatastorage.h:2096
bool operator>(const self_type &rhs) const
comparison operator (larger than)
Definition jkqtpdatastorage.h:2279
JKQTPColumnConstIterator & operator=(const JKQTPColumnConstIterator &)=default
JKQTPColumnIterator nonconst_variant_type
Definition jkqtpdatastorage.h:2094
bool operator<=(const self_type &rhs) const
comparison operator (less than, or equal)
Definition jkqtpdatastorage.h:2266
bool isValid() const
checks the iterator for validity (i.e. points to an existing column and position is in a valid range)
Definition jkqtpdatastorage.h:2321
self_type operator+=(int inc)
Definition jkqtpdatastorage.h:2154
JKQTPColumnConstIterator(const nonconst_variant_type &rhs)
Definition jkqtpdatastorage.h:2105
self_type operator++(int)
Definition jkqtpdatastorage.h:2126
friend self_type operator+(difference_type off, const self_type &right)
Definition jkqtpdatastorage.h:2174
self_type operator++()
Definition jkqtpdatastorage.h:2131
bool operator!=(const self_type &rhs) const
comparison operator (unequals), inverse result of operator==()
Definition jkqtpdatastorage.h:2318
self_type operator+(difference_type rhs) const
Definition jkqtpdatastorage.h:2189
friend class JKQTPColumn
Definition jkqtpdatastorage.h:2359
const double * pointer
Definition jkqtpdatastorage.h:2098
self_type operator-(difference_type rhs) const
Definition jkqtpdatastorage.h:2199
JKQTPColumnConstIterator & operator=(JKQTPColumnConstIterator &&)=default
double value_type
Definition jkqtpdatastorage.h:2095
friend class JKQTPDatastore
Definition jkqtpdatastorage.h:2360
size_t getImageColumns() const
if the data in the column is interpreted as an image, this is the number of columns (x-dimension) of ...
Definition jkqtpdatastorage.h:2348
int getImagePositionY() const
returns the referenced position/row interpreted as an image pixel, y-component, returns -1 for an inv...
Definition jkqtpdatastorage.h:2342
int difference_type
Definition jkqtpdatastorage.h:2100
JKQTPColumnConstIterator(JKQTPColumnConstIterator &&)=default
int getImagePositionX() const
returns the referenced position/row interpreted as an image pixel, x-component, returns -1 for an inv...
Definition jkqtpdatastorage.h:2337
JKQTPColumnConstIterator(nonconst_variant_type &&rhs)
Definition jkqtpdatastorage.h:2106
QPoint getImagePosition() const
returns the referenced position/row interpreted as an image pixel, returns (-1,-1) for an invalid ope...
Definition jkqtpdatastorage.h:2332
int pos_
current row in col_ this iterator points to
Definition jkqtpdatastorage.h:2088
self_type operator--(int)
Definition jkqtpdatastorage.h:2135
self_type operator-=(int dec)
Definition jkqtpdatastorage.h:2163
bool operator==(const self_type &rhs) const
comparison operator (equals)
Definition jkqtpdatastorage.h:2306
reference const_reference
Definition jkqtpdatastorage.h:2097
int getPosition() const
returns the referenced position/row, or -1 for an invalid iterator
Definition jkqtpdatastorage.h:2327
JKQTPColumnConstIterator & operator=(const nonconst_variant_type &rhs)
Definition jkqtpdatastorage.h:2114
const JKQTPColumn * col_
references the column this iterator iterates over
Definition jkqtpdatastorage.h:2086
JKQTPColumnConstIterator(const JKQTPColumn *col, int startpos=0)
constructs an iterator for the data represented by col, starting with row startpos
Definition jkqtpdatastorage.h:2091
std::forward_iterator_tag iterator_category
Definition jkqtpdatastorage.h:2099
const JKQTPColumn * getColumn() const
returns the referenced column
Definition jkqtpdatastorage.h:2364
self_type operator--()
Definition jkqtpdatastorage.h:2145
reference operator[](difference_type off) const
Definition jkqtpdatastorage.h:2224
size_t getImageRows() const
if the data in the column is interpreted as an image, this is the number of rows (y-dimension) of the...
Definition jkqtpdatastorage.h:2354
JKQTPColumnConstIterator()
constructs an invalid iterator
Definition jkqtpdatastorage.h:2102
JKQTPColumnConstIterator self_type
Definition jkqtpdatastorage.h:2093
Manages one column of data. Data may either be stored internally as double* array or QVector<double> ...
Definition jkqtpdatastorage.h:1402
void setName(const QString &__value)
a name describing the column
JKQTPDatastore * datastore
pointer to the datastore object used to manage the data of the plot
Definition jkqtpdatastorage.h:1424
JKQTPColumn(JKQTPDatastore *datastore_, const QString &name_, QVector< double > &&data, size_t imageColumns_=1)
class constructor that fills the column with data from datavec_ (by move).
JKQTPColumnConstIterator const_iterator
Definition jkqtpdatastorage.h:1431
void eraseFromVectorColumn(size_t row)
removes the entry row
Definition jkqtpdatastorage.h:2450
StorageType storageType
specifies whether the datastore manages the memory (true , i.e. may also free the data) or whether th...
Definition jkqtpdatastorage.h:1419
void append(double val)
append value to the column, Possibly converts the column to a vector column, if necessary
Definition jkqtpdatastorage.h:1666
friend class JKQTPColumnConstIterator
Definition jkqtpdatastorage.h:1705
JKQTPColumn(JKQTPDatastore *datastore_=nullptr)
constructs an invalid column
JKQTPColumn & operator=(const JKQTPColumn &)=delete
size_t getImageColumns() const
number of image columns, if the data in this column is interpreted as a row-major image (e....
Definition jkqtpdatastorage.h:1487
quint16 calculateChecksum() const
calculates a checksum over the contents of the column (using qChecksum())
Definition jkqtpdatastorage.h:2422
void setValue(size_t n, double val)
sets the n'th value from the column
Definition jkqtpdatastorage.h:2402
void setAll(double value)
set all values in the column to a specific value
void copyData(QVector< double > ©To) const
copies the contained data into a QVector
JKQTPColumn(JKQTPDatastore *datastore_, const QString &name_, size_t imageColumns_=1)
class constructor that constructs a new empty vector column
void convertToVectorColumnFromRange(size_t start1, size_t end1)
if the column's data is \u not stored in an internal vector , this copies the data into a vector This...
JKQTPColumn(JKQTPDatastore *datastore_, const QString &name_, DataTransferMode transferMode, double *data_, size_t datasize_, size_t imageColumns_=1)
class constructor that binds the column to a specific array data_ (size datasize_ ) of externally man...
QVector< double > datavec
iif storageType is StorageType::Vector, the data is actually save here
Definition jkqtpdatastorage.h:1417
void scale(double factor)
scales all members of the column with the given factor
double getValue(size_t n) const
reads the n'th value from the column
Definition jkqtpdatastorage.h:2469
friend class JKQTPColumnIterator
Definition jkqtpdatastorage.h:1704
const JKQTPDatastore * getDatastore() const
Definition jkqtpdatastorage.h:1710
JKQTPColumn(JKQTPDatastore *datastore_, const QString &name_, const double *data_, size_t datasize_, size_t imageColumns_=1)
class constructor that creates a column, which is initialized by c copy of the array data_ (size data...
JKQTPDatastore * getDatastore()
Definition jkqtpdatastorage.h:1709
double * getPointer(size_t n=0)
gets a pointer to the n -th value in the column
Definition jkqtpdatastorage.h:1521
JKQTPColumnIterator iterator
Definition jkqtpdatastorage.h:1430
bool convertToVectorColumn()
if the column's data is \u not stored in an internal vector , this copies the data into a vector This...
void setImageColumns(size_t imageWidth)
number of image columns, if the data in this column is interpreted as a row-major image (e....
friend class JKQTPDatastore
Definition jkqtpdatastorage.h:1703
StorageType getStorageType() const
retrurnsthe storage type of the data in this column
Definition jkqtpdatastorage.h:1472
double & operator[](int n)
returns a reference to the n -th row in this column
Definition jkqtpdatastorage.h:2517
const double * getPointer(size_t n=0) const
gets a pointer to the n -th value in the column
Definition jkqtpdatastorage.h:1508
void incValue(size_t n, double increment=1.0)
increment the n'th value from the column
Definition jkqtpdatastorage.h:2412
void convertToVectorColumnFromRanges(size_t start1, size_t end1, size_t start2, size_t end2)
if the column's data is \u not stored in an internal vector, this copies the data into a vector This ...
bool valid
is this item valid/usable?
Definition jkqtpdatastorage.h:1428
DataTransferMode
Definition jkqtpdatastorage.h:1433
@ TransferOwnership
data is owned by the JKQTPColumn afterwards (and if necessary \C std::free() 's )
Definition jkqtpdatastorage.h:1434
@ CopyData
data is owned by the JKQTPColumn and internally managed as a QVector<double> which makes this data it...
Definition jkqtpdatastorage.h:1436
@ ExternallyOwned
data is referenced, but \u not owned by the JKQTPColumn afterwards
Definition jkqtpdatastorage.h:1435
iterator begin()
returns an iterator to the internal data
Definition jkqtpdatastorage.h:2430
JKQTPColumn(JKQTPDatastore *datastore_, const QString &name_, const QVector< double > &data, size_t imageColumns_=1)
class constructor that fills the column with data from datavec_ (by copy).
void clear()
clears the contents, frees any associated memory (if storageType==StorageType::Internal or storageTyp...
bool operator==(const JKQTPColumn &other) const
two columns are equal, if the same memory in the same datastore is referenced
size_t rows
number of rows in data
Definition jkqtpdatastorage.h:1415
JKQTPColumn(JKQTPDatastore *datastore_, const QString &name_, size_t rows, double initialVal=0.0, size_t imageColumns_=1)
class constructor that constructs a new vector column with rows rows that are all equal to initialVal
double * data
how data is represented in this JKQTPColumn
Definition jkqtpdatastorage.h:1413
QString name
a name describing the column
Definition jkqtpdatastorage.h:1426
double & at(int n)
returns a reference to the n -th row in this column (possibly throwing an exception if it does not ex...
Definition jkqtpdatastorage.h:2500
size_t getRows() const noexcept
returns the number of rows in this column (accesses the datastore)
Definition jkqtpdatastorage.h:1502
iterator end()
returns an iterator to the internal data
Definition jkqtpdatastorage.h:2435
bool isValid() const noexcept
return true if the column is valid i.e. is properly initialized
Definition jkqtpdatastorage.h:1492
double getPixelValue(size_t x, size_t y) const
returns the element at (x,y) in the column, where the data is interpreted as a row-major ordered Matr...
Definition jkqtpdatastorage.h:1636
void exchange(double value, double replace)
exchange every occurence of a given value by a replace value
void setPixelValue(size_t x, size_t y, double val)
sets the element at (x,y) in the column, where the data is interpreted as a row-major ordered Matrix ...
Definition jkqtpdatastorage.h:1627
JKQTPColumn & operator=(JKQTPColumn &&)
void subtract(double value)
subtracts a given value from all members of the column
JKQTPColumn(JKQTPColumn &&)
StorageType
Definition jkqtpdatastorage.h:1404
@ Vector
data is stored in the internal QVector<double> datavec
Definition jkqtpdatastorage.h:1407
@ Internal
data is stored in an internally managed (=owned) C-array
Definition jkqtpdatastorage.h:1406
@ External
data is stored in an externally managed (=not owned) C-array
Definition jkqtpdatastorage.h:1405
void push_back(double val)
append value to the column, Possibly converts the column to a vector column, if necessary
Definition jkqtpdatastorage.h:1671
QVector< double > copyData()
returns a QVector with the contained data (as a copy)
JKQTPColumn(const JKQTPColumn &)=delete
bool isVectorColumn() const
returns true if data is managed in a vector, i.e. operations like append are possible without copying...
Definition jkqtpdatastorage.h:1497
QString getName() const
a name describing the column
Definition jkqtpdatastorage.h:1479
void setPixelValue(size_t x, size_t y, size_t width, double val)
sets the element at (x,y) in the column, where the data is interpreted as a row-major ordered Matrix ...
Definition jkqtpdatastorage.h:1617
size_t imageColumns
number of image columns, if the data in this column is interpreted as a row-major image (e....
Definition jkqtpdatastorage.h:1422
void resize(size_t new_size, double added_vala=0.0)
resize the column to new_size (possibly filling with added_vala ), Possibly converts the column to a ...
Definition jkqtpdatastorage.h:1675
void decValue(size_t n, double decrement=1.0)
decrement the n'th value from the column
Definition jkqtpdatastorage.h:1601
size_t copy(const double *data, size_t N, size_t offset=0)
copy data from the given array into the column
iterator over the data in the column of a JKQTPDatastore
Definition jkqtpdatastorage.h:1767
friend class JKQTPColumnConstIterator
Definition jkqtpdatastorage.h:2017
size_t getImageRows() const
if the data in the column is interpreted as an image, this is the number of rows (y-dimension) of the...
Definition jkqtpdatastorage.h:2012
friend self_type operator-(difference_type off, const self_type &right)
Definition jkqtpdatastorage.h:1847
const JKQTPColumn * getColumn() const
returns the referenced column
Definition jkqtpdatastorage.h:2024
self_type operator++()
Definition jkqtpdatastorage.h:1796
self_type operator++(int)
Definition jkqtpdatastorage.h:1791
bool isValid() const
checks the iterator for validity (i.e. points to an existing column and position is in a valid range)
Definition jkqtpdatastorage.h:1979
bool operator>=(const self_type &rhs) const
comparison operator (larger than, or equal)
Definition jkqtpdatastorage.h:1970
bool operator!=(const self_type &rhs) const
comparison operator (unequals), inverse result of operator==()
Definition jkqtpdatastorage.h:1977
bool operator==(const self_type &rhs) const
comparison operator (equals)
Definition jkqtpdatastorage.h:1911
int difference_type
Definition jkqtpdatastorage.h:1784
bool operator<(const self_type &rhs) const
comparison operator (less than)
Definition jkqtpdatastorage.h:1929
JKQTPColumnIterator self_type
Definition jkqtpdatastorage.h:1777
JKQTPColumnIterator(const JKQTPColumnIterator &)=default
int getImagePositionX() const
returns the referenced position/row interpreted as an image pixel, x-component, returns -1 for an inv...
Definition jkqtpdatastorage.h:1995
self_type operator--(int)
Definition jkqtpdatastorage.h:1800
JKQTPColumnIterator(JKQTPColumn *col, int startpos=0)
constructs an iterator for the data represented by col, starting with row startpos
Definition jkqtpdatastorage.h:1775
self_type operator-=(int dec)
Definition jkqtpdatastorage.h:1828
self_type operator+(difference_type rhs) const
Definition jkqtpdatastorage.h:1854
friend self_type operator+(difference_type off, const self_type &right)
Definition jkqtpdatastorage.h:1839
JKQTPColumnIterator(JKQTPColumnIterator &&)=default
friend class JKQTPColumn
Definition jkqtpdatastorage.h:2018
reference operator*() const
dereferences the iterator, throws an exception if the iterator is invalid (see isValid() ) or the val...
Definition jkqtpdatastorage.h:1883
double * pointer
Definition jkqtpdatastorage.h:1782
JKQTPColumnConstIterator const_variant_type
Definition jkqtpdatastorage.h:1778
friend class JKQTPDatastore
Definition jkqtpdatastorage.h:2019
self_type operator-(difference_type rhs) const
Definition jkqtpdatastorage.h:1864
JKQTPColumn * col_
references the column this iterator iterates over
Definition jkqtpdatastorage.h:1770
QPoint getImagePosition() const
returns the referenced position/row interpreted as an image pixel, returns (-1,-1) for an invalid ope...
Definition jkqtpdatastorage.h:1990
int pos_
current row in col_ this iterator points to
Definition jkqtpdatastorage.h:1772
reference operator[](difference_type off) const
dereferences the iterator at offset off, throws an exception if the iterator is invalid (see isValid(...
Definition jkqtpdatastorage.h:1890
difference_type operator-(self_type rhs) const
Definition jkqtpdatastorage.h:1872
self_type operator+=(int inc)
Definition jkqtpdatastorage.h:1819
bool operator>(const self_type &rhs) const
comparison operator (larger than)
Definition jkqtpdatastorage.h:1956
JKQTPColumn * getColumn()
returns the referenced column
Definition jkqtpdatastorage.h:2022
JKQTPColumnIterator & operator=(JKQTPColumnIterator &&)=default
std::forward_iterator_tag iterator_category
Definition jkqtpdatastorage.h:1783
double & reference
Definition jkqtpdatastorage.h:1780
self_type operator--()
Definition jkqtpdatastorage.h:1810
double value_type
Definition jkqtpdatastorage.h:1779
JKQTPColumnIterator()
constructs an invalid iterator
Definition jkqtpdatastorage.h:1786
size_t getImageColumns() const
if the data in the column is interpreted as an image, this is the number of columns (x-dimension) of ...
Definition jkqtpdatastorage.h:2006
bool operator<=(const self_type &rhs) const
comparison operator (less than, or equal)
Definition jkqtpdatastorage.h:1943
int getImagePositionY() const
returns the referenced position/row interpreted as an image pixel, y-component, returns -1 for an inv...
Definition jkqtpdatastorage.h:2000
const double & const_reference
Definition jkqtpdatastorage.h:1781
JKQTPColumnIterator & operator=(const JKQTPColumnIterator &)=default
int getPosition() const
returns the referenced position/row, or -1 for an invalid iterator
Definition jkqtpdatastorage.h:1985
This class manages data columns (with entries of type double ), used by JKQTPlotter/JKQTBasePlotter t...
Definition jkqtpdatastorage.h:223
size_t addColumn(size_t rows, const QString &name=QString(""), double initVal=0.0)
add a new columns with rows rows to the datastore and return its column ID. The new column uses inter...
size_t addCalculatedImageColumn(size_t cols, size_t rows, const std::function< double(size_t, size_t)> &f, const QString &name=QString(""))
add an image column with width cols and height rows (i.e. rows * cols entries), that is calculated by...
JKQTPDatastore()
class constructor, generates an empty datastore
QList< size_t > getColumnIDs() const
returns a list with all available column IDs
Definition jkqtpdatastorage.h:1283
bool isColumnDataExternal(int column) const
returns true, if the data in the column column is internally managed
void appendFromContainerToColumn(size_t column, const TContainer &values)
adds a values in container values to the column column. This changes the column length (number of row...
Definition jkqtpdatastorage.h:2598
QString getColumnName(size_t column)
return the title of the first column with the given name, or -1 if none was found
size_t getRows(size_t column) const
returns the number of rows in the column column
Definition jkqtpdatastorage.h:2524
JKQTPColumnConstIterator cbegin(size_t i) const
returns a const iterator to the first data entry in the i -th column in the JKQTPDatastore
void eraseFromColumn(JKQTPColumnConstIterator pos)
removes the entry pos
QMap< size_t, std::shared_ptr< JKQTPColumn > >::const_iterator ConstColumnIterator
constant iterator for columns in the JKQTPDatastore (ColumnIterator::first: column number,...
Definition jkqtpdatastorage.h:247
size_t addImageColumn(double *data, size_t width, size_t height, const QString &name=QString(""))
add one external column to the datastore. It contains width * height rows. This returns its logical c...
int getNextLowerIndex(size_t column, size_t row, int start, int end) const
gets the index of the datapoint with the nearest, but lower value in the column (in a given inclusive...
void deleteAllPrefixedColumns(QString prefix)
delete all columns where the name starts with a given prefix
void saveSYLK(const QString &filename, const QSet< int > &userColumns=QSet< int >(), const QString &floatformat=QString("%10.10lf")) const
save contents of datastore as SYLK file (SYmbolic LinK)
const double * getColumnPointer(size_t column, size_t row=0) const
returns a pointer to the data in column column, starting ar row row
Definition jkqtpdatastorage.h:2549
QMap< size_t, std::shared_ptr< JKQTPColumn > > columns
a std::vector of all columns that may be used to access the managed chunks of memory.
Definition jkqtpdatastorage.h:226
std::pair< size_t, size_t > addCopiedPoints(const std::list< QPoint > &points, const QString &namex=QString(""), const QString &namey=QString(""))
int ensureColumnNum(const QString &name)
return the num of the first column with the given name, if none was found this creates a new column w...
JKQTPColumnBackInserter backInserter(int i)
returns a back-inserter iterator (JKQTPColumnBackInserter) to the i -th column in the JKQTPDatastore
int getNextLowerIndex(size_t column, size_t row) const
gets the index of the datapoint with the nearest, but lower value in the column
bool isColumnDataInternal(int column) const
returns true, if the data in the column column is internally managed
Definition jkqtpdatastorage.h:367
friend class JKQTPDatastoreModel
Definition jkqtpdatastorage.h:1387
QMap< size_t, std::shared_ptr< JKQTPColumn > >::iterator ColumnIterator
mutable iterator for columns in the JKQTPDatastore (ColumnIterator::first: column number,...
Definition jkqtpdatastorage.h:245
size_t addColumn(double *data, size_t rows, const QString &name=QString(""))
add one external column to the datastore. It contains rows rows. This returns its logical column ID....
size_t addCopiedColumnMasked(const TContainer &data, const TContainerMask &mask, const QString &name=QString(""), bool useIfMaskEquals=false)
add one external column to the datastore. It will be filled with the contents of vector data.
Definition jkqtpdatastorage.h:1075
JKQTPColumnConstIterator end(int i) const
returns a const iterator behind the last data entry data in the i -th column in the JKQTPDatastore
JKQTPColumnConstIterator begin(int i) const
returns a const iterator to the first data entry in the i -th column in the JKQTPDatastore
void setColumnData(size_t toColumn, const QVector< double > &data)
copies the data from data into an existing column toColumn
void saveDIF(const QString &filename, const QSet< int > &userColumns=QSet< int >(), const QString &floatformat=QString("%10.10lf")) const
save contents of datastore as DIF file (data interchange format)
void appendToColumn(size_t column, double value)
adds a value value to the column column. This changes the column length (number of rows).
size_t addImageColumn(size_t width, size_t height, const QString &name=QString(""))
add a new columns with width * height rows to the datastore and return its column ID....
size_t addCopiedColumn(TIterator first, TIterator last, const QString &name=QString(""))
add one column to the datastore. It will be filled with the values from first ... last
Definition jkqtpdatastorage.h:812
void saveCSV(QTextStream &txt, const QSet< int > &userColumns=QSet< int >(), const QString &separator=QString(", "), const QString &decimal_separator=QString("."), const QString &comment=QString("#"), const QString &aroundStrings=QString(""), char floatformat='g') const
save contents of datastore as Comma Separated Values (CSV) file
JKQTPColumnIterator begin(size_t i)
returns an iterator to the first data entry in the i -th column in the JKQTPDatastore
std::shared_ptr< JKQTPColumn > m_invalidColumn
an internal invalid column object, used e.g. to return invalid column iterators
Definition jkqtpdatastorage.h:231
void set(size_t column, size_t row, double value)
sets the value at position (column, row). column is the logical column and will be mapped to the acco...
Definition jkqtpdatastorage.h:2586
JKQTPColumnBackInserter backInserter(size_t i)
returns a back-inserter iterator (JKQTPColumnBackInserter) to the i -th column in the JKQTPDatastore
void dec(size_t column, size_t row, double decrement=1)
decrements entry in row row of column column by decrement
Definition jkqtpdatastorage.h:2642
~JKQTPDatastore()
class destructor, destroys all subordered JKQTPColumn objects and frees all owned memory
size_t addCopiedColumn(const T *data, size_t rows, size_t stride, const QString &name)
copy an external column to the datastore. It contains rows rows. The external data is copied to an in...
Definition jkqtpdatastorage.h:968
std::pair< size_t, size_t > addCopiedPoints(const std::list< QPointF > &points, const QString &namex=QString(""), const QString &namey=QString(""))
size_t addCopiedImageAsColumnTranspose(const T *data, size_t width, size_t height, const QString &name=QString(""), size_t stride=1, size_t start=0)
add a new column to the datastore, which is filled from the transposed column-major array data with t...
Definition jkqtpdatastorage.h:2667
void saveMatlab(QTextStream &txt, const QSet< int > &userColumns=QSet< int >()) const
save contents of datastore as a Matlab script
size_t maxColumnsID
internal variable to keep track about the highest column ID (in columns) used so far
Definition jkqtpdatastorage.h:237
size_t getColumnCount() const
returns the number of (logical) columns currently managed by the datastore
Definition jkqtpdatastorage.h:1280
void setColumnCopiedImageData(size_t toColumn, const double *data, size_t width, size_t height)
copies the image data from data into an existing column toColumn
double getPixel(size_t column, size_t x, size_t y) const
returns the value at position (x, y) in the column-th column, which is interpreted with the imageWidt...
Definition jkqtpdatastorage.h:2614
size_t addCopiedColumn(const T *data, size_t rows, size_t stride, int start, const QString &name)
copy an external column to the datastore. It contains rows rows. The external data is copied to an in...
Definition jkqtpdatastorage.h:936
JKQTPColumnConstIterator cend(size_t i) const
returns a const iterator behind the last data entry data in the i -th column in the JKQTPDatastore
bool isColumnDataInternal(size_t column) const
returns true, if the data in the column column is internally managed
Definition jkqtpdatastorage.h:363
bool hasColumn(size_t i) const
determines whether a column with the given ID exists
size_t addCopiedImageAsColumn(const T *data, size_t width, size_t height, const QString &name=QString(""), size_t stride=1, size_t start=0)
add one external column to the datastore. It contains width * height rows. The external data is assum...
Definition jkqtpdatastorage.h:2650
size_t addLinearColumn(size_t rows, double start, double end, const QString &name=QString(""))
add a column to the datastore that contains rows rows with monotonely increasing value starting at st...
size_t addCopiedColumnMasked(const T *data, const bool *mask, size_t rows, const QString &name=QString(""), bool useIfMaskEquals=false)
add one external column to the datastore. It contains rows rows. The external data is copied to an in...
Definition jkqtpdatastorage.h:1038
std::pair< size_t, size_t > addCopiedPoints(const QList< QPoint > &points, const QString &namex=QString(""), const QString &namey=QString(""))
size_t addInternalColumn(double *data, size_t rows, const QString &name)
add a column with rows entries from the array data, ownership of the memory behind data is transfered...
size_t addColumnCalculatedFromColumn(size_t otherColumn, const std::function< double(double)> &f, const QString &name=QString(""))
Definition jkqtpdatastorage.h:1256
void resizeColumn(size_t column, size_t new_rows)
resizes the column column to have new_rows rows
void inc(size_t column, size_t row, double increment=1)
increases entry in row row of column column by increment
Definition jkqtpdatastorage.h:2636
size_t addCopiedColumn(QVector< double > &&data, const QString &name)
add a column with data from data, ownership of the memory behind data is transfered to the datastore
Definition jkqtpdatastorage.h:686
size_t addColumn(QVector< double > &&data, const QString &name)
add a column with data from data, ownership of the memory behind data is transfered to the datastore
Definition jkqtpdatastorage.h:675
QVector< double > getData(size_t column, QString *columnName=nullptr) const
return contents of a given column as QVector<double>
size_t addCopiedColumn(const T *data, size_t rows, const QString &name=QString(""))
copy an external column to the datastore. It contains rows rows. The external data is copied to an in...
Definition jkqtpdatastorage.h:904
ColumnIterator begin()
returns an iterator to the first column in the JKQTPDatastore
Definition jkqtpdatastorage.h:250
bool isColumnDataExternal(size_t column) const
returns true, if the data in the column column is internally managed
friend class JKQTPColumn
Definition jkqtpdatastorage.h:1386
int getNextHigherIndex(int column, size_t row, int start, int end) const
gets the index of the datapoint with the nearest, but higher value in the column (in a given inclusiv...
JKQTPColumnConstIterator begin(size_t i) const
returns a const iterator to the first data entry in the i -th column in the JKQTPDatastore
std::pair< size_t, size_t > addCopiedMap(TIterator first, TIterator last, const QString &nameKey=QString("map_key"), const QString &nameValue=QString("map_value"))
copies the contents of the map-like container c into two columns of the datastore,...
Definition jkqtpdatastorage.h:1120
size_t addDecadeLogColumn(size_t rows, double startDecade, double endDecade, const QString &name=QString(""))
add a column to the datastore that contains rows rows with monotonely increasing value starting at 10...
void scaleColumnValues(size_t column, double factor)
scales (multiplies) all entries in column column by factor
Definition jkqtpdatastorage.h:2630
size_t getColumnImageHeight(int column) const
returns the height of the image, represented by column (in row-major ordering)
size_t getMaxRows() const
returns the maximum number of rows in all columns
void convertToVectorColumn(size_t column)
converts datastoreage of column column to an internally managed vector (with vector coulmns,...
size_t addCalculatedColumnFromColumn(const std::pair< size_t, size_t > &otherColumn, const std::function< double(double, double)> &f, const QString &name=QString(""))
Definition jkqtpdatastorage.h:1275
JKQTPColumnIterator end(int i)
returns an iterator behind the last data entry data in the i -th column in the JKQTPDatastore
size_t addCalculatedColumn(size_t rows, const std::function< double(size_t, JKQTPDatastore *)> &f, const QString &name=QString(""))
add a column with rows entries, that is calculated by calling f for each entry
size_t addInternalColumn(QVector< double > &&data, const QString &name)
add a column with data from data, ownership of the memory behind data is transfered to the datastore
void clear()
deletes all items from the datastore and possibly frees the memory they manage
JKQTPColumnIterator begin(int i)
returns an iterator to the first data entry in the i -th column in the JKQTPDatastore
int getNextHigherIndex(size_t column, size_t row) const
gets the index of the datapoint with the nearest, but higher value in the column
QList< QVector< double > > getData(QStringList *columnNames=nullptr, const QSet< int > &userColumns=QSet< int >()) const
return contents of datastore as QList<QVector<double> >, i.e. a list of column-vectors
QStringList getColumnNames() const
return a list with all columns available in the datastore
int getNextLowerIndex(int column, size_t row) const
gets the index of the datapoint with the nearest, but lower value in the column
void eraseFromColumn(JKQTPColumnConstIterator pos, JKQTPColumnConstIterator posEnd)
removes the entries pos to posEnd
QVector< int > getColumnIDsIntVec() const
returns a list with all available column IDs
void deleteColumn(size_t column)
delete the given column
std::pair< size_t, size_t > addCopiedPoints(const std::vector< QPointF > &points, const QString &namex=QString(""), const QString &namey=QString(""))
void appendToColumns(size_t columnX, size_t columnY, const QPoint &value)
adds a the x-coordinate of value to the column columnX and the y-coordinate to columnY.
JKQTPColumnIterator end(size_t i)
returns an iterator behind the last data entry data in the i -th column in the JKQTPDatastore
ConstColumnIterator cend() const
returns a const iterator behind the last column in the JKQTPDatastore
Definition jkqtpdatastorage.h:260
std::pair< size_t, size_t > addCopiedPoints(const std::vector< QPoint > &points, const QString &namex=QString(""), const QString &namey=QString(""))
JKQTPColumnConstIterator cend(int i) const
returns a const iterator behind the last data entry data in the i -th column in the JKQTPDatastore
std::pair< size_t, size_t > addLinearGridColumns(size_t width, double startX, double endX, size_t height, double startY, double endY, const QString &nameX=QString(""), const QString &nameY=QString(""))
add two columns to the datastore that contains the x- and y- coordinates of a rectangular grid with w...
void resizeImageColumn(size_t column, size_t new_image_width, size_t new_image_height)
resizes the column column to have enough rows to be interpreted as an image of size new_image_width *...
size_t addCalculatedColumn(size_t rows, const std::function< double(size_t)> &f, const QString &name=QString(""))
add a column with rows entries, that is calculated by calling f for each entry
void appendToColumns(size_t column1, size_t column2, size_t column3, size_t column4, double value1, double value2, double value3, double value4)
adds a value value1 to the column column1, a value value2 to column2, etc.
ColumnIterator end()
returns an iterator behind the last column in the JKQTPDatastore
Definition jkqtpdatastorage.h:252
void appendToColumns(size_t column1, size_t column2, size_t column3, double value1, double value2, double value3)
adds a value value1 to the column column1, a value value2 to column2, etc.
bool isVectorColumn(size_t column) const
returns true, if the data in the column column is internally managed as a vector (with vector coulmns...
int getNextLowerIndex(int column, size_t row, int start, int end) const
gets the index of the datapoint with the nearest, but lower value in the column (in a given inclusive...
void setColumnCopiedData(size_t toColumn, const double *data, size_t N)
copies the data from data into an existing column toColumn
void setAll(size_t column, double value)
sets all entries in column column to value
Definition jkqtpdatastorage.h:2624
void appendToColumns(size_t column1, size_t column2, size_t column3, size_t column4, size_t column5, double value1, double value2, double value3, double value4, double value5)
adds a value value1 to the column column1, a value value2 to column2, etc.
ConstColumnIterator cbegin() const
returns a const iterator to the first column in the JKQTPDatastore
Definition jkqtpdatastorage.h:258
size_t addCopiedColumn(const TContainer &data, const QString &name, size_t stride, size_t start=0)
add one external column to the datastore. It will be filled with the contents of vector data.
Definition jkqtpdatastorage.h:876
JKQTPColumnConstIterator end(size_t i) const
returns a const iterator behind the last data entry data in the i -th column in the JKQTPDatastore
size_t getColumnImageWidth(int column) const
returns the width of the image, represented by column (in row-major ordering). Internally this return...
void setPixel(size_t column, size_t x, size_t y, double value)
returns the value at position (x, y) in the column-th column, which is interpreted with the imageWidt...
Definition jkqtpdatastorage.h:2619
size_t addColumnCalculatedFromColumn(size_t otherColumnX, size_t otherColumnY, const std::function< double(double, double)> &f, const QString &name=QString(""))
Definition jkqtpdatastorage.h:1272
std::pair< size_t, size_t > addCopiedMap(const TContainer &c, const QString &nameKey=QString("map_key"), const QString &nameValue=QString("map_value"))
copies the contents of the map-like container c into two columns of the datastore,...
Definition jkqtpdatastorage.h:1158
void copyColumnData(size_t toColumn, size_t fromColumn)
copies the data from fromColumn into an existing column toColumn
size_t addInternalImageColumn(double *data, size_t width, size_t height, const QString &name)
add a column with width * height entries from the array data, ownership of the memory behind data is ...
ConstColumnIterator end() const
returns a const iterator behind the last column in the JKQTPDatastore
Definition jkqtpdatastorage.h:256
size_t addCalculatedColumnFromColumn(size_t otherColumnX, size_t otherColumnY, const std::function< double(double, double)> &f, const QString &name=QString(""))
add a column with the same number of entries, as in the other column otherColumn ,...
void setColumnImageWidth(size_t column, size_t imageWidth)
sets the width of the image, represented by column (in row-major ordering) to imageWidth
void saveMatlab(const QString &filename, const QSet< int > &userColumns=QSet< int >()) const
save contents of datastore as a Matlab script
bool isVectorColumn(int column) const
returns true, if the data in the column column is internally managed as a vector (with vector coulmns...
size_t addColumn(JKQTPColumn &&col)
add a new column to the datastore and return its ID
size_t copyColumn(size_t old_column, const QString &name=QString(""))
copies the given old_column into a new one
void appendToColumns(size_t column1, size_t column2, double value1, double value2)
adds a value value1 to the column column1 and a value value2 to column2.
void convertToVectorColumn(int column)
converts datastoreage of column column to an internally managed vector (with vector coulmns,...
size_t addCalculatedColumnFromColumn(size_t otherColumn, const std::function< double(double)> &f, const QString &name=QString(""))
add a column with the same number of entries, as in the other column otherColumn ,...
void appendToColumns(size_t columnX, size_t columnY, const QPointF &value)
adds a the x-coordinate of value to the column columnX and the y-coordinate to columnY.
quint16 getColumnChecksum(int column) const
returns the data checksum of the given column column
void setColumnImageHeight(size_t column, size_t imageHeight)
sets the height of the image, represented by column (in row-major ordering) to imageHeight
void deleteAllColumns(const QString &name)
delete all columns with the given name
int getNextHigherIndex(size_t column, size_t row, int start, int end) const
gets the index of the datapoint with the nearest, but higher value in the column (in a given inclusiv...
size_t addColumn(const QString &name=QString(""))
add a new and empty column to the datastore and return its column ID. The new item uses internal memo...
int getColumnNum(const QString &name)
return the num of the first column with the given name, or -1 if none was found
std::pair< size_t, size_t > addCopiedPoints(const QList< QPointF > &points, const QString &namex=QString(""), const QString &namey=QString(""))
add two columns to the datastore. They will be filled with the values from points (first column: x-va...
ConstColumnIterator begin() const
returns a const iterator to the first column in the JKQTPDatastore
Definition jkqtpdatastorage.h:254
JKQTPColumnConstIterator cbegin(int i) const
returns a const iterator to the first data entry in the i -th column in the JKQTPDatastore
double get(size_t column, size_t row) const
returns the value at position (column, row). column is the logical column and will be mapped to the a...
Definition jkqtpdatastorage.h:2561
void saveCSV(const QString &filename, const QSet< int > &userColumns=QSet< int >(), const QString &separator=QString(", "), const QString &decimal_separator=QString("."), const QString &comment=QString("#"), const QString &aroundStrings=QString(""), char floatformat='g') const
save contents of datastore as Comma Separated Values (CSV) file
size_t copyColumn(size_t old_column, size_t start, size_t stride, const QString &name=QString(""))
copies the given old_column into a new one, reading the data with the given start column and stride
size_t addCopiedColumn(const TContainer &data, const QString &name=QString(""))
add one external column to the datastore. It will be filled with the contents of vector data.
Definition jkqtpdatastorage.h:849
int getNextHigherIndex(int column, size_t row) const
gets the index of the datapoint with the nearest, but higher value in the column
size_t addLogColumn(size_t rows, double start, double end, const QString &name=QString(""))
add a column to the datastore that contains rows rows with monotonely increasing value starting at st...
QAbstractTableModel descendent that allows to view data in a JKQTPDatastore.
Definition jkqtpdatastorage.h:2376
virtual Qt::ItemFlags flags(const QModelIndex &index) const override
JKQTPDatastore * datastore
Definition jkqtpdatastorage.h:2393
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const override
JKQTPDatastoreModel(JKQTPDatastore *datastore, QObject *parent=nullptr)
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
virtual QVariant data(const QModelIndex &index, int role) const override
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const override
virtual ~JKQTPDatastoreModel() override
#define JKQTPLOTTER_LIB_EXPORT
Definition jkqtplotter_imexport.h:89