26 #ifndef CASADI_IMPORTER_HPP
27 #define CASADI_IMPORTER_HPP
29 #include "function.hpp"
30 #include "printable.hpp"
40 std::istringstream ss(text);
51 std::istringstream ss(text);
54 while (ss >> tmp) ret.push_back(tmp);
62 std::set<T>
text2set(
const std::string& text) {
63 std::vector<T> v = text2vector<T>(text);
65 for (
auto&& i : v) ret.insert(i);
71 class ImporterInternal;
86 public SWIG_IF_ELSE(PrintableCommon, Printable<Importer>) {
97 explicit Importer(
const std::string& name,
98 const std::string& compiler,
109 static bool has_plugin(
const std::string& name);
112 static void load_plugin(
const std::string& name);
115 static std::string doc(
const std::string& name);
118 std::string plugin_name()
const;
121 bool has_function(
const std::string& symname)
const;
125 signal_t get_function(
const std::string& symname);
145 bool has_meta(
const std::string& cmd, casadi_int ind=-1)
const;
150 std::string get_meta(
const std::string& cmd, casadi_int ind=-1)
const;
153 bool inlined(
const std::string& symname)
const;
156 std::string body(
const std::string& symname)
const;
159 std::string library()
const;
163 static inline std::string
indexed(
const std::string& cmd, casadi_int ind) {
164 std::stringstream ss;
165 ss << cmd <<
"[" << ind <<
"]";
173 T to(
const std::string& cmd, casadi_int ind=-1)
const {
174 return text2type<T>(get_meta(cmd, ind));
180 std::string
meta_string(
const std::string& cmd, casadi_int ind=-1)
const {
181 return to<std::string>(cmd, ind);
188 std::vector<T>
meta_vector(
const std::string& cmd, casadi_int ind=-1)
const {
189 return text2vector<T>(get_meta(cmd, ind));
196 std::set<T>
meta_set(
const std::string& cmd, casadi_int ind=-1)
const {
197 return text2set<T>(get_meta(cmd, ind));
203 casadi_int
meta_int(
const std::string& cmd, casadi_int ind=-1)
const {
204 return to<casadi_int>(cmd, ind);
Helper class for Serialization.
std::string meta_string(const std::string &cmd, casadi_int ind=-1) const
Get entry as a string.
casadi_int meta_int(const std::string &cmd, casadi_int ind=-1) const
Get entry as an integer.
std::vector< T > meta_vector(const std::string &cmd, casadi_int ind=-1) const
Get entry as a vector.
std::set< T > meta_set(const std::string &cmd, casadi_int ind=-1) const
Get entry as a set.
static std::string type_name()
Get type name.
static std::string indexed(const std::string &cmd, casadi_int ind)
T to(const std::string &cmd, casadi_int ind=-1) const
Convert to a type.
Helper class for Serialization.
GenericShared implements a reference counting framework similar for efficient and.
std::set< T > text2set(const std::string &text)
Get entry as a set.
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.
void(* signal_t)(void)
Function pointer types for the C API.
T text2type(const std::string &text)
Convert to a type.
std::vector< T > text2vector(const std::string &text)
Get entry as a vector.