6 #ifndef IFM3D_DESERIALIZE_UTILS_HPP
7 #define IFM3D_DESERIALIZE_UTILS_HPP
11 #include <ifm3d/device/err.h>
12 #include <ifm3d/fg/buffer.h>
13 #include <ifm3d/fg/organizer_utils.h>
18 template <
typename T, std::
size_t n>
20 mkarray(
const std::uint8_t* data, std::array<T, n>& arr)
22 int element_index = 0;
25 val = mkval<T>(data +
sizeof(T) * element_index);
30 template <
typename T, std::
size_t num_of_parameter>
35 Read(
const std::uint8_t*
data, std::size_t size)
37 if (size < (num_of_parameter *
sizeof(T)))
41 const std::uint8_t* start_ptr =
data;
42 mkarray<T, num_of_parameter>(start_ptr, this->data);
48 std::array<T, num_of_parameter>
data;
51 Deserialize(
const Buffer& o3d_buffer)
55 data.Read(o3d_buffer.
ptr<uint8_t>(0), o3d_buffer.
size());
62 #endif // IFM3D_DESERIALIZE_UTILS_HPP