aligator
0.19.0
A versatile and efficient C++ library for real-time constrained trajectory optimization.
Toggle main menu visibility
Loading...
Searching...
No Matches
eigen-member.hpp
Go to the documentation of this file.
1
2
#pragma once
3
4
#include <Eigen/Core>
5
#include <boost/python.hpp>
6
#include <boost/python/class.hpp>
7
#include <boost/python/return_value_policy.hpp>
8
9
#include <fmt/ostream.h>
10
11
namespace
aligator
{
12
namespace
python
{
13
14
namespace
bp = boost::python;
15
16
namespace
internal {
17
21
template
<
typename
MatrixType,
typename
Class>
struct
eigen_member {
22
public
:
23
typedef
Eigen::Ref<const MatrixType> ConstMatRef;
24
25
eigen_member(MatrixType Class::*which)
26
: m_which(which) {}
27
28
Eigen::Ref<MatrixType> operator()(Class &c)
const
{
return
c.*m_which; }
29
30
void
operator()(Class &c,
31
typename
bp::detail::value_arg<ConstMatRef>::type d)
const
{
32
c.*m_which = d;
33
}
34
35
private
:
36
MatrixType Class::*m_which;
37
};
38
39
}
// namespace internal
40
45
template
<
class
C,
class
MatrixType>
46
bp::object
make_getter_eigen_matrix
(MatrixType C::*v) {
47
typedef
Eigen::Ref<MatrixType> RefType;
48
return
bp::make_function(
49
internal::eigen_member<MatrixType, C>(v),
50
bp::return_value_policy<bp::return_by_value,
51
bp::with_custodian_and_ward_postcall<0UL, 1UL>>(),
52
boost::mpl::vector2<RefType, C &>());
53
}
54
55
template
<
class
C,
class
MatrixType,
class
Policies>
56
bp::object
make_setter_eigen_matrix
(MatrixType C::*v,
57
Policies
const
&policies) {
58
typedef
Eigen::Ref<const MatrixType> ConstRefType;
59
return
bp::make_function(
60
internal::eigen_member<MatrixType, C>(v), policies,
61
boost::mpl::vector3<void, C &, const ConstRefType>());
62
}
63
64
template
<
class
C,
class
MatrixType>
65
bp::object
make_setter_eigen_matrix
(MatrixType C::*v) {
66
return
make_setter_eigen_matrix
(v, bp::default_call_policies());
67
}
68
69
}
// namespace python
70
}
// namespace aligator
aligator::python
The Python bindings.
Definition
blk-matrix.hpp:7
aligator::python::make_setter_eigen_matrix
bp::object make_setter_eigen_matrix(MatrixType C::*v, Policies const &policies)
Definition
eigen-member.hpp:56
aligator::python::make_getter_eigen_matrix
bp::object make_getter_eigen_matrix(MatrixType C::*v)
Create a getter for Eigen::Matrix type objects which returns an Eigen::Ref.
Definition
eigen-member.hpp:46
aligator
Main package namespace.
Definition
action-model-wrap.hpp:14
bindings
python
include
aligator
python
eigen-member.hpp
Generated by
1.17.0