IOLink IOL_v1.8.0_release
|
Stores information about a data type. More...
#include <iolink/DataType.h>
Public Member Functions | |
DataType () noexcept | |
Default constructor, creating an opaque type. | |
DataType (uint64_t value) noexcept | |
Build a DataType from an id. | |
DataType (DataTypeId value) noexcept | |
Build a DataType from a DataTypeId. | |
DataType (PrimitiveTypeId primitiveType, size_t dimension, size_t bitDepth, DataTypeInterpretation interpretation) noexcept | |
Build a DataType from its properties. | |
DataType (PrimitiveTypeId primitiveType, size_t dimension, size_t bitDepth) noexcept | |
Build a DataType from its properties. | |
bool | isNumeric () const |
Checks if the type is a mathematical one. | |
bool | isScalar () const |
Checks if the type is a scalar numeric value. | |
bool | isVector () const |
Checks if the type is a vector of numeric values. | |
bool | isConvertibleTo (DataType other) const |
Checks if this type is trivially convertible to another. | |
uint64_t | id () const noexcept |
Return unique id representing this datatype. | |
size_t | bitDepth () const noexcept |
Return the bit depth of this type. | |
size_t | elementCount () const noexcept |
Return the number of sub-values included in this type. | |
PrimitiveTypeId | primitiveType () const noexcept |
Return the primitive type of the current type. | |
DataTypeInterpretation | interpretation () const noexcept |
The DataType interpretation. | |
size_t | bitCount () const |
Get the number of bits required to store the type. | |
size_t | byteCount () const |
Get the number of bits required to store the type. | |
std::string | toString () const |
Return a readable version of the DataType. | |
bool | operator== (DataType other) const |
bool | operator!= (DataType other) const |
Static Public Member Functions | |
static DataType | extractScalarType (DataType dtype) |
Return scalar type in case of multi dimensionnal DataType. | |
static Vector2d | standardRange (DataType dtype) |
Return conventional range for given DataType. | |
Stores information about a data type.
DataType is associated with an ID, with wich the type can be uniquely identified. Although this ID is composed of multiple fields:
See user guide for more explainations.
These fields can have different meaning bases on the scalar type or the flags. For example the bitDepth field indicate the precision for integer and floating point types, and the size of a coding point in an unicode string.
|
noexcept |
Default constructor, creating an opaque type.
|
inlinenoexcept |
Return the bit depth of this type.
(i.e. UINT8 => 8 bit depth, VEC3_UINT16 => 16 bit depth)
|
inline |
Get the number of bits required to store the type.
If the number of bits required to store the type is not aligned to a byte, the number of byte will be rounded up. For example, a 12 bits integer type will have a byte count of 2.
|
inlinenoexcept |
Return the number of sub-values included in this type.
For example:
Return scalar type in case of multi dimensionnal DataType.
If the type is already scalar, it return itself.
|
noexcept |
Return unique id representing this datatype.
Can be used inside a switch/case statement.
|
inlinenoexcept |
The DataType interpretation.
bool iolink::DataType::isConvertibleTo | ( | DataType | other | ) | const |
Checks if this type is trivially convertible to another.
|
inlinenoexcept |
Return the primitive type of the current type.
for example: UINT8 => UNSIGNED_INTEGER
Return conventional range for given DataType.
By convention, range for INTEGER types are classical min and max representable values.
Range for FLOATING_POINT type is [0, 1]
As returned range is DOUBLE precison, returned value is imprecise for INT64 and UINT64 type.
Error | If no range can be computed for this type. |