JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches

This class manages data columns (with entries of type double ), used by JKQTPlotter/JKQTBasePlotter to represent data for plots. More...

#include <jkqtpdatastorage.h>

Collaboration diagram for JKQTPDatastore:
[legend]

Public Member Functions

 JKQTPDatastore ()
 class constructor, generates an empty datastore
 
 ~JKQTPDatastore ()
 class destructor, destroys all subordered JKQTPDatastoreItem objects
 
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
 
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 addCalculatedColumnFromColumn (const std::pair< size_t, size_t > &otherColumn, const std::function< double(double, double)> &f, const QString &name=QString(""))
 
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 , that are calculated by calling f for each entry in otherColumn
 
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 , that are calculated by calling f for each pair of entries in otherColumnX and otherColumnY
 
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 calling f for each entry
 
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 memory management.
 
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. Data is not owned by the JKQTPDatastore!
 
size_t addColumn (size_t rows, const QString &name=QString(""))
 add a new columns with rows rows to the datastore and return its column ID. The new item uses internal memory management.
 
size_t addColumnCalculatedFromColumn (size_t otherColumn, const std::function< double(double)> &f, const QString &name=QString(""))
 
size_t addColumnCalculatedFromColumn (size_t otherColumnX, size_t otherColumnY, const std::function< double(double, double)> &f, const QString &name=QString(""))
 
template<typename T >
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 internal array, so afterwards you can delete the external arrayThis returns its logical column ID.
 
template<typename T >
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 internal array, so afterwards you can delete the external arrayThis returns its logical column ID.
 
template<typename T >
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 internal array, so afterwards you can delete the external arrayThis returns its logical column ID.
 
template<typename TContainer >
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.
 
template<typename TContainer >
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.
 
template<typename TIterator >
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
 
template<typename T >
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 internal array, so afterwards you can delete the external arrayThis returns its logical column ID.
 
template<typename TContainer , typename TContainerMask >
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.
 
template<typename T >
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 assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so afterwards you can delete the external arrayThis returns its logical column ID.
 
template<typename TContainer >
size_t addCopiedImageAsColumn (const TContainer &data, size_t width, const QString &name=QString(""))
 add one external column to the datastore. It contains width * height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so afterwards you can delete the external arrayThis returns its logical column ID.
 
template<typename T >
size_t addCopiedImageAsColumnTranspose (const QVector< T > &data, size_t width, const QString &name=QString(""))
 add one external column to the datastore. It contains width * height rows.
 
template<typename T >
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 the given width and height.
 
template<typename TContainer >
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, returns the two IDs of the items as a std::pair
 
template<typename TIterator >
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, returns the two IDs of the items as a std::pair
 
std::pair< size_t, size_t > addCopiedPoints (const QList< QPoint > &points, const QString &namex=QString(""), const QString &namey=QString(""))
 
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-value, second column: y-value)
 
std::pair< size_t, size_t > addCopiedPoints (const std::list< QPoint > &points, const QString &namex=QString(""), const QString &namey=QString(""))
 
std::pair< size_t, size_t > addCopiedPoints (const std::list< QPointF > &points, const QString &namex=QString(""), const QString &namey=QString(""))
 
std::pair< size_t, size_t > addCopiedPoints (const std::vector< QPoint > &points, const QString &namex=QString(""), const QString &namey=QString(""))
 
std::pair< size_t, size_t > addCopiedPoints (const std::vector< QPointF > &points, const QString &namex=QString(""), const QString &namey=QString(""))
 
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^start and ending at 10^end. the values are logarithmically spaced between 10^start end 10^end
 
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 column ID. Data is not owned by the JKQTPDatastore! The column is meant to represent an image in row-major order with x-dimention width and y-dimension height .
 
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. The new item uses internal memory management. The column is meant to represent an image in row-major order with x-dimention width and y-dimension height .
 
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 to the datastore
 
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 transfered to the datastore The column is meant to represent an image in row-major order with x-dimention width and y-dimension height .
 
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 start and ending at end. the values are equidistant between start end end
 
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 width points in x- and height points in y-direction.
 
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 start and ending at end. the values are logarithmically spaced between start end end
 
template<class TContainer >
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 rows). If the memory was externally managed before, it will be internally managed afterwards
 
void appendToColumn (size_t column, double value)
 adds a value value to the column column. This changes the column length (number of rows).
 
template<class TIterator >
void appendToColumn (size_t column, TIterator first, TIterator last)
 adds a values from a range first ... last (defined by C++ iterators) to the column column. This changes the column length (number of rows). If the memory was externally managed before, it will be internally managed afterwards
 
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 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.
 
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.
 
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.
 
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.
 
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.
 
JKQTPColumnBackInserter backInserter (int i)
 returns a back-inserter iterator (JKQTPColumnBackInserter) to the i -th column in the JKQTPDatastore
 
JKQTPColumnBackInserter backInserter (size_t i)
 returns a back-inserter iterator (JKQTPColumnBackInserter) to the i -th column in the JKQTPDatastore
 
JKQTPColumnIterator begin (int i)
 returns an iterator to the first data entry 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
 
JKQTPColumnIterator begin (size_t i)
 returns an iterator to the first data entry in the i -th column in the JKQTPDatastore
 
JKQTPColumnConstIterator begin (size_t i) const
 returns a const iterator to the first data entry in the i -th column in the JKQTPDatastore
 
void clear ()
 deletes all items from the datastore and possibly frees the memory they manage
 
size_t copyColumn (size_t old_column, const QString &name=QString(""))
 copies the given old_column into a new one
 
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
 
void copyColumnData (size_t toColumn, size_t fromColumn)
 copies the data from fromColumn into an existing column toColumn
 
void dec (size_t column, size_t row, double decrement=1)
 decrements entry in row row of column column by decrement
 
void deleteAllColumns (const QString &name, bool removeItems=true)
 delete all columns with the given name, if no other columns points to the datastore item of the column and removeItems is true, the item will be removed
 
void deleteAllPrefixedColumns (QString prefix, bool removeItems=true)
 delete all columns where the name starts with a given prefix, if no other columns points to the datastore item of the column and removeItems is true, the item will be removed
 
void deleteColumn (size_t column, bool removeItems=true)
 delete the given column, if no other columns points to the datastore item of the column and removeItems is true, the item will be removed
 
JKQTPColumnIterator end (int i)
 returns an iterator behind the last data entry data in the i -th column in the JKQTPDatastore
 
JKQTPColumnConstIterator end (int i) const
 returns a const iterator behind the last data entry data in the i -th column in the JKQTPDatastore
 
JKQTPColumnIterator end (size_t i)
 returns an iterator behind the last data entry data in the i -th column in the JKQTPDatastore
 
JKQTPColumnConstIterator end (size_t i) const
 returns a const iterator behind the last data entry data in the i -th column in the JKQTPDatastore
 
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 with no rows and returns its num
 
void eraseFromColumn (const JKQTPColumnConstIterator &pos)
 removes the entry pos
 
void eraseFromColumn (const JKQTPColumnConstIterator &pos, const JKQTPColumnConstIterator &posEnd)
 removes the entries pos to posEnd
 
void eraseFromColumn (const JKQTPColumnIterator &pos)
 removes the entry pos
 
void eraseFromColumn (const JKQTPColumnIterator &pos, const JKQTPColumnIterator &posEnd)
 removes the entries pos to posEnd
 
double get (int column, int row) const
 returns the value at position (column, row). column is the logical column and will be mapped to the according memory block internally!)

 
double get (int column, size_t row) const
 returns the value at position (column, row). column is the logical column and will be mapped to the according memory block internally!)

 
double get (size_t column, int row) const
 returns the value at position (column, row). column is the logical column and will be mapped to the according memory block internally!)

 
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 according memory block internally!)

 
quint16 getColumnChecksum (int column) const
 returns the data checksum of the given column
 
size_t getColumnCount () const
 returns the number of (logical) columns currently managed by the datastore
 
QList< size_t > getColumnIDs () const
 returns a list with all available column IDs
 
QVector< int > getColumnIDsIntVec () const
 returns a list with all available column IDs
 
size_t getColumnImageHeight (int column) const
 returns the height of the image, represented by column (in row-major ordering)
 
size_t getColumnImageWidth (int column) const
 returns the width of the image, represented by column (in row-major ordering). Internally this returns the imageColumns or image width, if set in the column
 
QString getColumnName (size_t column)
 return the title of the first column with the given name, or -1 if none was found
 
QStringList getColumnNames () const
 return a list with all columns available in the datastore
 
int getColumnNum (const QString &name)
 return the num of the first column with the given name, or -1 if none was found
 
double * getColumnPointer (int column, size_t row=0)
 returns a pointer to the data in column column, starting ar row row
 
