26 #include "graph_model_internal.hpp"
38 (*this)->construct(opts);
54 (*this)->fill_metadata(gb);
57 const std::string& name)
const {
63 return (*this)->export_symbolic(f, opts);
84 : model_data_(model_data), verbose_(false) {
93 {
OT_BOOL,
"Verbose evaluation -- for debugging"}}}
97 for (
auto&& op : opts) {
98 if (op.first ==
"verbose")
verbose_ = op.second;
112 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
113 std::mutex GraphModelInternal::mutex_solvers_;
SharedObjectInternal * get() const
Get a const pointer to the node.
void own(SharedObjectInternal *node)
SharedObjectInternal * operator->() const
Access a member function or object.
Internal class for GraphBuilder.
Base interface for format-specific graph-model backends.
void disp(std::ostream &stream, bool more) const override
Print a description of the object.
GraphModelInternal(const std::vector< uint8_t > &model_data)
static const Options options_
Options.
static const std::string infix_
Infix used to form plugin registration symbols (casadi_register_graphmodel_<name>)
const char * plugin_name() const override=0
Query plugin name.
bool verbose_
Verbose – for debugging.
~GraphModelInternal() override
static std::map< std::string, Plugin > solvers_
Collection of available format plugins.
void construct(const Dict &opts)
Prepare the backend for use.
virtual void init(const Dict &opts)
Initialize.
virtual Function import_symbolic(const GraphBuilderInternal &gb, const std::string &name)=0
Rebuild the graph as a CasADi Function (symbolic import; mutates the backend's engine)
static bool has_plugin(const std::string &name)
Check if a format plugin is available.
std::vector< uint8_t > export_symbolic(const Function &f, const Dict &opts=Dict())
Symbolic export: serialize a CasADi Function to model bytes.
static void load_plugin(const std::string &name)
Explicitly load a format plugin.
void fill_metadata(GraphBuilderInternal &gb) const
Populate a builder's Node metadata from the parsed model.
const std::vector< uint8_t > & model_data() const
Raw model bytes.
GraphModel()
Default constructor (null handle)
GraphModelInternal * get() const
std::string format() const
Format name (plugin name)
static std::string doc(const std::string &name)
Get format-specific documentation.
Function import_symbolic(const GraphBuilderInternal &gb, const std::string &name) const
Symbolic import: rebuild the graph as a CasADi Function.
GraphModelInternal * operator->()
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.
static Plugin load_plugin(const std::string &pname, bool register_plugin=true, bool needs_lock=true)
Load a plugin dynamically.
bool has_graphmodel(const std::string &name)
Check if a graph-model format plugin is available.
void load_graphmodel(const std::string &name)
Explicitly load a graph-model format plugin.
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.
std::string doc_graphmodel(const std::string &name)
Get format-specific documentation.
Options metadata for a class.