![]() |
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
|
this represents one chunk of memory which can represent one or more columns of data for JKQTBasePlotter. See JKQTPDatastore for more information. More...
#include <jkqtpdatastorage.h>
Public Member Functions | |
| JKQTPDatastoreItem (const QVector< double > &data) | |
| class constructor: initializes the object for internal data storage with the given data | |
| JKQTPDatastoreItem (JKQTPDatastoreItemFormat dataformat, double *data, size_t columns, size_t rows) | |
| class constructor: initializes the object for external data storage | |
| JKQTPDatastoreItem (JKQTPDatastoreItemFormat dataformat, double *data, size_t columns, size_t rows, bool storageType) | |
| class constructor: initializes the object for external data storage | |
| JKQTPDatastoreItem (QVector< double > &&data) | |
| class constructor: initializes the object for internal data storage with the given data | |
| JKQTPDatastoreItem (size_t columns, size_t rows) | |
| class constructor: initializes the object for internal data storage | |
| ~JKQTPDatastoreItem () | |
| class destructor: frees unfreed internal memory | |
| bool | append (size_t column, const QVector< double > &values) |
adds new rows to the given column. Returns true on success and false else | |
| bool | append (size_t column, const std::vector< double > &values) |
adds new rows to the given column. Returns true on success and false else | |
| bool | append (size_t column, double value) |
adds a new row to the given column. Returns true on success and false else | |
| double & | at (size_t column, size_t row) |
| returns a reference to the data at the position (column, row ). Throws an exception when the entry does not exist! | |
| const double & | at (size_t column, size_t row) const |
| returns a const reference to the data at the position (column, row ). Throws an exception when the entry does not exist! | |
| void | eraseFromVectorItem (size_t row) |
if isValid() : eraseFromVectorItem the row row | |
| void | eraseFromVectorItem (size_t row, size_t rowEnd) |
if isValid() : eraseFromVectorItem all rows (and including) from row to rowEnd | |
| double | get (size_t column, size_t row) |
| returns the data at the position (column, row ). | |
| size_t | getColumns () const |
| as data may also point to a matrix, this specifies the number of columns in this element (default: 1) | |
| double * | getPointer (size_t column, size_t row) |
| returns the data at the position (column, row ). The column index specifies the column inside THIS item, not the global column number. | |
| const double * | getPointer (size_t column, size_t row) const |
| returns the data at the position (column, row ). The column index specifies the column inside THIS item, not the global column number. | |
| size_t | getRows () const |
| number of rows in this item | |
| bool | isVector () const |
| checks whether dataformat==JKQTPDatastoreItemFormat::SingleColumn and storageType==StorageType::Vector | |
| bool | push_back (size_t column, double value) |
adds a new row to the given column. Returns true on success and false else | |
| void | reserveVectorColumn (size_t rows) |
| reserves memory for the vector holding the data in this column | |
| bool | resizeColumns (size_t rows) |
change the size of all columns to the givne number of rows. Returns true if the old data could be retained/saved and false if the old data was lost (which happens in most of the cases!) | |
| void | resizeVectorItem (size_t rows_new) |
if isValid() : resizeVectorItem the row to have rows_new rows | |
| void | set (size_t column, size_t row, double value) |
| set the data at the position (column, row ) to value. The column index specifies the column inside THIS item, not the global column number. | |
Protected Member Functions | |
| JKQTPDatastoreItem () | |
| hidden default constructor | |
Private Types | |
| enum class | StorageType { Internal , External , Vector } |
| how data is represented in this JKQTPDatastoreItem More... | |
Private Attributes | |
| bool | allocated |
Specifies whether memory for the data has been allocated. This is only used, when internal==true. | |
| size_t | columns |
| as data may also point to a matrix, this specifies the number of columns in this element (default: 1) | |
| double * | data |
| a pointer to the actual data | |
| JKQTPDatastoreItemFormat | dataformat |
| memory format of the data in this item | |
| QVector< double > | datavec |
iif storageType is StorageType::Vector, the data is actually save here and data contains a pointer to the data in datavec | |
| size_t | rows |
| number of rows in this item | |
| StorageType | storageType |
specifies whether the datastore manages the memory (true ) or whether the user application does this (false ) . | |
this represents one chunk of memory which can represent one or more columns of data for JKQTBasePlotter. See JKQTPDatastore for more information.
Each chunk of memory is pointed at by a simple double* pointer data. the memory layout of the memory layout of the RAM segment pointed at by data is determined by the parameter dataformat: the types of data in one JKQTdatastoreItem
JKQTPSingleColumn:
+-----+-----+-----+....................+-----+ | 0 | 1 | 2 | + N-1 | +-----+-----+-----+....................+-----+
JKQTPMatrixColumn:
================= COLUMN 1 ================= ================= COLUMN 2 ================= +-----+-----+-----+....................+-----++-----+-----+-----+....................+-----+ ..... | 0 | 1 | 2 | + N-1 || 0 | 1 | 2 | + N-1 | +-----+-----+-----+....................+-----++-----+-----+-----+....................+-----+ ..... =R1== =R2== =R3== =RN== =R1== =R2== =R3== =RN==
JKQTPMatrixRow (C standard representation of matrices):
================== ROW 1 ================== ================== ROW 2 ================== +-----+-----+-----+....................+-----++-----+-----+-----+....................+-----+ ..... | 0 | 1 | 2 | + N-1 || 0 | 1 | 2 | + N-1 | +-----+-----+-----+....................+-----++-----+-----+-----+....................+-----+ ..... =C1== =C2== =C3== =CN== =C1== =C2== =C3== =CN==
The properties columns and rows determine how many columns and rows are represented by this item (access via getColumns() and getRows() ). This class may manage chunks of "internal" and "external" memory (which is indicated by the boolean property internal. Internal memory will be allocated (in the constructor) and freed (in the destructor) by this object. External memory may be accessed via this class, but will neither by allocated nor freed. These tasks are up to the user. Use this option, if you don't want to generate copies of huge datasets, or you want to change the data while the program is running and don't want to do the change at more than one spot.
you can use get() and set() to access the memory chunc.
|
strongprivate |
how data is represented in this JKQTPDatastoreItem
|
protected |
hidden default constructor
| JKQTPDatastoreItem::JKQTPDatastoreItem | ( | size_t | columns, |
| size_t | rows ) |
class constructor: initializes the object for internal data storage
| JKQTPDatastoreItem::JKQTPDatastoreItem | ( | const QVector< double > & | data | ) |
class constructor: initializes the object for internal data storage with the given data
| JKQTPDatastoreItem::JKQTPDatastoreItem | ( | QVector< double > && | data | ) |
class constructor: initializes the object for internal data storage with the given data
| JKQTPDatastoreItem::JKQTPDatastoreItem | ( | JKQTPDatastoreItemFormat | dataformat, |
| double * | data, | ||
| size_t | columns, | ||
| size_t | rows ) |
class constructor: initializes the object for external data storage
| JKQTPDatastoreItem::JKQTPDatastoreItem | ( | JKQTPDatastoreItemFormat | dataformat, |
| double * | data, | ||
| size_t | columns, | ||
| size_t | rows, | ||
| bool | storageType ) |
class constructor: initializes the object for external data storage
| JKQTPDatastoreItem::~JKQTPDatastoreItem | ( | ) |
class destructor: frees unfreed internal memory
|
inline |
adds new rows to the given column. Returns true on success and false else
| column | the column inside this item to append to (has to be 0 at the moment!) |
| values | the values to append |
true on successtorageType==StorageType::Vector, dataformat==JKQTPDatastoreItemFormat::SingleColumn and column==0 ! If any of these properties fail, the function returns false!
|
inline |
adds new rows to the given column. Returns true on success and false else
| column | the column inside this item to append to (has to be 0 at the moment!) |
| values | the values to append |
true on successtorageType==StorageType::Vector, dataformat==JKQTPDatastoreItemFormat::SingleColumn and column==0 ! If any of these properties fail, the function returns false!
|
inline |
adds a new row to the given column. Returns true on success and false else
| column | the column inside this item to append to (has to be 0 at the moment!) |
| value | the value to append |
true on successtorageType==StorageType::Vector, dataformat==JKQTPDatastoreItemFormat::SingleColumn and column==0 ! If any of these properties fail, the function returns false!
|
inline |
returns a reference to the data at the position (column, row ). Throws an exception when the entry does not exist!
|
inline |
returns a const reference to the data at the position (column, row ). Throws an exception when the entry does not exist!
|
inline |
if isValid() : eraseFromVectorItem the row row
true!!! In other cases this operation might require a reallocation or change of memory which cannot be performed within an item, but only on the level of columns or the datastore..
|
inline |
if isValid() : eraseFromVectorItem all rows (and including) from row to rowEnd
| row | first element to delete |
| rowEnd | last element to delet (inclusive!), if rowEnd >= getRows() then everything until the end of the vector is delete, starting with row |
true!!! In other cases this operation might require a reallocation or change of memory which cannot be performed within an item, but only on the level of columns or the datastore.
|
inline |
returns the data at the position (column, row ).
|
inline |
as data may also point to a matrix, this specifies the number of columns in this element (default: 1)
|
inline |
returns the data at the position (column, row ). The column index specifies the column inside THIS item, not the global column number.
|
inline |
returns the data at the position (column, row ). The column index specifies the column inside THIS item, not the global column number.
|
inline |
number of rows in this item
|
inline |
checks whether dataformat==JKQTPDatastoreItemFormat::SingleColumn and storageType==StorageType::Vector
|
inline |
adds a new row to the given column. Returns true on success and false else
| column | the column inside this item to append to (has to be 0 at the moment!) |
| value | the value to append |
true on successtorageType==StorageType::Vector, dataformat==JKQTPDatastoreItemFormat::SingleColumn and column==0 ! If any of these properties fail, the function returns false!
|
inline |
reserves memory for the vector holding the data in this column
true!!! | bool JKQTPDatastoreItem::resizeColumns | ( | size_t | rows | ) |
change the size of all columns to the givne number of rows. Returns true if the old data could be retained/saved and false if the old data was lost (which happens in most of the cases!)
|
inline |
if isValid() : resizeVectorItem the row to have rows_new rows
|
inline |
set the data at the position (column, row ) to value. The column index specifies the column inside THIS item, not the global column number.
|
private |
Specifies whether memory for the data has been allocated. This is only used, when internal==true.
|
private |
as data may also point to a matrix, this specifies the number of columns in this element (default: 1)
|
private |
a pointer to the actual data
|
private |
memory format of the data in this item
|
private |
iif storageType is StorageType::Vector, the data is actually save here and data contains a pointer to the data in datavec
|
private |
number of rows in this item
|
private |
specifies whether the datastore manages the memory (true ) or whether the user application does this (false ) .