#include <array>
#include <cstddef>
#include <iostream>
template <>
struct TypeConverter<std::byte> {
using ValueType = std::byte;
static void fromNative(NativeType src, ValueType& dst) {
dst = std::byte(src);
}
static void toNative(ValueType src, NativeType& dst) {
dst = std::to_integer<UA_Byte>(src);
}
};
}
int main() {
std::cout << "Byte value: " << std::to_integer<int>(value) << std::endl;
std::cout << "Byte value: " << static_cast<int>(valueNative) << std::endl;
std::array<std::byte, 3> array{};
}
View to a contiguous sequence of objects, similar to std::span in C++20.
constexpr pointer data() const noexcept
UA_Variant wrapper class.
T getScalarCopy() const
Get copy of scalar value with given template type.
void setArrayCopy(const ArrayLike &array)
Copy array to variant.
size_t getArrayLength() const noexcept
Get array length or 0 if variant is not an array.
void setScalarCopy(const T &value)
Copy scalar value to variant.
T & getScalar() &
Get reference to scalar value with given template type (only native or wrapper types).