IOLink 1.11.0
Loading...
Searching...
No Matches
iolink::ColumnUnitExtension Class Referenceabstract

Extension to handle units of columns in a dataframe. More...

#include <iolink/view/ColumnUnitExtension.h>

Inheritance diagram for iolink::ColumnUnitExtension:
iolink::Extension

Public Member Functions

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 Public Member Functions

static std::shared_ptr< ColumnUnitExtensioncast (const std::shared_ptr< Extension > &extension)
 Upcast a generic extension to this specific type.
 

Static Public Attributes

static constexpr size_t EXTENSION_ID = 0x4
 Identifier used to load the extension using the View::extension method.
 

Detailed Description

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".

Member Function Documentation

◆ cast()

static std::shared_ptr< ColumnUnitExtension > iolink::ColumnUnitExtension::cast ( const std::shared_ptr< Extension > &  extension)
inlinestatic

Upcast a generic extension to this specific type.

Parameters
extensionThe 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
columnIndexThe index of the column.
unitThe unit of the column.
Exceptions
Errorif the column index is out of range.
Errorif DataFrameView does not have the WRITE capability.

◆ unit()

virtual const std::string & iolink::ColumnUnitExtension::unit ( size_t  columnIndex) const
pure virtual

Return the unit of the column.

Parameters
columnIndexThe index of the column.
Returns
The unit of the column.
Exceptions
Errorif the column index is out of range.

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