MIP_SDK
v3.0.0
MicroStrain Communications Library for embedded systems
|
Go to the documentation of this file.
41 template<
typename T,
size_t N>
59 template<
typename U,
size_t M>
60 explicit Vector(
const U (&ptr)[M]) { static_assert(M>=N,
"Input array is too small");
copyFrom(ptr, M); }
72 template<
typename U,
typename V,
typename... Rest>
73 Vector(U u, V v, Rest... rest) : m_data{u, v, rest...} {}
91 operator T*() {
return m_data; }
92 operator const T*()
const {
return m_data; }
94 operator Array&() {
return m_data; }
96 operator const Array&()
const {
return m_data; }
105 void fill(U value) {
for(
size_t i=0; i<N; i++) m_data[i]=value; }
111 void copyFrom(
const U* ptr,
size_t n) {
if(n>N) n=N;
for(
size_t i=0; i<n; i++) m_data[i] = (T)ptr[i]; }
114 size_t size()
const {
return N; }
129 template<
typename T,
size_t N>
132 template<
typename T,
size_t N>
A collection of C++ classes and functions covering the full mip api.
Definition: commands_3dm.c:11
Serializes or deserializes data to/from a byte buffer.
Definition: serializer.hpp:125
Vector(const U *ptr, size_t n)
Definition: common.hpp:66
T Array[N]
Definition: common.hpp:86
Vector is a wrapper around an array of some type T, usually float or double.
Definition: common.hpp:42
bool extract(Ts &... values)
Deserializes one or more values.
Definition: serializer.hpp:949
void copyFrom(const U *ptr, size_t n)
Definition: common.hpp:111
uint16_t decimation
Definition: common.hpp:28
uint8_t descriptor
Definition: common.hpp:27
size_t insert(Serializer &serializer, const Vector< T, N > &v)
Definition: common.hpp:130
Vector & operator=(const Vector &)=default
Assignment operator.
size_t size() const
Get the size of the array.
Definition: common.hpp:114
Vector(const U(&ptr)[N])
Definition: common.hpp:55
Definition: common.hpp:25
Vector< float, 4 > Vector4f
Definition: common.hpp:121
const Array & data() const
Definition: common.hpp:101
Vector(const U(&ptr)[M])
Definition: common.hpp:60
size_t insert(Serializer &buffer) const
Definition: common.hpp:30
Vector()
Default constructor, no initialization.
Definition: common.hpp:45
void fill(U value)
Fill all elements with a given value.
Definition: common.hpp:105
Vector(U u, V v, Rest... rest)
Definition: common.hpp:73
size_t extract(Serializer &buffer)
Definition: common.hpp:31
Vector(U value)
Definition: common.hpp:50
Vector & operator=(const Vector< U, N > &other)
Assignment operator from different type (e.g. float to double).
Definition: common.hpp:83
bool insert(const Ts &... values)
Serializes one or more values.
Definition: serializer.hpp:923
size_t extract(Serializer &serializer, Vector< T, N > &v)
Definition: common.hpp:133
Array & data()
Explicitly convert to a C-style array.
Definition: common.hpp:100