4 #include <Eigen/Geometry>
19 template <
class ReaderT,
class EigenT,
int rows,
int cols,
int options>
24 typename ReaderT::InputType&
input,
27 std::string typeAsString;
28 std::vector<int> shape;
29 std::vector<unsigned char>
data;
30 aron_r.readNDArray(
input, shape, typeAsString,
data);
33 ss <<
"Received wrong dimensions for matrix member. Dimensions are (" << shape.at(0)
34 <<
"," << shape.at(1) <<
") but should be (" <<
ret.rows() <<
"," <<
ret.cols()
40 "Received wrong typename",
44 ret.rows() == shape.at(0) and
ret.cols() == shape.at(1),
47 std::memcpy(
reinterpret_cast<unsigned char*
>(
ret.data()),
data.data(),
data.size());
50 template <
class ReaderT,
class EigenT,
int cols,
int options>
55 typename ReaderT::InputType&
input,
58 std::string typeAsString;
59 std::vector<int> shape;
60 std::vector<unsigned char>
data;
61 aron_r.readNDArray(
input, shape, typeAsString,
data);
63 ret.resize(shape.at(0));
66 ret.rows() == shape.at(0) and
ret.cols() == shape.at(1),
68 __PRETTY_FUNCTION__,
"Received wrong dimensions for member 'pose'."));
72 "Received wrong typename",
75 std::memcpy(
reinterpret_cast<unsigned char*
>(
ret.data()),
data.data(),
data.size());
78 template <
class ReaderT,
class EigenT,
int rows,
int options>
83 typename ReaderT::InputType&
input,
86 std::string typeAsString;
87 std::vector<int> shape;
88 std::vector<unsigned char>
data;
89 aron_r.readNDArray(
input, shape, typeAsString,
data);
91 ret.resize(shape.at(1));
94 ret.rows() == shape.at(0) and
ret.cols() == shape.at(1),
96 __PRETTY_FUNCTION__,
"Received wrong dimensions for member 'pose'."));
100 "Received wrong typename",
103 std::memcpy(
reinterpret_cast<unsigned char*
>(
ret.data()),
data.data(),
data.size());
106 template <
class ReaderT,
class EigenT,
int options>
111 typename ReaderT::InputType&
input,
114 std::string typeAsString;
115 std::vector<int> shape;
116 std::vector<unsigned char>
data;
117 aron_r.readNDArray(
input, shape, typeAsString,
data);
119 ret.resize(shape.at(0), shape.at(1));
122 ret.rows() == shape.at(0) and
ret.cols() == shape.at(1),
124 __PRETTY_FUNCTION__,
"Received wrong dimensions for member 'pose'."));
128 "Received wrong typename",
131 std::memcpy(
reinterpret_cast<unsigned char*
>(
ret.data()),
data.data(),
data.size());
134 template <
class WriterT,
class EigenT,
int rows,
int cols,
int options>
140 typename WriterT::ReturnType&
ret,
143 ret = aron_w.writeNDArray(
144 {
static_cast<int>(
input.rows()),
static_cast<int>(
input.cols()),
sizeof(EigenT)},
146 reinterpret_cast<const unsigned char*
>(
input.data()),
150 template <
class ReaderT,
class EigenT>
154 read(ReaderT& aron_r,
typename ReaderT::InputType&
input, Eigen::Quaternion<EigenT>&
ret)
156 std::string typeAsString;
157 std::vector<int> shape;
158 std::vector<unsigned char>
data;
159 aron_r.readNDArray(
input, shape, typeAsString,
data);
161 reinterpret_cast<unsigned char*
>(
ret.coeffs().data()),
data.data(),
data.size());
164 template <
class WriterT,
class EigenT>
169 const Eigen::Quaternion<EigenT>&
input,
170 typename WriterT::ReturnType&
ret,
173 ret = aron_w.writeNDArray({1, 4,
sizeof(EigenT)},
175 reinterpret_cast<const unsigned char*
>(
input.coeffs().data()),