const double * getColumnPointer (int column, size_t row=0) const
 returns a pointer to the data in column column, starting ar row row
 
double * getColumnPointer (size_t column, size_t row=0)
 returns a pointer to the data in column column, starting ar row row
 
const double * getColumnPointer (size_t column, size_t row=0) const
 returns a pointer to the data in column column, starting ar row row
 
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
 
QVector< double > getData (size_t column, QString *columnName=nullptr) const
 return contents of a given column as QVector<double>
 
size_t getMaxRows () const
 returns the maximum number of rows in all columns
 
int getNextHigherIndex (int column, size_t row) const
 gets the index of the datapoint with the nearest, but higher value in the column
 
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 inclusive row range [start ... end] values of -1 for the ranges are "wildcards", i.e. start/end of column)
 
int getNextHigherIndex (size_t column, size_t row) const
 gets the index of the datapoint with the nearest, but higher value in the column
 
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 inclusive row range [start ... end] values of -1 for the ranges are "wildcards", i.e. start/end of column)
 
int getNextLowerIndex (int column, size_t row) const
 gets the index of the datapoint with the nearest, but lower value in the column
 
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 row range [start ... end] values of -1 for the ranges are "wildcards", i.e. start/end of column)
 
int getNextLowerIndex (size_t column, size_t row) const
 gets the index of the datapoint with the nearest, but lower value in the column
 
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 row range [start ... end] values of -1 for the ranges are "wildcards", i.e. start/end of column)
 
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 imageWidth stored in that column

 
size_t getRows (int column) const
 returns the number of rows in the column column
 
size_t getRows (size_t column) const
 returns the number of rows in the column column
 
bool hasColumn (size_t i) const
 determines whether a column with the given ID exists
 
void inc (size_t column, size_t row, double increment=1)
 increases entry in row row of column column by increment
 
void resizeColumn (size_t column, size_t new_rows)
 resizes the column column to have new_rows rows
 
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 * new_image_height pixels, also sets the internally store image size in the column!
 
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
 
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
 
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 saveMatlab (const QString &filename, const QSet< int > &userColumns=QSet< int >()) const
 save contents of datastore as a Matlab script
 
void saveMatlab (QTextStream &txt, const QSet< int > &userColumns=QSet< int >()) const
 save contents of datastore as a Matlab script
 
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)
 
void scaleColumnValues (size_t column, double factor)
 scales (multiplies) all entries in column column by factor
 
void set (int column, size_t row, double value)
 sets the value at position (column, row). column is the logical column and will be mapped to the according memory block internally!)
 
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 according memory block internally!)
 
void setAll (size_t column, double value)
 sets all entries in column column to value
 
void setColumnCopiedData (size_t toColumn, const double *data, size_t N)
 copies the data from data into an existing column toColumn
 
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
 
void setColumnData (size_t toColumn, const QVector< double > &data)
 copies the data from data into an existing column toColumn
 
void setColumnImageHeight (size_t column, size_t imageHeight)
 sets the height of the image, represented by column (in row-major ordering) to imageHeight
 
void setColumnImageWidth (size_t column, size_t imageWidth)
 sets the width of the image, represented by column (in row-major ordering) to imageWidth
 
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 imageWidth stored in that column

 

Protected Types

typedef QMap< size_t, JKQTPColumn >::iterator ColumnIterator
 mutable iterator for columns in the JKQTPDatastore (ColumnIterator::first: column number, ColumnIterator::second: column data)
 
typedef QMap< size_t, JKQTPColumn >::const_iterator ConstColumnIterator
 constant iterator for columns in the JKQTPDatastore (ColumnIterator::first: column number, ColumnIterator::second: column data)
 

Protected Member Functions

size_t addColumn (JKQTPColumn col)
 add a new column to the datastore and return its ID
 
size_t addColumnForItem (size_t itemID, size_t columnInItem, const QString &name=QString(""))
 add a new columns which references a specified item and a specified column therein.
 
size_t addCopiedItem (const double *data, size_t rows)
 add one external column to the datastore. It contains rows rows. The data is copied and the copy managed internally This function retuns an item ID (which can be used with getItem() ), not a column ID!
 
size_t addCopiedItem (JKQTPDatastoreItemFormat dataformat, double *data, size_t columns, size_t rows)
 add one external data block to the datastore. It contains rows rows and columns columns. The data is copied and the copy managed internally This function retuns an item ID (which can be used with getItem() ), not a column ID!
 
size_t addInternalItem (double *data, size_t rows)
 add one internal column to the datastore. It contains rows rows. This function retuns an item ID (which can be used with getItem() ), not a column ID!
 
size_t addItem (double *data, size_t rows)
 add one external column to the datastore. It contains rows rows. This function retuns an item ID (which can be used with getItem() ), not a column ID!
 
size_t addItem (JKQTPDatastoreItem *item)
 add a new item to the datastore and return its ID This function retuns an item ID (which can be used with getItem() ), not a column ID!
 
size_t addItem (JKQTPDatastoreItemFormat dataformat, double *data, size_t columns, size_t rows)
 add an external memory block to the datastore. It contains rows rows and columns columns. dataformat determined the memory layout. This function retuns an item ID (which can be used with getItem() ), not a column ID!
 
size_t addItem (size_t columns, size_t rows)
 add a new item with rows rows and columns columns to the datastore and return its ID. The item uses internal memory management. This function retuns an item ID (which can be used with getItem() ), not a column ID!
 
size_t addItem (size_t rows)
 add a new columns/item with rows rows to the datastore and return its ID. The item uses internal memory management. This function retuns an item ID (which can be used with getItem() ), not a column ID!
 
ColumnIterator begin ()
 returns an iterator to the first column in the JKQTPDatastore
 
ConstColumnIterator begin () const
 returns a const iterator to the first column in the JKQTPDatastore
 
ColumnIterator end ()
 returns an iterator behind the last column in the JKQTPDatastore
 
ConstColumnIterator end () const
 returns a const iterator behind the last column in the JKQTPDatastore
 
JKQTPDatastoreItemgetItem (size_t i)
 returns the JKQTPDatastoreItem object for the i -th item in the store
 
const JKQTPDatastoreItemgetItem (size_t i) const
 returns the JKQTPDatastoreItem object for the i -th item in the store
 

Private Attributes

QMap< size_t, JKQTPColumncolumns
 a std::vector of all columns that may be used to access the managed chunks of memory.
 
QMap< size_t, JKQTPDatastoreItem * > items
 a std::vector that contains all items managed by this datastore
 
std::unique_ptr< JKQTPColumnm_invalidColumn
 an internal invalid column object, used e.g. to return invalid column iterators
 
size_t maxColumnsID
 internal variable to keep track about the highest column ID (in columns) used so far
 
size_t maxItemID
 internal variable to keep track about the highest item ID (in items) used so far
 

Friends

class JKQTPColumn
 
class JKQTPDatastoreItem
 
class JKQTPDatastoreModel
 

Detailed Description

This class manages data columns (with entries of type double ), used by JKQTPlotter/JKQTBasePlotter to represent data for plots.

See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore for a detailed description of how to use this class for data management!

Column Management

Column Generation/Deletion

A JKQTPDatastore manages a set of data columns. Each column is a continuous vector of numbers. Optionally it can be interpreted as a 2D image. In the latter case, the data is assumed to be ordered in row-major ordering (i.e. row for row).

