aligator  0.6.1
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
macros.hpp File Reference

Macros for Boost.Python, inspired by Pybind11's macros. More...

#include <type_traits>
#include <fmt/format.h>
#include "aligator/utils/exceptions.hpp"
#include <eigenpy/fwd.hpp>
Include dependency graph for macros.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  aligator
 Main package namespace.
 
namespace  aligator::python
 The Python bindings.
 

Macros

#define ALIGATOR_PYTHON_OVERRIDE_IMPL(ret_type, pyname, ...)
 
#define ALIGATOR_PYTHON_OVERRIDE_PURE(ret_type, pyname, ...)
 Define the body of a virtual function override. This is meant to reduce boilerplate code when exposing virtual member functions.
 
#define ALIGATOR_PYTHON_OVERRIDE(ret_type, cname, fname, ...)
 Define the body of a virtual function override. This is meant to reduce boilerplate code when exposing virtual member functions.
 

Detailed Description

Macros for Boost.Python, inspired by Pybind11's macros.

Definition in file macros.hpp.

Macro Definition Documentation

◆ ALIGATOR_PYTHON_OVERRIDE_IMPL

#define ALIGATOR_PYTHON_OVERRIDE_IMPL ( ret_type,
pyname,
... )
Value:
do { \
if (bp::override fo = this->get_override(pyname)) { \
decltype(auto) o = fo(__VA_ARGS__); \
return ::aligator::python::internal::suppress_if_void<ret_type>( \
std::move(o)); \
} \
} while (false)
Main package namespace.

Definition at line 27 of file macros.hpp.

◆ ALIGATOR_PYTHON_OVERRIDE_PURE

#define ALIGATOR_PYTHON_OVERRIDE_PURE ( ret_type,
pyname,
... )
Value:
ALIGATOR_PYTHON_OVERRIDE_IMPL(ret_type, pyname, __VA_ARGS__); \
ALIGATOR_RUNTIME_ERROR( \
fmt::format("Tried to call pure virtual function {:s}.", pyname))
#define ALIGATOR_PYTHON_OVERRIDE_IMPL(ret_type, pyname,...)
Definition macros.hpp:27

Define the body of a virtual function override. This is meant to reduce boilerplate code when exposing virtual member functions.

Definition at line 41 of file macros.hpp.

◆ ALIGATOR_PYTHON_OVERRIDE

#define ALIGATOR_PYTHON_OVERRIDE ( ret_type,
cname,
fname,
... )
Value:
ALIGATOR_PYTHON_OVERRIDE_IMPL(ret_type, #fname, __VA_ARGS__); \
return cname::fname(__VA_ARGS__)

Define the body of a virtual function override. This is meant to reduce boilerplate code when exposing virtual member functions.

Definition at line 50 of file macros.hpp.