13#if ALPAQA_WITH_EXTERNAL_CASADI
14#include <casadi/core/casadi_types.hpp>
21namespace casadi_loader {
23template <
class Loader,
class F>
28 throw std::invalid_argument(
29 "Unable to load function '" +
loader.format_name(name) +
37 return T(
loader(name), std::forward<Args>(
args)...);
45 std::forward<Loader>(
loader), name, std::forward<Args>(
args)...));
46#if ALPAQA_WITH_EXTERNAL_CASADI
47 }
catch (casadi::CasadiException &) {
50 }
catch (util::dynamic_load_error &e) {
53 }
catch (std::out_of_range &) {
59using dim = std::pair<casadi_int, casadi_int>;
60inline constexpr auto dims(
auto...
a) {
61 if constexpr ((... && std::is_constructible_v<
dim,
decltype(
a)>))
62 return std::array{
a...};
64 return std::array{
dim{
a, 1}...};
#define BEGIN_ALPAQA_CASADI_LOADER_NAMESPACE
#define END_ALPAQA_CASADI_LOADER_NAMESPACE
std::string demangled_typename(const std::type_info &t)
Get the pretty name of the given type as a string.
auto wrapped_load(Loader &&loader, const char *name, Args &&...args)
std::optional< T > try_load(Loader &&loader, const char *name, Args &&...args)
constexpr auto dims(auto... a)
std::pair< casadi_int, casadi_int > dim
auto wrap_load(Loader &&loader, const char *name, F f)