MIP_SDK  v3.0.0
MicroStrain Communications Library for embedded systems
mip_serialization.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include <type_traits>
6 #include <stddef.h>
7 
8 
9 namespace mip
10 {
11 
13 
14 namespace serialization
15 {
16  using namespace microstrain::serialization;
18 
19 } // namespace serialization
20 
23 
24 // Explicitly overload insert/extract versions that take raw buffers
25 // since the endianness can't be deduced from the arguments.
26 
27 template<class T>
28 inline bool extract(T& object, const uint8_t* buffer, size_t bufferLength, size_t offset=0, bool exactSize=false)
29 {
30  using namespace microstrain::serialization;
31  return extract<Endian::big>(object, buffer, bufferLength, offset, exactSize);
32 }
33 
34 template<class T>
35 inline bool insert(const T& object, uint8_t* buffer, size_t bufferLength, size_t offset=0)
36 {
37  using namespace microstrain::serialization;
38  return insert<Endian::big>(object, buffer, bufferLength, offset);
39 }
40 
41 
42 } // namespace mip
43 
mip
A collection of C++ classes and functions covering the full mip api.
Definition: commands_3dm.c:11
microstrain::Serializer
Serializes or deserializes data to/from a byte buffer.
Definition: serializer.hpp:125
microstrain::serialization::big_endian
Definition: readwrite.hpp:59
microstrain::BigEndianSerializer
Serializer< serialization::Endian::big > BigEndianSerializer
Definition: serializer.hpp:139
serialization.hpp
microstrain::insert
std::enable_if< std::is_arithmetic< T >::value, size_t >::type insert(Serializer< E > &buffer, T value)
Inserts a numeric value to a Serializer.
Definition: serializer.hpp:172
mip::insert
size_t insert(Serializer &serializer, const Vector< T, N > &v)
Definition: common.hpp:130
microstrain::serialization
Definition: readwrite.hpp:35
microstrain::extract
std::enable_if< std::is_arithmetic< T >::value, size_t >::type extract(Serializer< E > &buffer, T &value)
Reads a numeric value from a Serializer.
Definition: serializer.hpp:193
mip::extract
size_t extract(Serializer &serializer, Vector< T, N > &v)
Definition: common.hpp:133