You can generate new columns e.g. by:

  • addColumn() which either generates internally managed (and extensible) columns, or accepts a simple double* pointer to external. In the latter case owner-ship may be transferred to the datastore, but can also retain externally.
  • addImageColumn() adds a column that should be interpreted as an image with given width and height (i.e. a row-major matrix with width columns and height rows.
  • copyColumn() duplicates an existing column
  • addCopiedColumn() copies an external dataset into the datastore. e.g. with code like:
    QVector<double> X, Y;
    const int Ndata=100;
    for (int i=0; i<Ndata; i++) {
    const double x=double(i)/double(Ndata)*8.0*JKQTPSTATISTICS_PI;
    X<<x;
    Y<<sin(x);
    }
    plot.addGraph(linegraph=new JKQTPXYLineGraph(&plot));
    // by calling JKQTPDatastore::addCopiedColumn() the data is COPIED from the vector into the datastore
    linegraph->setXColumn(datastore->addCopiedColumn(X, "x"));
    linegraph->setYColumn(datastore->addCopiedColumn(Y, "y"));
    This implements xy line plots. This also alows to draw symbols at the data points.
    Definition jkqtplines.h:61
    #define JKQTPSTATISTICS_PI
    Definition jkqtpmathtools.h:52
  • addLinearColumn() adds a column with linearly increasing numbers (in a given range)
  • addLogColumn() and addDecadeLogColumn() add columns with logarithmically spaced values
  • addLinearGridColumns() adds two columns which represent x- and y- coordinates of points on a rectangular grid (useful for calculating image data)
  • addCalculatedColumn() calculates a column, based on row numbers and a C++ functor
  • addCalculatedColumnFromColumn() calculates a column, based on another column data
  • addCopiedMap() copies data from a std::map/QMap into two columns
  • ... several more functions for specific cases exist.
  • Also note that there are even library extensions that allow to import data directly from OpenCV matrices: JKQTPCopyCvMatToColumn()

Of course columns can also be deleted by calling:

Column Properties

The properties of columns may be accessed using:

Modify Column Contents

You can modify all data in a column by functions like:

Also you can access a single entry from a column, using:

  • set() / get() set/read a column entry
  • inc() / dec() increment/decrement a column entry
  • appendToColumn() (adds a single row/new value to a column, if the column was not internally managed before, it will be copied into a new internal memory segment by the first call to this function!)
  • appendToColumns() (adds several values to several columns simultaneously, i.e. a shortcut to prevents writing several consecutive appendToColumn() for each column separately)
  • appendFromContainerToColumn() (adds several rows from a container to a column, if the column was not internally managed before, it will be copied into a new internal memory segment by the first call to this function!)

Iterator Interface

In addition to teh fucntions above, JKQTPDatastore also provides C++-style iteratos to read the data from a column:

... and also a std::back_inserter -style interface to append data to columns:

These allow to use the C++ standard algorithms to work with columns and also enabled the library Statistical Computations in this software package. You can use the functions above e.g. for code like:

auto inserter it=datastore->backInserter(datastore->addColumn("new column"));
for (auto it=datastore->begin(col1); it!=datastore->begin(col1) ++it) {
*++inserter=sqrt(*it);
}

or simply

// mean of a column in a JKQTPDatastore:
double mean=jkqtpstatAverage(datastore1->begin(col1), datastore1->end(col1));
double jkqtpstatAverage(InputIt first, InputIt last, size_t *Noutput=nullptr)
calculates the average of a given data range first ... last
Definition jkqtpstatbasics.h:62

Also there are functions to add data from iterator-defined ranges, e.g.:

See also
Tutorial (JKQTPDatastore): Iterator-Based usage of JKQTPDatastore

Image Column

JKQTPDatastore stores the width and height of the represented image as metadata with any image column. This metadata is used to provide convenience access to the image pixels with:

The image width/height are read using:

This allows to write code like:

for (int iy=0; iy<10; iy++) {
for (int ix=0; ix<10; ix++) {
datastore->setPixel(imgColumn, ix, iy, sin(ix*iy/30.0));
}
}

Data Output

JKQTPDatastore provides several functions that allow to store its contents into files:

... and function to read data into different data structures:

Internal Working

This class manages a list if JKQTPDatastoreItem onjects that may each contain a chunk of memory, containig one or more columns of data. Each item can be accessed with get() by a specific ID which is returned by add(). JKQTPColumn. You may only clear all chunks of memory/items. If you no longer need some of the data, but still want to access the rest you will simply have to destroy all JKQTPColumn that point to the item with their JKQTPColumns:datastoreItem property.

+- JKQTPDatastore ---------------------+               std::vector<JKQTPColumn>:
|                                      |                   +- JKQTPColumn ----------------+
|    +- JKQTPDatastoreItem --------+   |                 0 |   datastore                  |
|  0 |     JKQTPSingleColumn       |<--|-------------------|---datastoreItem = 0          |
|    |   0 # # # # # # # # # # #<--|---|-------------------|---datastoreOffset = 0        |
|    |                             |   |                   |                              |
|    +- JKQTPDatastoreItem --------+   |                   +- JKQTPColumn ----------------+
|  1 |     JKQTPSingleColumn       |<--|---\             1 |   datastore                  |
|    |   0 # # # # # # # # # # #<--|---|-\  \--------------|---datastoreItem = 1          |
|    |                             |   |  \----------------|---datastoreOffset = 0        |
|    +- JKQTPDatastoreItem --------+   |                   |                              |
|    :                             :   |                   +------------------------------+
|    :                             :   |                   :                              :
|    :                             :   |                   :                              :
|    +- JKQTPDatastoreItem --------+   |                   :                              :
|N-1 |     JKQTPMatrixRow          |<--|---\               :                              :
|    |   0 # # # # # # # # # # #   |   |    \              +- JKQTPColumn ----------------+
|    |   1 # # # # # # # # # # #   |   |     \         M-1 |   datastore                  |
|    |   2 # # # # # # # # # # #<--|---|--\   \------------|---datastoreItem = N-1        |
|    |                             |   |   \---------------|---datastoreOffset = 2        |
|    +-----------------------------+   |                   |                              |
|                                      |                   +------------------------------+
+--------------------------------------+
In addition the JKQTPDatastore manages a std::vector<JKQTPColumn> which may be used to access the data chunks in the logical
notion of data columns. This class provides a set of interface methods for this list:

Member Typedef Documentation

◆ ColumnIterator

typedef QMap<size_t,JKQTPColumn>::iterator JKQTPDatastore::ColumnIterator
protected

mutable iterator for columns in the JKQTPDatastore (ColumnIterator::first: column number, ColumnIterator::second: column data)

◆ ConstColumnIterator

typedef QMap<size_t,JKQTPColumn>::const_iterator JKQTPDatastore::ConstColumnIterator
protected

constant iterator for columns in the JKQTPDatastore (ColumnIterator::first: column number, ColumnIterator::second: column data)

Constructor & Destructor Documentation

◆ JKQTPDatastore()

JKQTPDatastore::JKQTPDatastore ( )

class constructor, generates an empty datastore

◆ ~JKQTPDatastore()

JKQTPDatastore::~JKQTPDatastore ( )

class destructor, destroys all subordered JKQTPDatastoreItem objects

Member Function Documentation

◆ addCalculatedColumn() [1/2]

size_t JKQTPDatastore::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

Pseudocode:

for (i=0; i<rows; i++) {
newColumn.push_back(f(i));
}
return newColumn;
See also
addCalculatedColumnFromColumn(), Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addCalculatedColumn() [2/2]

size_t JKQTPDatastore::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

Pseudocode:

for (i=0; i<rows; i++) {
newColumn.push_back(f(i, this));
}
return newColumn;
See also
addCalculatedColumnFromColumn(), Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addCalculatedColumnFromColumn() [1/3]

size_t JKQTPDatastore::addCalculatedColumnFromColumn ( const std::pair< size_t, size_t > &  otherColumn,
const std::function< double(double, double)> &  f,
const QString &  name = QString("") 
)
inline

◆ addCalculatedColumnFromColumn() [2/3]

size_t JKQTPDatastore::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 , that are calculated by calling f for each entry in otherColumn

Pseudocode:

for (i=0; i<rows(otherColumn); i++) {
newColumn.push_back(f(getValue(otherColumn, i));
}
return newColumn;
See also
addCalculatedColumn(), Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addCalculatedColumnFromColumn() [3/3]

size_t JKQTPDatastore::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 , that are calculated by calling f for each pair of entries in otherColumnX and otherColumnY

Pseudocode:

for (i=0; i<std::min(rows(otherColumnX), rows(otherColumnY)); i++) {
newColumn.push_back(f(getValue(otherColumnX, i), getValue(otherColumnY, i));
}
return newColumn;
See also
addCalculatedColumn(), Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addCalculatedImageColumn()

size_t JKQTPDatastore::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 calling f for each entry

Pseudocode:

for (y=0; y<rows; y++) {
for (x=0; x<cols; x++) {
newColumn.push_back(f(x,y));
}
}
return newColumn;
See also
addCalculatedColumnFromColumn(), Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addColumn() [1/4]

size_t JKQTPDatastore::addColumn ( const QString &  name = QString(""))

add a new and empty column to the datastore and return its column ID. The new item uses internal memory management.

Parameters
namename for the column
Returns
the ID of the newly created column
See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addColumn() [2/4]

size_t JKQTPDatastore::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. Data is not owned by the JKQTPDatastore!

Parameters
datadata array to be copied
rowsnumber of rows in the data array
namename for the column
Returns
the ID of the newly created column
#define NDATA 5
double XCA[NDATA]= { 1, 2, 3, 4, 5 };
double YCA[NDATA]= { 1, 0, 1, 0, 1 };
plot.addGraph(linegraph=new JKQTPXYLineGraph(&plot));
linegraph->setXColumn(datastore->addColumn(XCA, NDATA, "xca (C-array)"));
linegraph->setYColumn(datastore->addColumn(YCA, NDATA, "yca (C-array)"));
See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addColumn() [3/4]

size_t JKQTPDatastore::addColumn ( JKQTPColumn  col)
protected

add a new column to the datastore and return its ID

◆ addColumn() [4/4]

size_t JKQTPDatastore::addColumn ( size_t  rows,
const QString &  name = QString("") 
)

add a new columns with rows rows to the datastore and return its column ID. The new item uses internal memory management.

Parameters
rowsnumber of rows in the data array
namename for the column
Returns
the ID of the newly created column
See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addColumnCalculatedFromColumn() [1/2]

size_t JKQTPDatastore::addColumnCalculatedFromColumn ( size_t  otherColumn,
const std::function< double(double)> &  f,
const QString &  name = QString("") 
)
inline

◆ addColumnCalculatedFromColumn() [2/2]

size_t JKQTPDatastore::addColumnCalculatedFromColumn ( size_t  otherColumnX,
size_t  otherColumnY,
const std::function< double(double, double)> &  f,
const QString &  name = QString("") 
)
inline

◆ addColumnForItem()

size_t JKQTPDatastore::addColumnForItem ( size_t  itemID,
size_t  columnInItem,
const QString &  name = QString("") 
)
protected

add a new columns which references a specified item and a specified column therein.

See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addCopiedColumn() [1/6]

template<typename T >
size_t JKQTPDatastore::addCopiedColumn ( const T *  data,
size_t  rows,
const QString &  name = QString("") 
)
inline

copy an external column to the datastore. It contains rows rows. The external data is copied to an internal array, so afterwards you can delete the external arrayThis returns its logical column ID.

Template Parameters
Tdatatype of the element in the vector, this has to be convertible to double!
Parameters
datapointer to the data to be copied
rowsitems in data
namename for the column
Returns
the ID of the newly created column
Note
This function converts the input array data into an array of double!
See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addCopiedColumn() [2/6]

template<typename T >
size_t JKQTPDatastore::addCopiedColumn ( const T *  data,
size_t  rows,
size_t  stride,
const QString &  name 
)
inline

copy an external column to the datastore. It contains rows rows. The external data is copied to an internal array, so afterwards you can delete the external arrayThis returns its logical column ID.

Template Parameters
Tdatatype of the element in the vector, this has to be convertible to double!
Parameters
datapointer to the data to be copied
rowsitems in data
namename for the column
stridewhen copying, this function steps throught the data with the given stride, so only eleemnts [0, stride, 2*stride, ... (rows-1)*stride] are copied!
Returns
the ID of the newly created column

Pseudocode:

for (i=0; i<rows; i+=stride) {
newColumn.push_back(jkqtp_todouble(data[i]));
}
constexpr double jkqtp_todouble(const T &d)
converts a boolean to a double, is used to convert boolean to double by JKQTPDatastore
Definition jkqtpmathtools.h:113
Note
This function converts the input array data into an array of double!
See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addCopiedColumn() [3/6]

template<typename T >
size_t JKQTPDatastore::addCopiedColumn ( const T *  data,
size_t  rows,
size_t  stride,
int  start,
const QString &  name 
)
inline

copy an external column to the datastore. It contains rows rows. The external data is copied to an internal array, so afterwards you can delete the external arrayThis returns its logical column ID.

Template Parameters
Tdatatype of the element in the vector, this has to be convertible to double!
Parameters
datapointer to the data to be copied
rowsnumber of items to copy from data
stridewhen copying, this function steps throught the data with the given stride, so only eleemnts [start, start+stride, start+2*stride, ... start+(rows-1)*stride] are copied!
startfirst element to copy
namename for the column
Returns
the ID of the newly created column

Pseudocode:

for (i=start; i<rows; i+=stride) {
newColumn.push_back(jkqtp_todouble(data[i]));
}
Note
This function converts the input array data into an array of double!
See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addCopiedColumn() [4/6]

template<typename TContainer >
size_t JKQTPDatastore::addCopiedColumn ( const TContainer &  data,
const QString &  name,
size_t  stride,
size_t  start = 0 
)
inline

add one external column to the datastore. It will be filled with the contents of vector data.

Template Parameters
TContainerdatatype of the container, which need to support standard C++ iterators and the function size(). The contents needs to be convertible to double. The iterator of TContainer needs to support ++ and +=
Parameters
datadata vector to be copied
namename for the column
stridestrides through the container data with the given stride
startstarts copying from data with the element start
Returns
the ID of the newly created column

Pseudocode:

it=data.begin();
it += start; // shift by start items
while (it!=data.end()) {
newColumn.push_back(jkqtp_todouble(*it));
it += stride;
}
See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addCopiedColumn() [5/6]

template<typename TContainer >
size_t JKQTPDatastore::addCopiedColumn ( const TContainer &  data,
const QString &  name = QString("") 
)
inline

add one external column to the datastore. It will be filled with the contents of vector data.

Template Parameters
TContainerdatatype of the container, which need to support standard C++ iterators. The contents needs to be convertible to double.
Parameters
datadata vector to be copied
namename for the column
Returns
the ID of the newly created column
QVector<double> X, Y;
const int Ndata=100;
for (int i=0; i<Ndata; i++) {
const double x=double(i)/double(Ndata)*8.0*JKQTPSTATISTICS_PI;
X<<x;
Y<<sin(x);
}
plot.addGraph(linegraph=new JKQTPXYLineGraph(&plot));
// by calling JKQTPDatastore::addCopiedColumn() the data is COPIED from the vector into the datastore
linegraph->setXColumn(datastore->addCopiedColumn(X, "x"));
linegraph->setYColumn(datastore->addCopiedColumn(Y, "y"));
See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addCopiedColumn() [6/6]

template<typename TIterator >
size_t JKQTPDatastore::addCopiedColumn ( TIterator  first,
TIterator  last,
const QString &  name = QString("") 
)
inline

add one column to the datastore. It will be filled with the values from first ... last

Template Parameters
TIteratora standard C++ iterator
Parameters
firstpoints to the first value in the range of values to add
lastpoints behind the last value in the range of values to add
namename for the column
Returns
the ID of the newly created column
QVector<double> X, Y;
const int Ndata=100;
for (int i=0; i<Ndata; i++) {
const double x=double(i)/double(Ndata)*8.0*JKQTPSTATISTICS_PI;
X<<x;
Y<<sin(x);
}
plot.addGraph(linegraph=new JKQTPXYLineGraph(&plot));
// by calling JKQTPDatastore::addCopiedColumn() the data is COPIED from the vector into the datastore
linegraph->setXColumn(datastore->addCopiedColumn(X.begin(), X.end(), "x"));
linegraph->setYColumn(datastore->addCopiedColumn(Y.begin(), Y.end(), "y"));
See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addCopiedColumnMasked() [1/2]

template<typename T >
size_t JKQTPDatastore::addCopiedColumnMasked ( const T *  data,
const bool *  mask,
size_t  rows,
const QString &  name = QString(""),
bool  useIfMaskEquals = false 
)
inline

add one external column to the datastore. It contains rows rows. The external data is copied to an internal array, so afterwards you can delete the external arrayThis returns its logical column ID.

Template Parameters
Tdatatype of the element in the vector, this has to be convertible to double!
Parameters
datapointer to the data to be copied
maskboolean array with rows entries, used to mask data when copying from data
rowsitems in data
namename for the column
useIfMaskEqualsdata from data is copied if and only if the corresponding entry of mask equals this value
Note
This function converts the input array data into an array of double!
See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addCopiedColumnMasked() [2/2]

template<typename TContainer , typename TContainerMask >
size_t JKQTPDatastore::addCopiedColumnMasked ( const TContainer &  data,
const TContainerMask &  mask,
const QString &  name = QString(""),
bool  useIfMaskEquals = false 
)
inline

add one external column to the datastore. It will be filled with the contents of vector data.

Template Parameters
TContainerdatatype of the container data, which need to support standard C++ iterators and the function size(). The contents needs to be convertible to double.
TContainerMaskdatatype of the container mask, which need to support standard C++ iterators and the function size(). The contents needs to be convertible to bool.
Parameters
datadata vector to be copied
maskdata vector to be copied
namename for the column
useIfMaskEqualsdata from data is copied if and only if the corresponding entry of mask equals this value
Returns
the ID of the newly created column
See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

Pseudocode:

for (i=0; i<data.size(); i++) {
if (static_cast<bool>(mask[i])==useIfMaskEquals) {
newColumn.push_back(jkqtp_todouble(data[i]));
}
}
return newColumn;

◆ addCopiedImageAsColumn() [1/2]

template<typename T >
size_t JKQTPDatastore::addCopiedImageAsColumn ( const T *  data,
size_t  width,
size_t  height,
const QString &  name = QString(""),
size_t  stride = 1,
size_t  start = 0 
)
inline

add one external column to the datastore. It contains width * height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so afterwards you can delete the external arrayThis returns its logical column ID.

◆ addCopiedImageAsColumn() [2/2]

template<typename TContainer >
size_t JKQTPDatastore::addCopiedImageAsColumn ( const TContainer &  data,
size_t  width,
const QString &  name = QString("") 
)
inline

add one external column to the datastore. It contains width * height rows. The external data is assumed to be organized as a row-major image and is copied as such. The external data is copied to an internal array, so afterwards you can delete the external arrayThis returns its logical column ID.

Template Parameters
TContainerdatatype of the container, which need to support standard C++ iterators and the function size(). The contents needs to be convertible to double.
Parameters
datadata vector to be copied
widthwidth of the image, stored in data
namename for the column
Returns
the ID of the newly created column

◆ addCopiedImageAsColumnTranspose() [1/2]

template<typename T >
size_t JKQTPDatastore::addCopiedImageAsColumnTranspose ( const QVector< T > &  data,
size_t  width,
const QString &  name = QString("") 
)
inline

add one external column to the datastore. It contains width * height rows.

The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so afterwards you can delete the external array This returns its logical column ID.

Template Parameters
Tdata type of the array data, needs to be convertible to double by jkqtp_todouble()
Parameters
datadata vector to be copied
widthwidth of the image, stored in data
namename for the column
Returns
the ID of the newly created column

◆ addCopiedImageAsColumnTranspose() [2/2]

template<typename T >
size_t JKQTPDatastore::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 the given width and height.

The external data is assumed to be organized as a column-major image and is copied as row-major (i.e. is transposed). The external data is copied to an internal array, so afterwards you can delete the external arrayThis returns its logical column ID.

Template Parameters
Tdata type of the array data, needs to be convertible to double by jkqtp_todouble()
Parameters
dataa column major image
widthwidth of data
heightheight of data
namename of the new column
stridestride to use, when reading data. Use this to e.g. read one channel from a packed RGB-image (stride=3, start=0/1/2 )
startfirst entry from data top copy data. Use this to e.g. read one channel from a packed RGB-image (stride=3, start=0/1/2 )
Returns
ID of the newly added column

◆ addCopiedItem() [1/2]

size_t JKQTPDatastore::addCopiedItem ( const double *  data,
size_t  rows 
)
protected

add one external column to the datastore. It contains rows rows. The data is copied and the copy managed internally This function retuns an item ID (which can be used with getItem() ), not a column ID!

◆ addCopiedItem() [2/2]

size_t JKQTPDatastore::addCopiedItem ( JKQTPDatastoreItemFormat  dataformat,
double *  data,
size_t  columns,
size_t  rows 
)
protected

add one external data block to the datastore. It contains rows rows and columns columns. The data is copied and the copy managed internally This function retuns an item ID (which can be used with getItem() ), not a column ID!

◆ addCopiedMap() [1/2]

template<typename TContainer >
std::pair< size_t, size_t > JKQTPDatastore::addCopiedMap ( const TContainer &  c,
const QString &  nameKey = QString("map_key"),
const QString &  nameValue = QString("map_value") 
)
inline

copies the contents of the map-like container c into two columns of the datastore, returns the two IDs of the items as a std::pair

See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore, jkqtp_todouble()
Template Parameters
TContainerdatatype of the map-typed container (e.g. std::map or QMap ) The requiremen to this container is that it supports standard iterators with begin() and end() .
Parameters
cthe map to copy to the datastore
nameKeyname for the column with the map keys
nameValuename for the column with the map values
Returns
a pair of IDs to the newly created columns (IDkeyColumn, IDvalueColumn) Example of usage:
std::map<int, double> datamap;
datamap[1]=1.1;
datamap[2]=1.4;
datamap[4]=1.2;
datamap[5]=1.8;
datamap[7]=0.9;
plot.addGraph(linegraph=new JKQTPXYLineGraph(&plot));
linegraph->setXYColumns(datastore->addCopiedMap(datamap, "map_x", "map_y"));
linegraph->setTitle(QObject::tr("copied map"));

◆ addCopiedMap() [2/2]

template<typename TIterator >
std::pair< size_t, size_t > JKQTPDatastore::addCopiedMap ( TIterator  first,
TIterator  last,
const QString &  nameKey = QString("map_key"),
const QString &  nameValue = QString("map_value") 
)
inline

copies the contents of the map-like container c into two columns of the datastore, returns the two IDs of the items as a std::pair

See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore, jkqtp_todouble()
Template Parameters
TIteratora standard C++ iterator for a map, dereferencing with it->first and it->second
Parameters
firstpoints to the first value in the range of values to add
lastpoints behind the last value in the range of values to add
nameKeyname for the column with the map keys
nameValuename for the column with the map values
Returns
a pair of IDs to the newly created columns (IDkeyColumn, IDvalueColumn) Example of usage:
std::map<int, double> datamap;
datamap[1]=1.1;
datamap[2]=1.4;
datamap[4]=1.2;
datamap[5]=1.8;
datamap[7]=0.9;
plot.addGraph(linegraph=new JKQTPXYLineGraph(&plot));
linegraph->setXYColumns(datastore->addCopiedMap(datamap.begin(), datamap.end(), "map_x", "map_y"));
linegraph->setTitle(QObject::tr("copied map"));

◆ addCopiedPoints() [1/6]

std::pair< size_t, size_t > JKQTPDatastore::addCopiedPoints ( const QList< QPoint > &  points,
const QString &  namex = QString(""),
const QString &  namey = QString("") 
)

◆ addCopiedPoints() [2/6]

std::pair< size_t, size_t > JKQTPDatastore::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-value, second column: y-value)

Parameters
pointslist of datapoints to add
namexname for the column with the x-values
nameyname for the column with the y-values
Returns
the IDs of the newly created column

◆ addCopiedPoints() [3/6]

std::pair< size_t, size_t > JKQTPDatastore::addCopiedPoints ( const std::list< QPoint > &  points,
const QString &  namex = QString(""),
const QString &  namey = QString("") 
)

◆ addCopiedPoints() [4/6]

std::pair< size_t, size_t > JKQTPDatastore::addCopiedPoints ( const std::list< QPointF > &  points,
const QString &  namex = QString(""),
const QString &  namey = QString("") 
)

◆ addCopiedPoints() [5/6]

std::pair< size_t, size_t > JKQTPDatastore::addCopiedPoints ( const std::vector< QPoint > &  points,
const QString &  namex = QString(""),
const QString &  namey = QString("") 
)

◆ addCopiedPoints() [6/6]

std::pair< size_t, size_t > JKQTPDatastore::addCopiedPoints ( const std::vector< QPointF > &  points,
const QString &  namex = QString(""),
const QString &  namey = QString("") 
)

◆ addDecadeLogColumn()

size_t JKQTPDatastore::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^start and ending at 10^end. the values are logarithmically spaced between 10^start end 10^end

See also
addLinearColumn(), addLogColumn(), Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addImageColumn() [1/2]

size_t JKQTPDatastore::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 column ID. Data is not owned by the JKQTPDatastore! The column is meant to represent an image in row-major order with x-dimention width and y-dimension height .

Parameters
datadata array to be copied
widthwidth of the image represented by the data array
heightheight of the image represented by the data array
namename for the column
Returns
the ID of the newly created column
See also
addColumn(), addImageColumn(), addInternalImageColumn(), Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addImageColumn() [2/2]

size_t JKQTPDatastore::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. The new item uses internal memory management. The column is meant to represent an image in row-major order with x-dimention width and y-dimension height .

Parameters
widthwidth of the image represented by the data array
heightheight of the image represented by the data array
namename for the column
Returns
the ID of the newly created column
See also
addImageColumn(), addInternalImageColumn(), Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addInternalColumn()

size_t JKQTPDatastore::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 to the datastore

Parameters
datadata array to be copied
rowsnumber of rows in the data array
namename for the column
Returns
the ID of the newly created column
#define NDATA 5
double* XCA=(double*)malloc(NDATA, sizeof(double));
double* YCA=(double*)malloc(NDATA, sizeof(double));
...
plot.addGraph(linegraph=new JKQTPXYLineGraph(&plot));
linegraph->setXColumn(datastore->addInternalColumn(XCA, NDATA, "x"));
linegraph->setXColumn(datastore->addInternalColumn(YCA, NDATA, "y"));
See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addInternalImageColumn()

size_t JKQTPDatastore::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 transfered to the datastore The column is meant to represent an image in row-major order with x-dimention width and y-dimension height .

Parameters
datadata array to be copied
widthwidth of the image represented by the data array
heightheight of the image represented by the data array
namename for the column
Returns
the ID of the newly created column
See also
addInternalColumn(), addImageColumn(), addInternalImageColumn(), Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addInternalItem()

size_t JKQTPDatastore::addInternalItem ( double *  data,
size_t  rows 
)
protected

add one internal column to the datastore. It contains rows rows. This function retuns an item ID (which can be used with getItem() ), not a column ID!

◆ addItem() [1/5]

size_t JKQTPDatastore::addItem ( double *  data,
size_t  rows 
)
protected

add one external column to the datastore. It contains rows rows. This function retuns an item ID (which can be used with getItem() ), not a column ID!

◆ addItem() [2/5]

size_t JKQTPDatastore::addItem ( JKQTPDatastoreItem item)
protected

add a new item to the datastore and return its ID This function retuns an item ID (which can be used with getItem() ), not a column ID!

◆ addItem() [3/5]

size_t JKQTPDatastore::addItem ( JKQTPDatastoreItemFormat  dataformat,
double *  data,
size_t  columns,
size_t  rows 
)
protected

add an external memory block to the datastore. It contains rows rows and columns columns. dataformat determined the memory layout. This function retuns an item ID (which can be used with getItem() ), not a column ID!

◆ addItem() [4/5]

size_t JKQTPDatastore::addItem ( size_t  columns,
size_t  rows 
)
protected

add a new item with rows rows and columns columns to the datastore and return its ID. The item uses internal memory management. This function retuns an item ID (which can be used with getItem() ), not a column ID!

◆ addItem() [5/5]

size_t JKQTPDatastore::addItem ( size_t  rows)
protected

add a new columns/item with rows rows to the datastore and return its ID. The item uses internal memory management. This function retuns an item ID (which can be used with getItem() ), not a column ID!

◆ addLinearColumn()

size_t JKQTPDatastore::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 start and ending at end. the values are equidistant between start end end

See also
addLogColumn(), addDecadeLogColumn(), Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addLinearGridColumns()

std::pair< size_t, size_t > JKQTPDatastore::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 width points in x- and height points in y-direction.

Parameters
widthnumber of columns in the mesh grid
startXx-coordinate of the first column of the mesh grid
endXx-coordinate of the last column of the mesh grid
heightnumber of rows in the mesh grid
startYy-coordinate of the first row of the mesh grid
endYy-coordinate of the last row of the mesh grid
nameXname for the x-coordinate column
nameYname for the y-coordinate column
Returns
IDs of two column that contain the x- and y- coordinates od the mesh points (in row-major order), where the x-coordinates are linearly distributed between startX and endX and the x-coordinates are linearly distributed between startY and endY .
See also
addLogGridColumns(), addDecadeLogGridColumns(), addCalculatedColumnFromColumn(), JKQTPXYParametrizedScatterGraph, Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ addLogColumn()

size_t JKQTPDatastore::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 start and ending at end. the values are logarithmically spaced between start end end

See also
addLinearColumn(), addDecadeLogColumn(), Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ appendFromContainerToColumn()

template<class TContainer >
void JKQTPDatastore::appendFromContainerToColumn ( size_t  column,
const TContainer &  values 
)
inline

adds a values in container values to the column column. This changes the column length (number of rows). If the memory was externally managed before, it will be internally managed afterwards

Template Parameters
TContainera container with standard iterators
Parameters
columnthe column to extend
valuesvector with data to append to column column

◆ appendToColumn() [1/2]

void JKQTPDatastore::appendToColumn ( size_t  column,
double  value 
)

adds a value value to the column column. This changes the column length (number of rows).

Warning
This changes the column length (number of rows). If the memory was externally managed before, it will be internally managed afterwards .
See also
appendToColumns()

◆ appendToColumn() [2/2]

template<class TIterator >
void JKQTPDatastore::appendToColumn ( size_t  column,
TIterator  first,
TIterator  last 
)
inline

adds a values from a range first ... last (defined by C++ iterators) to the column column. This changes the column length (number of rows). If the memory was externally managed before, it will be internally managed afterwards

Template Parameters
TIteratora standard C++ iterator
Parameters
columnthe column to extend
firstpoints to the first value in the range of values to add
lastpoints behind the last value in the range of values to add

◆ appendToColumns() [1/6]

void JKQTPDatastore::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.

This is equivalent to

appendToColumn(column1, value1);
appendToColumn(column2, value2);
void appendToColumn(size_t column, double value)
adds a value value to the column column. This changes the column length (number of rows).
Warning
This changes the column length (number of rows). If the memory was externally managed before, it will be internally managed afterwards .
See also
appendToColumn()

◆ appendToColumns() [2/6]

void JKQTPDatastore::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.

This is equivalent to

appendToColumn(column1, value1);
appendToColumn(column2, value2);
appendToColumn(column3, value3);
Warning
This changes the column length (number of rows). If the memory was externally managed before, it will be internally managed afterwards .
See also
appendToColumn()

◆ appendToColumns() [3/6]

void JKQTPDatastore::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.

This is equivalent to

appendToColumn(column1, value1);
appendToColumn(column2, value2);
appendToColumn(column3, value3);
appendToColumn(column4, value4);
Warning
This changes the column length (number of rows). If the memory was externally managed before, it will be internally managed afterwards .
See also
appendToColumn()

◆ appendToColumns() [4/6]

void JKQTPDatastore::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.

This is equivalent to

appendToColumn(column1, value1);
appendToColumn(column2, value2);
appendToColumn(column3, value3);
appendToColumn(column4, value4);
appendToColumn(column5, value5);
Warning
This changes the column length (number of rows). If the memory was externally managed before, it will be internally managed afterwards .
See also
appendToColumn()

◆ appendToColumns() [5/6]

void JKQTPDatastore::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.

This is equivalent to

appendToColumn(columnX, value.x());
appendToColumn(columnY, value.y());
Warning
This changes the column length (number of rows). If the memory was externally managed before, it will be internally managed afterwards .
See also
appendToColumn()

◆ appendToColumns() [6/6]

void JKQTPDatastore::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.

This is equivalent to

appendToColumn(columnX, value.x());
appendToColumn(columnY, value.y());
Warning
This changes the column length (number of rows). If the memory was externally managed before, it will be internally managed afterwards .
See also
appendToColumn()

◆ backInserter() [1/2]

JKQTPColumnBackInserter JKQTPDatastore::backInserter ( int  i)

returns a back-inserter iterator (JKQTPColumnBackInserter) to the i -th column in the JKQTPDatastore

See also
JKQTPColumnBackInserter

◆ backInserter() [2/2]

JKQTPColumnBackInserter JKQTPDatastore::backInserter ( size_t  i)

returns a back-inserter iterator (JKQTPColumnBackInserter) to the i -th column in the JKQTPDatastore

See also
JKQTPColumnBackInserter

◆ begin() [1/6]

ColumnIterator JKQTPDatastore::begin ( )
protected

returns an iterator to the first column in the JKQTPDatastore

See also
ColumnIterator

◆ begin() [2/6]

ConstColumnIterator JKQTPDatastore::begin ( ) const
protected

returns a const iterator to the first column in the JKQTPDatastore

See also
ConstColumnIterator

◆ begin() [3/6]

JKQTPColumnIterator JKQTPDatastore::begin ( int  i)

returns an iterator to the first data entry in the i -th column in the JKQTPDatastore

See also
JKQTPColumn::iterator

◆ begin() [4/6]

JKQTPColumnConstIterator JKQTPDatastore::begin ( int  i) const

returns a const iterator to the first data entry in the i -th column in the JKQTPDatastore

See also
JKQTPColumn::const_iterator

◆ begin() [5/6]

JKQTPColumnIterator JKQTPDatastore::begin ( size_t  i)

returns an iterator to the first data entry in the i -th column in the JKQTPDatastore

See also
JKQTPColumn::iterator

◆ begin() [6/6]

JKQTPColumnConstIterator JKQTPDatastore::begin ( size_t  i) const

returns a const iterator to the first data entry in the i -th column in the JKQTPDatastore

See also
JKQTPColumn::const_iterator

◆ clear()

void JKQTPDatastore::clear ( )

deletes all items from the datastore and possibly frees the memory they manage

◆ copyColumn() [1/2]

size_t JKQTPDatastore::copyColumn ( size_t  old_column,
const QString &  name = QString("") 
)

copies the given old_column into a new one

Parameters
old_columnthe column to be duplicated
namename for the new column
Returns
ID of the newly created column
See also
Tutorial (JKQTPDatastore): Basic Usage of JKQTPDatastore

◆ copyColumn() [2/2]

size_t JKQTPDatastore::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

Parameters
old_columnthe column to be duplicated
startfor row in column old_column to copy
stridestride for iterating through old_column when copying
namename for the new column
Returns
ID of the newly created column

Pseuo-Code:

newColumn=addColumn(rowcount(old_column), name)
forall ( r: rows(old_column)) {
set(newColumn, r, get(old_column, r))
}
return newColumn;
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:2700
size_t addColumn(JKQTPColumn col)
add a new column to the datastore and return its ID
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:2675

◆ copyColumnData()

void JKQTPDatastore::copyColumnData ( size_t  toColumn,
size_t  fromColumn 
)

copies the data from fromColumn into an existing column toColumn

Parameters
toColumntarget of the copy operation
fromColumnsource of the copy operation
Warning
If the memory in toColumn was externally managed before, it will be internally managed afterwards!

◆ dec()

void JKQTPDatastore::dec ( size_t  column,
size_t  row,
double  decrement = 1 
)
inline

decrements entry in row row of column column by decrement

See also
Example (JKQTPlotter): Filled Curve Plots

◆ deleteAllColumns()

void JKQTPDatastore::deleteAllColumns ( const QString &  name,
bool  removeItems = true 
)

delete all columns with the given name, if no other columns points to the datastore item of the column and removeItems is true, the item will be removed

◆ deleteAllPrefixedColumns()

void JKQTPDatastore::deleteAllPrefixedColumns ( QString  prefix,
bool  removeItems = true 
)

delete all columns where the name starts with a given prefix, if no other columns points to the datastore item of the column and removeItems is true, the item will be removed

◆ deleteColumn()

void JKQTPDatastore::deleteColumn ( size_t  column,
bool  removeItems = true 
)

delete the given column, if no other columns points to the datastore item of the column and removeItems is true, the item will be removed

◆ end() [1/6]

ColumnIterator JKQTPDatastore::end ( )
protected

returns an iterator behind the last column in the JKQTPDatastore

See also
ColumnIterator

◆ end() [2/6]

ConstColumnIterator JKQTPDatastore::end ( ) const
protected

returns a const iterator behind the last column in the JKQTPDatastore

See also
ConstColumnIterator

◆ end() [3/6]

JKQTPColumnIterator JKQTPDatastore::end ( int  i)

returns an iterator behind the last data entry data in the i -th column in the JKQTPDatastore

See also
JKQTPColumn::iterator

◆ end() [4/6]

JKQTPColumnConstIterator JKQTPDatastore::end ( int  i) const

returns a const iterator behind the last data entry data in the i -th column in the JKQTPDatastore

See also
JKQTPColumn::const_iterator

◆ end() [5/6]

JKQTPColumnIterator JKQTPDatastore::end ( size_t  i)

returns an iterator behind the last data entry data in the i -th column in the JKQTPDatastore

See also
JKQTPColumn::iterator

◆ end() [6/6]

JKQTPColumnConstIterator JKQTPDatastore::end ( size_t  i) const

returns a const iterator behind the last data entry data in the i -th column in the JKQTPDatastore

See also
JKQTPColumn::const_iterator

◆ ensureColumnNum()

int JKQTPDatastore::ensureColumnNum ( const QString &  name)

return the num of the first column with the given name, if none was found this creates a new column with no rows and returns its num

◆ eraseFromColumn() [1/4]

void JKQTPDatastore::eraseFromColumn ( const JKQTPColumnConstIterator pos)
inline

removes the entry pos

Warning
If the memory was externally managed before, it will be internally managed afterwards
the iterator pos is rendered invalid by this column, as the in some cases the internal column is redefined!

◆ eraseFromColumn() [2/4]

void JKQTPDatastore::eraseFromColumn ( const JKQTPColumnConstIterator pos,
const JKQTPColumnConstIterator posEnd 
)
inline

removes the entries pos to posEnd

Warning
If the memory was externally managed before, it will be internally managed afterwards
the iterator pos is rendered invalid by this column, as the in some cases the internal column is redefined!

◆ eraseFromColumn() [3/4]

void JKQTPDatastore::eraseFromColumn ( const JKQTPColumnIterator pos)
inline

removes the entry pos

Warning
If the memory was externally managed before, it will be internally managed afterwards
the iterator pos is rendered invalid by this column, as the in some cases the internal column is redefined!

◆ eraseFromColumn() [4/4]

void JKQTPDatastore::eraseFromColumn ( const JKQTPColumnIterator pos,
const JKQTPColumnIterator posEnd 
)
inline

removes the entries pos to posEnd

Warning
If the memory was externally managed before, it will be internally managed afterwards
the iterator pos is rendered invalid by this column, as the in some cases the internal column is redefined!

◆ get() [1/4]

double JKQTPDatastore::get ( int  column,
int  row 
) const
inline

returns the value at position (column, row). column is the logical column and will be mapped to the according memory block internally!)

◆ get() [2/4]

double JKQTPDatastore::get ( int  column,
size_t  row 
) const
inline

returns the value at position (column, row). column is the logical column and will be mapped to the according memory block internally!)

