Extension to handle units of columns in a dataframe.
More...
#include <iolink/view/ColumnUnitExtension.h>
|
virtual const std::string & | unit (size_t columnIndex) const =0 |
| Return the unit of the column.
|
|
virtual void | setUnit (size_t columnIndex, const std::string &unit)=0 |
| Set the unit of the column.
|
|
|
static constexpr size_t | EXTENSION_ID = 0x4 |
| Identifier used to load the extension using the View::extension method.
|
|
Extension to handle units of columns in a dataframe.
This extension allows to get and set the unit of a column in a dataframe.
The unit is an UTF-8 encoded string that describes the unit of the column, in a format described as follows:
- A scalar unit is an string of alphabetical characters, describing the base unit. For example, "m" for meters, "s" for seconds, or "Å" for angstroms.
- Such scalar can have a dimensional suffix, starting with the
^
character, followed by an integer number. this number may be prefixed by a sign, +
or -
.
- Unsuffixed units of unsuffixed units may be combined using the
/
or .
character, to form a compound unit. For example, "m/s" for meters per second.
- An empty unit, or "" is a valid unit, and is equivalent to a dimensionless unit.
Examples of such units:
- "m/s" or "m.s^-1" for meters per second.
- "µm^2" for square micrometers.
- "Ω.s^-1" for ohms per seconds, or more simply as siemens "S".
◆ cast()
Upcast a generic extension to this specific type.
- Parameters
-
extension | The extension to cast. |
- Returns
- The upcasted extension. This will be null if no upcasting is possible.
◆ setUnit()
virtual void iolink::ColumnUnitExtension::setUnit |
( |
size_t |
columnIndex, |
|
|
const std::string & |
unit |
|
) |
| |
|
pure virtual |
Set the unit of the column.
- Parameters
-
columnIndex | The index of the column. |
unit | The unit of the column. |
- Exceptions
-
◆ unit()
virtual const std::string & iolink::ColumnUnitExtension::unit |
( |
size_t |
columnIndex | ) |
const |
|
pure virtual |
Return the unit of the column.
- Parameters
-
columnIndex | The index of the column. |
- Returns
- The unit of the column.
- Exceptions
-
Error | if the column index is out of range. |
The documentation for this class was generated from the following file: