13#if ALPAQA_WITH_EXTERNAL_CASADI
14#include <casadi/core/casadi_types.hpp>
21template <
class Loader,
class F>
26 throw std::invalid_argument(
27 "Unable to load function '" +
loader.format_name(name) +
35 return T(
loader(name), std::forward<Args>(
args)...);
43 std::forward<Loader>(
loader), name, std::forward<Args>(
args)...));
44#if ALPAQA_WITH_EXTERNAL_CASADI
45 }
catch (casadi::CasadiException &) {
48 }
catch (util::dynamic_load_error &e) {
51 }
catch (std::out_of_range &) {
57using dim = std::pair<casadi_int, casadi_int>;
58inline constexpr auto dims(
auto...
a) {
59 if constexpr ((... && std::is_constructible_v<
dim,
decltype(
a)>))
60 return std::array{
a...};
62 return std::array{
dim{
a, 1}...};
#define 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)