◆ get() [3/4]

double JKQTPDatastore::get ( size_t  column,
int  row 
) const
inline

returns the value at position (column, row). column is the logical column and will be mapped to the according memory block internally!)

◆ get() [4/4]

double JKQTPDatastore::get ( size_t  column,
size_t  row 
) const
inline

returns the value at position (column, row). column is the logical column and will be mapped to the according memory block internally!)

◆ getColumnChecksum()

quint16 JKQTPDatastore::getColumnChecksum ( int  column) const

returns the data checksum of the given column

◆ getColumnCount()

size_t JKQTPDatastore::getColumnCount ( ) const
inline

returns the number of (logical) columns currently managed by the datastore

◆ getColumnIDs()

QList< size_t > JKQTPDatastore::getColumnIDs ( ) const
inline

returns a list with all available column IDs

◆ getColumnIDsIntVec()

QVector< int > JKQTPDatastore::getColumnIDsIntVec ( ) const

returns a list with all available column IDs

◆ getColumnImageHeight()

size_t JKQTPDatastore::getColumnImageHeight ( int  column) const

returns the height of the image, represented by column (in row-major ordering)

◆ getColumnImageWidth()

size_t JKQTPDatastore::getColumnImageWidth ( int  column) const

returns the width of the image, represented by column (in row-major ordering). Internally this returns the imageColumns or image width, if set in the column

