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());
Definition: deserialize_utils.hpp:32
std::array< T, NUM_OF_PARAMETERS > data
array to hold deserialize values
Definition: deserialize_utils.hpp:43
The class Buffer represent a STL container to store data from the ifm devices in 2 dimension and supp...
Definition: buffer.h:99
T * Ptr(std::uint32_t row)
returns a pointer to the specified Buffer row.
size_t Size() const
Return the size of the buffer in bytes.
Exception wrapper for library and system errors encountered by the library.
Definition: err.h:115