9 #include "../aron_conversions/eigen.h"
16 template <
class ReaderT,
class EigenT,
int rows,
int cols,
int options>
21 typename ReaderT::InputType&
input,
24 std::string typeAsString;
25 std::vector<int> shape;
26 std::vector<unsigned char>
data;
27 aron_r.readNDArray(
input, shape, typeAsString,
data);
30 ss <<
"Received wrong dimensions for matrix member. Dimensions are " << shape.at(0)
31 <<
"," << shape.at(1) <<
" but should be " <<
ret.rows() <<
"/" <<
ret.cols();
36 "Received wrong typename",
40 ret.rows() == shape.at(0) and
ret.cols() == shape.at(1),
43 std::memcpy(
reinterpret_cast<unsigned char*
>(
ret.data()),
data.data(),
data.size());
46 template <
class ReaderT,
class EigenT,
int cols,
int options>
51 typename ReaderT::InputType&
input,
54 std::string typeAsString;
55 std::vector<int> shape;
56 std::vector<unsigned char>
data;
57 aron_r.readNDArray(
input, shape, typeAsString,
data);
59 ret.resize(shape.at(0));
62 ret.rows() == shape.at(0) and
ret.cols() == shape.at(1),
64 __PRETTY_FUNCTION__,
"Received wrong dimensions for member 'pose'."));
68 "Received wrong typename",
71 std::memcpy(
reinterpret_cast<unsigned char*
>(
ret.data()),
data.data(),
data.size());
74 template <
class ReaderT,
class EigenT,
int rows,
int options>
79 typename ReaderT::InputType&
input,
82 std::string typeAsString;
83 std::vector<int> shape;
84 std::vector<unsigned char>
data;
85 aron_r.readNDArray(
input, shape, typeAsString,
data);
87 ret.resize(shape.at(1));
90 ret.rows() == shape.at(0) and
ret.cols() == shape.at(1),
92 __PRETTY_FUNCTION__,
"Received wrong dimensions for member 'pose'."));
96 "Received wrong typename",
99 std::memcpy(
reinterpret_cast<unsigned char*
>(
ret.data()),
data.data(),
data.size());
102 template <
class ReaderT,
class EigenT,
int options>
107 typename ReaderT::InputType&
input,
110 std::string typeAsString;
111 std::vector<int> shape;
112 std::vector<unsigned char>
data;
113 aron_r.readNDArray(
input, shape, typeAsString,
data);
115 ret.resize(shape.at(0), shape.at(1));
118 ret.rows() == shape.at(0) and
ret.cols() == shape.at(1),
120 __PRETTY_FUNCTION__,
"Received wrong dimensions for member 'pose'."));
124 "Received wrong typename",
127 std::memcpy(
reinterpret_cast<unsigned char*
>(
ret.data()),
data.data(),
data.size());
130 template <
class WriterT,
class EigenT,
int rows,
int cols,
int options>
136 typename WriterT::ReturnType&
ret,
139 ret = aron_w.writeNDArray(
140 {
static_cast<int>(
input.rows()),
static_cast<int>(
input.cols()),
sizeof(EigenT)},
142 reinterpret_cast<const unsigned char*
>(
input.data()),
146 template <
class ReaderT,
class EigenT>
150 read(ReaderT& aron_r,
typename ReaderT::InputType&
input, Eigen::Quaternion<EigenT>&
ret)
152 std::string typeAsString;
153 std::vector<int> shape;
154 std::vector<unsigned char>
data;
155 aron_r.readNDArray(
input, shape, typeAsString,
data);
157 reinterpret_cast<unsigned char*
>(
ret.coeffs().data()),
data.data(),
data.size());
160 template <
class WriterT,
class EigenT>
165 const Eigen::Quaternion<EigenT>&
input,
166 typename WriterT::ReturnType&
ret,
169 ret = aron_w.writeNDArray({1, 4,
sizeof(EigenT)},
171 reinterpret_cast<const unsigned char*
>(
input.coeffs().data()),