◆ getColumnName()

QString JKQTPDatastore::getColumnName ( size_t  column)

return the title of the first column with the given name, or -1 if none was found

◆ getColumnNames()

QStringList JKQTPDatastore::getColumnNames ( ) const

return a list with all columns available in the datastore

◆ getColumnNum()

int JKQTPDatastore::getColumnNum ( const QString &  name)

return the num of the first column with the given name, or -1 if none was found

◆ getColumnPointer() [1/4]

double * JKQTPDatastore::getColumnPointer ( int  column,
size_t  row = 0 
)
inline

returns a pointer to the data in column column, starting ar row row

◆ getColumnPointer() [2/4]

const double * JKQTPDatastore::getColumnPointer ( int  column,
size_t  row = 0 
) const
inline

returns a pointer to the data in column column, starting ar row row

◆ getColumnPointer() [3/4]

double * JKQTPDatastore::getColumnPointer ( size_t  column,
size_t  row = 0 
)
inline

returns a pointer to the data in column column, starting ar row row

◆ getColumnPointer() [4/4]

const double * JKQTPDatastore::getColumnPointer ( size_t  column,
size_t  row = 0 
) const
inline

returns a pointer to the data in column column, starting ar row row

◆ getData() [1/2]

QList< QVector< double > > JKQTPDatastore::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

