IOLink IOL_v1.8.0_release
Loading...
Searching...
No Matches
VariantDataValueConverter.h
1#pragma once
2
3#include <iolink/IOLinkAPI.h>
4#include <iolink/VariantDataValue.h>
5
6namespace iolink
7{
12{
13public:
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