aligator
0.6.1
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 <fmt/format.h>
7
#include "
aligator/utils/exceptions.hpp
"
8
#include <eigenpy/fwd.hpp>
9
10
namespace
aligator
{
11
namespace
python {
12
namespace
internal {
13
14
template
<
typename
ret_type>
15
ret_type suppress_if_void(boost::python::detail::method_result &&o) {
16
if
constexpr
(!std::is_void_v<ret_type>) {
17
return
o;
18
}
else
{
19
return
;
20
}
21
}
22
23
}
// namespace internal
24
}
// namespace python
25
}
// namespace aligator
26
27
#define ALIGATOR_PYTHON_OVERRIDE_IMPL(ret_type, pyname, ...) \
28
do { \
29
if (bp::override fo = this->get_override(pyname)) { \
30
decltype(auto) o = fo(__VA_ARGS__); \
31
return ::aligator::python::internal::suppress_if_void<ret_type>( \
32
std::move(o)); \
33
} \
34
} while (false)
35
41
#define ALIGATOR_PYTHON_OVERRIDE_PURE(ret_type, pyname, ...) \
42
ALIGATOR_PYTHON_OVERRIDE_IMPL(ret_type, pyname, __VA_ARGS__); \
43
ALIGATOR_RUNTIME_ERROR( \
44
fmt::format("Tried to call pure virtual function {:s}.", pyname))
45
50
#define ALIGATOR_PYTHON_OVERRIDE(ret_type, cname, fname, ...) \
51
ALIGATOR_PYTHON_OVERRIDE_IMPL(ret_type, #fname, __VA_ARGS__); \
52
return cname::fname(__VA_ARGS__)
exceptions.hpp
aligator
Main package namespace.
Definition
action-model-wrap.hpp:12
bindings
python
include
aligator
python
macros.hpp
Generated by
1.10.0