Parameters
columnNamesif !=nullptr this will afterwards conatin the column titles
userColumnsa list of all columns to export, an empty list means: export all, the indexes in the list refer to getColumnsNames()

◆ getData() [2/2]

QVector< double > JKQTPDatastore::getData ( size_t  column,
QString *  columnName = nullptr 
) const

return contents of a given column as QVector<double>

Parameters
columncolumn to copy
columnNameif !=nullptr this will afterwards conatin the column title

◆ getItem() [1/2]

JKQTPDatastoreItem * JKQTPDatastore::getItem ( size_t  i)
inlineprotected

returns the JKQTPDatastoreItem object for the i -th item in the store

◆ getItem() [2/2]

const JKQTPDatastoreItem * JKQTPDatastore::getItem ( size_t  i) const
inlineprotected

returns the JKQTPDatastoreItem object for the i -th item in the store

◆ getMaxRows()

size_t JKQTPDatastore::getMaxRows ( ) const

returns the maximum number of rows in all columns

◆ getNextHigherIndex() [1/4]

int JKQTPDatastore::getNextHigherIndex ( int  column,
size_t  row 
) const

gets the index of the datapoint with the nearest, but higher value in the column

◆ getNextHigherIndex() [2/4]

int JKQTPDatastore::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 inclusive row range [start ... end] values of -1 for the ranges are "wildcards", i.e. start/end of column)

