aligator
0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
macros.hpp
Go to the documentation of this file.
1
3
#pragma once
4
5
#include <type_traits>
6
#include "
aligator/utils/exceptions.hpp
"
7
#include <eigenpy/fwd.hpp>
8
9
namespace
aligator
{
10
namespace
python {
11
namespace
internal {
12
13
template
<
typename
ret_type>
14
ret_type suppress_if_void(boost::python::detail::method_result &&o) {
15
if
constexpr
(!std::is_void_v<ret_type>)
16
return
o.operator ret_type();
17
}
18
19
}
// namespace internal
20
}
// namespace python
21
}
// namespace aligator
22
23
#define ALIGATOR_PYTHON_OVERRIDE_IMPL(ret_type, pyname, ...) \
24
do { \
25
if (bp::override fo = this->get_override(pyname)) { \
26
decltype(auto) o = fo(__VA_ARGS__); \
27
return ::aligator::python::internal::suppress_if_void<ret_type>( \
28
std::move(o)); \
29
} \
30
} while (false)
31
37
#define ALIGATOR_PYTHON_OVERRIDE_PURE(ret_type, pyname, ...) \
38
ALIGATOR_PYTHON_OVERRIDE_IMPL(ret_type, pyname, __VA_ARGS__); \
39
ALIGATOR_RUNTIME_ERROR("Tried to call pure virtual function {:s}.", pyname)
40
45
#define ALIGATOR_PYTHON_OVERRIDE(ret_type, cname, fname, ...) \
46
ALIGATOR_PYTHON_OVERRIDE_IMPL(ret_type, #fname, __VA_ARGS__); \
47
return cname::fname(__VA_ARGS__)
exceptions.hpp
aligator
Main package namespace.
Definition
action-model-wrap.hpp:14
bindings
python
include
aligator
python
macros.hpp
Generated by
1.11.0