![]() |
IOLink IOL_v1.8.0_release
|
View to model tabular data. More...
#include <iolink/view/DataFrameView.h>
Public Member Functions | |
virtual DataFrameCapabilitySet | capabilities () const =0 |
Return the view's capabilities. | |
virtual const Vector2u64 & | shape () const =0 |
Return the shape of the data frame. | |
virtual const std::string & | columnName (size_t index) const =0 |
Get the name of a column from its index. | |
virtual size_t | columnIndex (const std::string &name) const =0 |
Get the index of a column from its name. | |
virtual DataType | columnDataType (size_t index) const =0 |
Return the data type of the column. | |
virtual void | read (size_t column, size_t offset, size_t count, void *dst) const |
Read data from a column. | |
template<typename T > | |
T | at (size_t column, size_t row) const |
Get the value stored in a cell of the data frame. | |
template<typename T > | |
T | at (const std::string &columnName, size_t row) const |
Get the value stored in a cell of the data frame. | |
virtual void | write (size_t column, size_t offset, size_t count, const void *src) |
Write data into a column. | |
template<typename T > | |
void | setAt (size_t column, size_t row, T value) |
Set the element value in a cell of the data frame. | |
template<typename T > | |
void | setAt (const std::string &columnName, size_t row, T value) |
Set the element value in a cell of the data frame. | |
virtual void | addColumn (const std::string &name, DataType dtype) |
Add a column to the dataframe. | |
virtual void | addRows (size_t offset, size_t count) |
Insert rows at the specified position. | |
virtual void | removeColumn (size_t index) |
Remove a column. | |
virtual void | removeRows (size_t offset, size_t count) |
Remove a continuous set of rows. | |
std::string | toString () const |
Return a string representation. | |
![]() | |
virtual std::shared_ptr< Extension > | extension (size_t id) |
Get an extension of the view, corresponding to the given identifier. | |
std::shared_ptr< ViewOriginExtension > | viewOrigin () |
Shortcut to access to ViewOrigin extension. | |
View to model tabular data.
This view is composed of a set of columns, that have a name and a data type. A column's name is unique, and columns in a dataframe can have different data types.
Each column has the same number of elements. The aggregate of all n-th elements of columns are a row of the dataframe.
|
virtual |
Add a column to the dataframe.
This method requires the RESHAPE capability.
The new column's data will be undefined after addition.
name | The name of the new column. |
dtype | The type of data stored in the column. |
NotImplemented | When the view does not support reshaping. |
Error | if there is already a column with the same name. |
Error | if the implementation does not support the data type. |
|
virtual |
Insert rows at the specified position.
This method requires the RESHAPE capability.
New rows content will be undefined after insertion.
offset | New rows will be inserted before this row. If the offset is the number of rows in the dataframe, rows will be inserted at the end. |
count | The number of rows to insert. |
NotImplemented | When the view does not support reshaping. |
Error | When offset is out of bounds. |
Error | When it is impossible to add these rows. |
|
inline |
Get the value stored in a cell of the data frame.
T | The type of the data stored in the cell. |
columnName | The name of the column where to get the cell. |
row | The index of the row |
|
inline |
Get the value stored in a cell of the data frame.
T | The type of the data stored in the cell. |
column | The index of the column |
row | The index of the row |
Error | if the column or the cell index is out of bounds. |
|
pure virtual |
Return the view's capabilities.
|
pure virtual |
Return the data type of the column.
name | The index of the column. |
Error | When index is out of range. |
|
pure virtual |
Get the index of a column from its name.
name | The name of the column. |
Error | If there is no column with that name. |
|
pure virtual |
Get the name of a column from its index.
Column indices go from 0 to shape[0] - 1.
index | The index of the column. |
Error | If index is out of range. |
|
virtual |
Read data from a column.
This method requires the READ capability.
When reading numeric data, the dst buffer will be filled with continuous values. In the case of strings, it will be a continuous array of string objects.
The destination buffer must be allocated by the user. If its size is under the byte count needed to store the request number of elements, a segmentation fault will rise, as there is no boundaries check.
column | The index of the column to read from. |
offset | The index of the first element to read. |
count | The number of elements to read. |
dst | A buffer where the read data will be written. |
NotImplemented | When the view does not support reading. |
Error | When dst is null. |
Error | When the column index is invalid. |
Error | When offset is out of bounds. |
Error | If it is impossible to read the number of elements required. |
|
virtual |
Remove a column.
This method requires the RESHAPE capability.
index | The index of the column to remove. |
NotImplemented | When the view does not support reshaping. |
Error | If the index is out of bounds. |
Error | When it is impossible to remove that column. |
|
virtual |
Remove a continuous set of rows.
This method requires the RESHAPE capability.
offset | The index of the first column to remove. |
count | Row count to delete. |
NotImplemented | When the view does not support reshaping. |
Error | When offset is out of bounds. |
Error | When it is impossible to remove these rows. |
|
inline |
Set the element value in a cell of the data frame.
T | The type of the data stored in the cell. |
columnName | The name of the column where to set the cell. |
row | The row of the cell to set. |
value | The value to store in the cell. |
|
inline |
Set the element value in a cell of the data frame.
T | The type of the data stored in the cell. |
column | The column of the cell to set. |
row | The row of the cell to set. |
value | The value to store in the cell. |
|
pure virtual |
Return the shape of the data frame.
First element being the number of columns, and the second, the number of rows.
|
virtual |
Write data into a column.
This method requires the WRITE capability.
When writing numeric data, the src buffer must be filled with continuous values. In the case of strings, the source must use a continuous array of string objects.
The source buffer must be allocated by the user. If its size is under the byte count needed to store the request number of elements, a segmentation fault will rise, as there is no boundaries check.
column | The index of the column to write into. |
offset | The index of the first element to write. |
count | The number of element to write. |
dst | A buffer whose content will be written in the column. |
NotImplemented | When the view does not support writing. |
Error | When src is null. |
Error | When the column index is invalid. |
Error | When offset is out of bounds. |
Error | If it is impossible to write the number of elements required. |