◆ getNextHigherIndex() [3/4]

int JKQTPDatastore::getNextHigherIndex ( size_t  column,
size_t  row 
) const

gets the index of the datapoint with the nearest, but higher value in the column

◆ getNextHigherIndex() [4/4]

int JKQTPDatastore::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 inclusive row range [start ... end] values of -1 for the ranges are "wildcards", i.e. start/end of column)

◆ getNextLowerIndex() [1/4]

int JKQTPDatastore::getNextLowerIndex ( int  column,
size_t  row 
) const

gets the index of the datapoint with the nearest, but lower value in the column

◆ getNextLowerIndex() [2/4]

int JKQTPDatastore::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 row range [start ... end] values of -1 for the ranges are "wildcards", i.e. start/end of column)

◆ getNextLowerIndex() [3/4]

int JKQTPDatastore::getNextLowerIndex ( size_t  column,
size_t  row 
) const

gets the index of the datapoint with the nearest, but lower value in the column

◆ getNextLowerIndex() [4/4]

int JKQTPDatastore::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 row range [start ... end] values of -1 for the ranges are "wildcards", i.e. start/end of column)

◆ getPixel()

double JKQTPDatastore::getPixel ( size_t  column,
size_t  x,
size_t  y 
) const
inline

returns the value at position (x, y) in the column-th column, which is interpreted with the imageWidth stored in that column

