24#include "AstMath/Matrix.hpp"
52class In<const double*>
55 explicit In(
const double* value) : value_(value) {}
56 operator const Vector3d& ()
const {
return *
reinterpret_cast<const Vector3d*
>(value_); }
59 const double* value_{};
67 explicit Out(
double* value) : value_(value) {}
68 operator Vector3d& () {
return *
reinterpret_cast<Vector3d*
>(value_); }
80#if _AST_MATRIX_IS_ROW_MAJOR
84class In<const double (*)[3]>
87 explicit In(
const double (*value)[3]) : value_(value) {}
88 operator const Matrix3d& ()
const {
return *
reinterpret_cast<const Matrix3d*
>(value_); }
90 const double (*value_)[3]{};
97class Out<double (*)[3]>
100 explicit Out(
double (*value)[3]) : value_(value) {}
101 operator Matrix3d& () {
return *
reinterpret_cast<Matrix3d*
>(value_); }
103 double (*value_)[3]{};
110class In<const double (*)[3]>
113 explicit In(
const double (*value)[3])
116 if (value_ ==
nullptr)
118 for(
int i = 0; i < 3; i++)
120 for(
int j = 0; j < 3; j++)
122 matrix_(i, j) = value_[i][j];
126 operator const Matrix3d& ()
const {
return matrix_; }
129 const double (*value_)[3]{};
139 explicit Out(
double (*value)[3]) : matrix_(Matrix3d::Zero()), value_(value) {}
141 Out(
Out&& other) : matrix_(other.matrix_), value_(other.value_) { other.value_ =
nullptr; }
142 operator Matrix3d& () {
return matrix_; }
144 if (value_ ==
nullptr)
146 for(
int i = 0; i < 3; i++)
148 for(
int j = 0; j < 3; j++)
150 value_[i][j] = matrix_(i, j);
156 double (*value_)[3]{};
167#if _AST_MATRIX_IS_ROW_MAJOR && !defined(AST_USE_EIGEN_MATRIX)
171class Out<double (*)[6]>
174 explicit Out(
double (*value)[6]) : value_(value) {}
175 operator Matrix6d& () {
return *
reinterpret_cast<Matrix6d*
>(value_); }
177 double (*value_)[6]{};
187 explicit Out(
double (*value)[6]) : matrix_(Matrix6d::Zero()), value_(value) {}
189 Out(
Out&& other) : matrix_(other.matrix_), value_(other.value_) { other.value_ =
nullptr; }
190 operator Matrix6d& () {
return matrix_; }
192 if (value_ ==
nullptr)
194 for(
int i = 0; i < 6; i++)
196 for(
int j = 0; j < 6; j++)
198 value_[i][j] = matrix_(i, j);
204 double (*value_)[6]{};
214#if _AST_MATRIX_IS_ROW_MAJOR
221 explicit In(
const Matrix3d& value) : value_(value) {}
222 typedef const double(*CMatrixType)[3];
223 operator CMatrixType ()
const {
return reinterpret_cast<CMatrixType
>(value_.data()); }
225 const Matrix3d& value_;
238 for(
int i = 0; i < 3; i++)
240 for(
int j = 0; j < 3; j++)
242 matrix_[i][j] = value_(i, j);
246 typedef const double(*CMatrixType)[3];
247 operator CMatrixType ()
const {
return matrix_; }
249 double matrix_[3][3]{};
268A_ALWAYS_INLINE In<
const double (*)[3]> in(
const double (*value)[3])
270 return In<const double (*)[3]>(value);
273A_ALWAYS_INLINE In<Matrix3d>
in(
const Matrix3d& value)
275 return In<Matrix3d>(value);
278A_ALWAYS_INLINE Out<double*> out(
double* value)
280 return Out<double*>(value);
283A_ALWAYS_INLINE Out<double (*)[3]> out(
double (*value)[3])
285 return Out<double (*)[3]>(value);
288A_ALWAYS_INLINE Out<double (*)[6]> out(
double (*value)[6])
290 return Out<double (*)[6]>(value);
输入适配器:把外部数据转换为函数的期望参数类型
定义 ParamAdapter.hpp:37
Out(Out &&other)
转移回写责任,源对象指针置空以免重复回写
定义 ParamAdapter.hpp:141
Out(Out &&other)
转移回写责任,源对象指针置空以免重复回写
定义 ParamAdapter.hpp:189
输出适配器:析构时把结果回写到外部缓冲区,或者直接将外部缓冲区绑定到函数的输出参数
定义 ParamAdapter.hpp:41