'libzip' plugin for Archiver
More...
#include <libzip.hpp>
Interface to libzip functionality
Extra doc: https://github.com/casadi/casadi/wiki/L_2d1
- Author
- Joris Gillis
- Date
- 2025
Definition at line 50 of file libzip.hpp.
|
typedef bool(* | Unpack) (const std::string &src, const std::string &target_dir) |
|
typedef bool(* | UnpackFromStringStream) (std::stringstream &src, const std::string &target_dir) |
|
typedef bool(* | Pack) (const std::string &src_dir, const std::string &path) |
|
typedef bool(* | PackToStream) (const std::string &src_dir, std::ostream &src) |
|
typedef Archiver *(* | Creator) () |
|
typedef int(* | RegFcn) (Plugin *plugin) |
|
◆ Creator
typedef Archiver*(* casadi::Archiver::Creator) () |
|
inherited |
◆ Pack
typedef bool(* casadi::Archiver::Pack) (const std::string &src_dir, const std::string &path) |
|
inherited |
◆ PackToStream
typedef bool(* casadi::Archiver::PackToStream) (const std::string &src_dir, std::ostream &src) |
|
inherited |
◆ RegFcn
◆ Unpack
typedef bool(* casadi::Archiver::Unpack) (const std::string &src, const std::string &target_dir) |
|
inherited |
◆ UnpackFromStringStream
typedef bool(* casadi::Archiver::UnpackFromStringStream) (std::stringstream &src, const std::string &target_dir) |
|
inherited |
◆ deserialize()
Extra doc: https://github.com/casadi/casadi/wiki/L_rr
Definition at line 121 of file plugin_interface.hpp.
123 s.unpack(
"PluginInterface::plugin_name",
plugin_name);
static Deserialize plugin_deserialize(const std::string &pname)
Get the plugin deserialize_map.
static ProtoFunction * deserialize(DeserializingStream &s)
Deserialize with type disambiguation.
virtual const char * plugin_name() const=0
ProtoFunction *(* Deserialize)(DeserializingStream &)
◆ getPlugin()
Definition at line 102 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 76 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
◆ instantiate()
Definition at line 106 of file plugin_interface.hpp.
317 casadi_error(
"Plugin '" + pname +
"' is not found.");
319 return getPlugin(pname).creator(fname, problem);
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()
Definition at line 92 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()
◆ load_plugin()
Definition at line 88 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.
◆ plugin_deserialize()
Definition at line 82 of file plugin_interface.hpp.
164 casadi_assert(m,
"Plugin \"" + pname +
"\" does not support deserialize");
◆ plugin_name()
◆ plugin_options()
Definition at line 79 of file plugin_interface.hpp.
156 const Options *op =
getPlugin(pname).options;
157 casadi_assert(op!=
nullptr,
"Plugin \"" + pname +
"\" does not support options");
◆ pluginFromRegFcn()
Definition at line 85 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 96 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.
◆ registerPlugin() [2/2]
◆ serialize_type()
◆ infix_
const std::string casadi::Archiver::infix_ = "archiver" |
|
staticinherited |
◆ meta_doc
const std::string casadi::Libzip::meta_doc |
|
static |
◆ solvers_
std::map< std::string, Archiver::Plugin > casadi::Archiver::solvers_ |
|
staticinherited |
The documentation for this class was generated from the following files: