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_PARAMETERS>
35 Read(
const std::uint8_t*
data, std::size_t size)
37 if (size < (NUM_OF_PARAMETERS *
sizeof(T)))
41 const std::uint8_t* start_ptr =
data;
42 mkarray<T, NUM_OF_PARAMETERS>(start_ptr, this->data);
48 std::array<T, NUM_OF_PARAMETERS>
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