◆ getRows() [1/2]

size_t JKQTPDatastore::getRows ( int  column) const
inline

returns the number of rows in the column column

◆ getRows() [2/2]

size_t JKQTPDatastore::getRows ( size_t  column) const
inline

returns the number of rows in the column column

◆ hasColumn()

bool JKQTPDatastore::hasColumn ( size_t  i) const

determines whether a column with the given ID exists

◆ inc()

void JKQTPDatastore::inc ( size_t  column,
size_t  row,
double  increment = 1 
)
inline

increases entry in row row of column column by increment

See also
Example (JKQTPlotter): Filled Curve Plots

◆ resizeColumn()

void JKQTPDatastore::resizeColumn ( size_t  column,
size_t  new_rows 
)

resizes the column column to have new_rows rows

Warning
This changes the column length (number of rows). If the memory was externally managed before, it will be internally managed afterwards .
See also
resizeImageColumn(), appendToColumn()

◆ resizeImageColumn()

void JKQTPDatastore::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 * new_image_height pixels, also sets the internally store image size in the column!

Warning
This changes the column length (number of rows). If the memory was externally managed before, it will be internally managed afterwards .
See also
resizeColumn(), appendToColumn()

◆ saveCSV() [1/2]

void JKQTPDatastore::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

Parameters
filenamethe file to create
userColumnsa list of all columns to export, an empty list means: export all, the indexes in the list refer to getColumnsNames()
separatorthe column separator char
decimal_separatorthe decimal separator ('.' by default)
commentcomments are started with this string and end with a linebreak. If this parameter is empty no comments will be output
aroundStringsstrings (in column headers) are surrounded by these characters!
floatformata printf format string that is used to print floating point numbers to the file

Here are some default configuration:

  • saveCSV(filename, ", ", ".", "#") will generate a standard CSV file with commas between the columns and a point as decimal separator. Comments start with #
  • saveCSV(filename, "; ", ",", "") will generate a CSV file which may be read by a german Excel version: separated by ; and comma as decimal separator
  • saveCSV(filename, "\t", ".", "#") will generate a tab separated values file
  • ...

◆ saveCSV() [2/2]

void JKQTPDatastore::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

Parameters
txtQTextStream to write to
userColumnsa list of all columns to export, an empty list means: export all, the indexes in the list refer to getColumnsNames()
separatorthe column separator char
decimal_separatorthe decimal separator ('.' by default)
commentcomments are started with this string and end with a linebreak. If this parameter is empty no comments will be output
aroundStringsstrings (in column headers) are surrounded by these characters!
floatformata printf format string that is used to print floating point numbers to the file

Here are some default configuration:

  • saveCSV(filename, ", ", ".", "#") will generate a standard CSV file with commas between the columns and a point as decimal separator. Comments start with #
  • saveCSV(filename, "; ", ",", "") will generate a CSV file which may be read by a german Excel version: separated by ; and comma as decimal separator
  • saveCSV(filename, "\t", ".", "#") will generate a tab separated values file
  • ...

◆ saveDIF()

void JKQTPDatastore::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)

Parameters
filenamethe file to create
userColumnsa list of all columns to export, an empty list means: export all, the indexes in the list refer to getColumnsNames()
floatformata printf format string that is used to print floating point numbers to the file

◆ saveMatlab() [1/2]

void JKQTPDatastore::saveMatlab ( const QString &  filename,
const QSet< int > &  userColumns = QSet< int >() 
) const

save contents of datastore as a Matlab script

Parameters
filenamethe file to create
userColumnsa list of all columns to export, an empty list means: export all, the indexes in the list refer to getColumnsNames()

◆ saveMatlab() [2/2]

void JKQTPDatastore::saveMatlab ( QTextStream &  txt,
const QSet< int > &  userColumns = QSet< int >() 
) const

save contents of datastore as a Matlab script

Parameters
txtthe QTextStream to write to
userColumnsa list of all columns to export, an empty list means: export all, the indexes in the list refer to getColumnsNames()

◆ saveSYLK()

void JKQTPDatastore::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)

Parameters
filenamethe file to create
userColumnsa list of all columns to export, an empty list means: export all, the indexes in the list refer to getColumnsNames()
floatformata printf format string that is used to print floating point numbers to the file

◆ scaleColumnValues()

void JKQTPDatastore::scaleColumnValues ( size_t  column,
double  factor 
)
inline

scales (multiplies) all entries in column column by factor

See also
Example (JKQTPlotter): Filled Curve Plots

◆ set() [1/2]

void JKQTPDatastore::set ( int  column,
size_t  row,
double  value 
)
inline

sets the value at position (column, row). column is the logical column and will be mapped to the according memory block internally!)

◆ set() [2/2]

void JKQTPDatastore::set ( size_t  column,
size_t  row,
double  value 
)
inline

sets the value at position (column, row). column is the logical column and will be mapped to the according memory block internally!)

◆ setAll()

void JKQTPDatastore::setAll ( size_t  column,
double  value 
)
inline

sets all entries in column column to value

See also
Example (JKQTPlotter): Filled Curve Plots

◆ setColumnCopiedData()

void JKQTPDatastore::setColumnCopiedData ( size_t  toColumn,
const double *  data,
size_t  N 
)

copies the data from data into an existing column toColumn

Parameters
toColumntarget of the copy operation
datadata to copy
Nentries in data
Warning
If the memory in toColumn was externally managed before, it will be internally managed afterwards!

◆ setColumnCopiedImageData()

void JKQTPDatastore::setColumnCopiedImageData ( size_t  toColumn,
const double *  data,
size_t  width,
size_t  height 
)

copies the image data from data into an existing column toColumn

Parameters
toColumntarget of the copy operation
datadata to copy, size is width * height
widthnumber of columns in data
heightnumber of rows in data
Warning
If the memory in toColumn was externally managed before, it will be internally managed afterwards!

◆ setColumnData()

void JKQTPDatastore::setColumnData ( size_t  toColumn,
const QVector< double > &  data 
)

copies the data from data into an existing column toColumn

Parameters
toColumntarget of the copy operation
datadata to copy
Warning
If the memory in toColumn was externally managed before, it will be internally managed afterwards!

◆ setColumnImageHeight()

void JKQTPDatastore::setColumnImageHeight ( size_t  column,
size_t  imageHeight 
)

sets the height of the image, represented by column (in row-major ordering) to imageHeight

◆ setColumnImageWidth()

void JKQTPDatastore::setColumnImageWidth ( size_t  column,
size_t  imageWidth 
)

sets the width of the image, represented by column (in row-major ordering) to imageWidth

◆ setPixel()

void JKQTPDatastore::setPixel ( size_t  column,
size_t  x,
size_t  y,
double  value 
)
inline

returns the value at position (x, y) in the column-th column, which is interpreted with the imageWidth stored in that column

Friends And Related Symbol Documentation

◆ JKQTPColumn

friend class JKQTPColumn
friend

◆ JKQTPDatastoreItem

friend class JKQTPDatastoreItem
friend

◆ JKQTPDatastoreModel

friend class JKQTPDatastoreModel
friend

Member Data Documentation

◆ columns

QMap<size_t, JKQTPColumn> JKQTPDatastore::columns
private

a std::vector of all columns that may be used to access the managed chunks of memory.

◆ items

QMap<size_t, JKQTPDatastoreItem*> JKQTPDatastore::items
private

a std::vector that contains all items managed by this datastore

◆ m_invalidColumn

std::unique_ptr<JKQTPColumn> JKQTPDatastore::m_invalidColumn
private

an internal invalid column object, used e.g. to return invalid column iterators

◆ maxColumnsID

size_t JKQTPDatastore::maxColumnsID
private

internal variable to keep track about the highest column ID (in columns) used so far

See also
columns

◆ maxItemID

size_t JKQTPDatastore::maxItemID
private

internal variable to keep track about the highest item ID (in items) used so far

See also
items

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