Interface for accessing input and output data structures.
More...
#include <plugin_interface.hpp>
template<class Derived>
class casadi::PluginInterface< Derived >
- Author
- Joel Andersson
- Date
- 2013
Extra doc: https://github.com/casadi/casadi/wiki/L_rp
Definition at line 54 of file plugin_interface.hpp.
◆ RegFcn
◆ deserialize()
◆ getPlugin()
Definition at line 291 of file plugin_interface.hpp.
293 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
294 std::lock_guard<std::mutex> lock(Derived::mutex_solvers_);
298 auto it=Derived::solvers_.find(pname);
301 if (it==Derived::solvers_.end()) {
303 it=Derived::solvers_.find(pname);
305 casadi_assert_dev(it!=Derived::solvers_.end());
static Plugin load_plugin(const std::string &pname, bool register_plugin=true, bool needs_lock=true)
Load a plugin dynamically.
◆ has_plugin()
Definition at line 131 of file plugin_interface.hpp.
133 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
134 std::lock_guard<std::mutex> lock(Derived::mutex_solvers_);
138 if (Derived::solvers_.
find(pname) != Derived::solvers_.end()) {
146 }
catch (CasadiException& ex) {
148 casadi_warning(ex.what());
std::vector< casadi_int > find(const std::vector< T > &v)
find nonzeros
References casadi::find(), and casadi::CasadiException::what().
◆ instantiate()
template<class Derived >
template<class Problem >
Derived * casadi::PluginInterface< Derived >::instantiate |
( |
const std::string & |
fname, |
|
|
const std::string & |
pname, |
|
|
Problem |
problem |
|
) |
| |
|
static |
Definition at line 311 of file plugin_interface.hpp.
317 casadi_error(
"Plugin '" + pname +
"' is not found.");
static bool has_plugin(const std::string &pname, bool verbose=false)
Check if a plugin is available or can be loaded.
static Plugin & getPlugin(const std::string &pname)
Load and get the creator function.
◆ load_library()
template<class Derived >
handle_t casadi::PluginInterface< Derived >::load_library |
( |
const std::string & |
libname, |
|
|
std::string & |
resultpath, |
|
|
bool |
global |
|
) |
| |
|
static |
Definition at line 183 of file plugin_interface.hpp.
187 casadi_error(
"WITH_DL option needed for dynamic loading");
191 std::string lib = SHARED_LIBRARY_PREFIX + libname + SHARED_LIBRARY_SUFFIX;
195 return open_shared_library(lib, search_paths, resultpath,
196 "PluginInterface::load_plugin", global);
std::vector< std::string > get_search_paths()
References casadi::get_search_paths().
◆ load_plugin()
Definition at line 203 of file plugin_interface.hpp.
206 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
211 if (Derived::solvers_.
find(pname) != Derived::solvers_.end()) {
212 casadi_warning(
"PluginInterface: Solver " + pname +
" is already in use. Ignored.");
223 casadi_error(
"WITH_DL option needed for dynamic loading");
229 std::string regName =
"casadi_register_" + Derived::infix_ +
"_" + pname;
231 std::string searchpath;
232 handle_t handle =
load_library(
"casadi_" + Derived::infix_ +
"_" + pname, searchpath,
238 #pragma GCC diagnostic push
239 #pragma GCC diagnostic ignored "-Wcast-function-type"
241 reg =
reinterpret_cast<RegFcn>(GetProcAddress(handle, TEXT(regName.c_str())));
243 #pragma GCC diagnostic pop
251 reg =
reinterpret_cast<RegFcn>(dlsym(handle, regName.c_str()));
253 casadi_assert(reg!=
nullptr,
254 "PluginInterface::load_plugin: no \"" + regName +
"\" found in " + searchpath +
".");
259 if (register_plugin) {
static handle_t load_library(const std::string &libname, std::string &resultpath, bool global)
Load a library dynamically.
int(* RegFcn)(Plugin *plugin)
static Plugin pluginFromRegFcn(RegFcn regfcn)
Instantiate a Plugin struct from a factory function.
static void registerPlugin(const Plugin &plugin, bool needs_lock=true)
Register an integrator in the factory.
References casadi::find(), casadi::uerr(), and casadi::uout().
◆ plugin_deserialize()
◆ plugin_name()
Implemented in casadi::LinsolInternal, casadi::SymbolicQr, casadi::Sqpmethod, casadi::ShellCompiler, casadi::Scpgen, casadi::RungeKutta, casadi::Qrsqp, casadi::Qrqp, casadi::QpToNlp, casadi::Newton, casadi::Lsqr, casadi::LinsolTridiag, casadi::LinsolQr, casadi::LinsolLdl, casadi::LinearInterpolant, casadi::Ipqp, casadi::ImplicitToNlp, casadi::Feasiblesqpmethod, casadi::FastNewton, casadi::Collocation, casadi::BSplineInterpolant, casadi::WorhpInterface, casadi::TinyXmlInterface, casadi::SuperscsInterface, casadi::KinsolInterface, casadi::IdasInterface, casadi::CvodesInterface, casadi::SqicInterface, casadi::SnoptInterface, casadi::SlicotExpm, casadi::SlicotDple, casadi::SLEQPInterface, casadi::QpoasesInterface, casadi::ProxqpInterface, casadi::OsqpInterface, casadi::OoqpInterface, casadi::MumpsInterface, casadi::MadnlpInterface, casadi::LapackQr, casadi::LapackLu, casadi::KnitroInterface, casadi::IpoptInterface, casadi::Ma27Interface, casadi::HpmpcInterface, casadi::HpipmInterface, casadi::HighsInterface, casadi::GurobiInterface, casadi::FatropInterface, casadi::FatropConicInterface, casadi::DaqpInterface, casadi::CsparseInterface, casadi::CSparseCholeskyInterface, casadi::CplexInterface, casadi::ClpInterface, casadi::ClarabelInterface, casadi::ClangCompiler, casadi::CbcInterface, casadi::BonminInterface, casadi::Blocksqp, casadi::AmplInterface, casadi::AlpaqaInterface, and casadi::ImporterInternal.
Referenced by casadi::PluginInterface< Derived >::deserialize(), and casadi::PluginInterface< Derived >::serialize_type().
◆ plugin_options()
Definition at line 155 of file plugin_interface.hpp.
157 casadi_assert(op!=
nullptr,
"Plugin \"" + pname +
"\" does not support options");
◆ pluginFromRegFcn()
Definition at line 170 of file plugin_interface.hpp.
175 int flag = regfcn(&plugin);
176 casadi_assert(flag==0,
"Registration of plugin failed.");
◆ registerPlugin() [1/2]
Definition at line 274 of file plugin_interface.hpp.
276 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
281 typename std::map<std::string, Plugin>::iterator it=Derived::solvers_.find(plugin.name);
282 casadi_assert(it==Derived::solvers_.end(),
283 "Solver " +
str(plugin.name) +
" is already in use");
286 Derived::solvers_[plugin.name] = plugin;
std::string str(const T &v)
String representation, any type.
References casadi::PluginInterface< Derived >::Plugin::name, and casadi::str().
◆ registerPlugin() [2/2]
◆ serialize_type()
The documentation for this class was generated from the following file: