| IOLink 1.11.0

Loading...
Searching...
No Matches
VariantDataValueConverter.h
1#pragma once
2
3#include <iolink/IOLinkAPI.h>
4#include <iolink/VariantDataValue.h>
5
6 namespace iolink
7{
11 class IOLINK_API VariantDataValueConverter
12{
13 public:
19 static int8_t toInt8(std::shared_ptr<VariantDataValue> value);
20
26 static int16_t toInt16(std::shared_ptr<VariantDataValue> value);
27
33 static int32_t toInt32(std::shared_ptr<VariantDataValue> value);
34
40 static int64_t toInt64(std::shared_ptr<VariantDataValue> value);
41
47 static uint8_t toUint8(std::shared_ptr<VariantDataValue> value);
48
54 static uint16_t toUint16(std::shared_ptr<VariantDataValue> value);
55
61 static uint32_t toUint32(std::shared_ptr<VariantDataValue> value);
62
68 static uint64_t toUint64(std::shared_ptr<VariantDataValue> value);
69
75 static float toFloat(std::shared_ptr<VariantDataValue> value);
76
82 static double toDouble(std::shared_ptr<VariantDataValue> value);
83
89 static std::string toString(std::shared_ptr<VariantDataValue> value);
90
91 //===================================================================
92 //======== Array extraction =========================================
93 //===================================================================
94
104 static size_t toInt8Array(std::shared_ptr<VariantDataValue> variant, int8_t* values, size_t count);
105
115 static size_t toInt16Array(std::shared_ptr<VariantDataValue> variant, int16_t* values, size_t count);
116
126 static size_t toInt32Array(std::shared_ptr<VariantDataValue> variant, int32_t* values, size_t count);
127
137 static size_t toInt64Array(std::shared_ptr<VariantDataValue> variant, int64_t* values, size_t count);
138
148 static size_t toUint8Array(std::shared_ptr<VariantDataValue> variant, uint8_t* values, size_t count);
149
159 static size_t toUint16Array(std::shared_ptr<VariantDataValue> variant, uint16_t* values, size_t count);
160
170 static size_t toUint32Array(std::shared_ptr<VariantDataValue> variant, uint32_t* values, size_t count);
171
181 static size_t toUint64Array(std::shared_ptr<VariantDataValue> variant, uint64_t* values, size_t count);
182
192 static size_t toFloatArray(std::shared_ptr<VariantDataValue> variant, float* values, size_t count);
193
203 static size_t toDoubleArray(std::shared_ptr<VariantDataValue> variant, double* values, size_t count);
204
214 static size_t toStringArray(std::shared_ptr<VariantDataValue> variant, std::string* values, size_t count);
215
216 //===================================================================
217 //======== Nth value of array extraction ===========================
218 //===================================================================
219
228 static int8_t toInt8(std::shared_ptr<VariantDataValue> variant, size_t index);
229
238 static int16_t toInt16(std::shared_ptr<VariantDataValue> variant, size_t index);
239
248 static int32_t toInt32(std::shared_ptr<VariantDataValue> variant, size_t index);
249
258 static int64_t toInt64(std::shared_ptr<VariantDataValue> variant, size_t index);
259
268 static uint8_t toUint8(std::shared_ptr<VariantDataValue> variant, size_t index);
269
278 static uint16_t toUint16(std::shared_ptr<VariantDataValue> variant, size_t index);
279
288 static uint32_t toUint32(std::shared_ptr<VariantDataValue> variant, size_t index);
289
298 static uint64_t toUint64(std::shared_ptr<VariantDataValue> variant, size_t index);
299
308 static float toFloat(std::shared_ptr<VariantDataValue> variant, size_t index);
309
318 static double toDouble(std::shared_ptr<VariantDataValue> variant, size_t index);
319
328 static std::string toString(std::shared_ptr<VariantDataValue> variant, size_t index);
329};
330
331} // end namespace iolink
iolink::VariantDataValueConverter
Converter contains a set of method allowing to interpret a VariantDataValue as a determined type.
Definition VariantDataValueConverter.h:12
iolink::VariantDataValueConverter::toStringArray
static size_t toStringArray(std::shared_ptr< VariantDataValue > variant, std::string *values, size_t count)
Convert VariantDataValues into string.
iolink::VariantDataValueConverter::toUint32Array
static size_t toUint32Array(std::shared_ptr< VariantDataValue > variant, uint32_t *values, size_t count)
Convert VariantDataValues into 32-bit unsigned integers.
iolink::VariantDataValueConverter::toDouble
static double toDouble(std::shared_ptr< VariantDataValue > value)
Return converted metadata value into 64-bit floats.
iolink::VariantDataValueConverter::toString
static std::string toString(std::shared_ptr< VariantDataValue > variant, size_t index)
Convert VariantDataValue at given index into string.
iolink::VariantDataValueConverter::toInt16Array
static size_t toInt16Array(std::shared_ptr< VariantDataValue > variant, int16_t *values, size_t count)
Convert VariantDataValues into 16-bit signed integers.
iolink::VariantDataValueConverter::toInt16
static int16_t toInt16(std::shared_ptr< VariantDataValue > variant, size_t index)
Convert VariantDataValue at given index into 16-bit signed integers.
iolink::VariantDataValueConverter::toUint16
static uint16_t toUint16(std::shared_ptr< VariantDataValue > value)
Return converted metadata value into 16-bit unsigned integers.
iolink::VariantDataValueConverter::toUint8Array
static size_t toUint8Array(std::shared_ptr< VariantDataValue > variant, uint8_t *values, size_t count)
Convert VariantDataValues into 8-bit unsigned integers.
iolink::VariantDataValueConverter::toUint32
static uint32_t toUint32(std::shared_ptr< VariantDataValue > value)
Return converted metadata value into 32-bit unsigned integers.
iolink::VariantDataValueConverter::toFloat
static float toFloat(std::shared_ptr< VariantDataValue > value)
Return converted metadata value into 32-bit floating-point.
iolink::VariantDataValueConverter::toInt32
static int32_t toInt32(std::shared_ptr< VariantDataValue > value)
Return converted metadata value into 32-bit signed integers.
iolink::VariantDataValueConverter::toInt8
static int8_t toInt8(std::shared_ptr< VariantDataValue > variant, size_t index)
Convert VariantDataValue at given index into 8-bit signed integers.
iolink::VariantDataValueConverter::toString
static std::string toString(std::shared_ptr< VariantDataValue > value)
Return converted metadata value into string.
iolink::VariantDataValueConverter::toUint64
static uint64_t toUint64(std::shared_ptr< VariantDataValue > variant, size_t index)
Convert VariantDataValue at given index into 64-bit unsigned integers.
iolink::VariantDataValueConverter::toInt8Array
static size_t toInt8Array(std::shared_ptr< VariantDataValue > variant, int8_t *values, size_t count)
Convert VariantDataValues into 8-bit signed integers.
iolink::VariantDataValueConverter::toInt8
static int8_t toInt8(std::shared_ptr< VariantDataValue > value)
Return converted metadata value into 8-bit signed integers.
iolink::VariantDataValueConverter::toDouble
static double toDouble(std::shared_ptr< VariantDataValue > variant, size_t index)
Convert VariantDataValue at given index into 64-bit floats.
iolink::VariantDataValueConverter::toInt64
static int64_t toInt64(std::shared_ptr< VariantDataValue > variant, size_t index)
Convert VariantDataValue at given index into 64-bit signed integers.
iolink::VariantDataValueConverter::toDoubleArray
static size_t toDoubleArray(std::shared_ptr< VariantDataValue > variant, double *values, size_t count)
Convert VariantDataValues into 64-bit floats.
iolink::VariantDataValueConverter::toInt32Array
static size_t toInt32Array(std::shared_ptr< VariantDataValue > variant, int32_t *values, size_t count)
Convert VariantDataValues into 32-bit signed integers.
iolink::VariantDataValueConverter::toInt16
static int16_t toInt16(std::shared_ptr< VariantDataValue > value)
Return converted metadata value into 16-bit signed integers.
iolink::VariantDataValueConverter::toUint8
static uint8_t toUint8(std::shared_ptr< VariantDataValue > variant, size_t index)
Convert VariantDataValue at given index into 8-bit unsigned integers.
iolink::VariantDataValueConverter::toUint16
static uint16_t toUint16(std::shared_ptr< VariantDataValue > variant, size_t index)
Convert VariantDataValue at given index into 16-bit unsigned integers.
iolink::VariantDataValueConverter::toUint64Array
static size_t toUint64Array(std::shared_ptr< VariantDataValue > variant, uint64_t *values, size_t count)
Convert VariantDataValues into 64-bit signed integers.
iolink::VariantDataValueConverter::toUint32
static uint32_t toUint32(std::shared_ptr< VariantDataValue > variant, size_t index)
Convert VariantDataValue at given index into 32-bit unsigned integers.
iolink::VariantDataValueConverter::toInt64Array
static size_t toInt64Array(std::shared_ptr< VariantDataValue > variant, int64_t *values, size_t count)
Convert VariantDataValues into 64-bit signed integers.
iolink::VariantDataValueConverter::toInt64
static int64_t toInt64(std::shared_ptr< VariantDataValue > value)
Return converted metadata value into 64-bit signed integers.
iolink::VariantDataValueConverter::toInt32
static int32_t toInt32(std::shared_ptr< VariantDataValue > variant, size_t index)
Convert VariantDataValue at given index into 32-bit signed integers.
iolink::VariantDataValueConverter::toFloatArray
static size_t toFloatArray(std::shared_ptr< VariantDataValue > variant, float *values, size_t count)
Convert VariantDataValues into 32-bit floating-point.
iolink::VariantDataValueConverter::toUint16Array
static size_t toUint16Array(std::shared_ptr< VariantDataValue > variant, uint16_t *values, size_t count)
Convert VariantDataValues into 16-bit unsigned integers.
iolink::VariantDataValueConverter::toUint8
static uint8_t toUint8(std::shared_ptr< VariantDataValue > value)
Return converted metadata value into 8-bit unsigned integers.
iolink::VariantDataValueConverter::toUint64
static uint64_t toUint64(std::shared_ptr< VariantDataValue > value)
Return converted metadata value into 32-bit signed integers.
iolink::VariantDataValueConverter::toFloat
static float toFloat(std::shared_ptr< VariantDataValue > variant, size_t index)
Convert VariantDataValue at given index into 32-bit floating-point.
iolink
All IOLink symbols are enclosed in this namespace.
Definition ArrayX.h:8