'tinyxml' plugin for XmlFile
More...
#include <tinyxml_interface.hpp>
◆ Creator
◆ RegFcn
◆ weak_ref_type
◆ TinyXmlInterface()
casadi::TinyXmlInterface::TinyXmlInterface |
( |
| ) |
|
◆ ~TinyXmlInterface()
casadi::TinyXmlInterface::~TinyXmlInterface |
( |
| ) |
|
|
override |
◆ class_name()
std::string casadi::TinyXmlInterface::class_name |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ creator()
◆ debug_repr()
Definition at line 62 of file generic_shared_internal.hpp.
164 return str( (casadi_int)(i)) +
"/" +
static_cast<const Internal*
>(
this)->class_name();
std::string str(const T &v)
String representation, any type.
◆ 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 &)
◆ destroySingleton()
◆ disp()
void casadi::XmlFileInternal::disp |
( |
std::ostream & |
stream, |
|
|
bool |
more = false |
|
) |
| const |
|
overridevirtualinherited |
◆ dump()
void casadi::TinyXmlInterface::dump |
( |
const std::string & |
filename, |
|
|
const XmlNode & |
node |
|
) |
| |
|
overridevirtual |
◆ export_node()
void casadi::TinyXmlInterface::export_node |
( |
TiXmlNode * |
n, |
|
|
const XmlNode & |
node |
|
) |
| |
◆ getCount()
◆ 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
◆ import_node()
XmlNode casadi::TinyXmlInterface::import_node |
( |
TiXmlNode * |
n | ) |
|
Definition at line 79 of file tinyxml_interface.cpp.
80 if (!n) casadi_error(
"Node is 0");
83 ret.line = n->GetLineNum();
87 ret.name = n->Value();
92 for (
const TiXmlAttribute* pAttrib=n->ToElement()->FirstAttribute();
93 pAttrib; pAttrib=pAttrib->Next()) {
94 ret.set_attribute(pAttrib->Name(), pAttrib->Value());
96 }
else if (n->ToDocument()) {
99 casadi_error(
"TinyXmlInterface::import_node");
103 casadi_int num_children = 0;
104 for (TiXmlNode* child = n->FirstChild(); child !=
nullptr; child = child->NextSibling()) {
107 ret.children.reserve(num_children);
110 for (TiXmlNode* child = n->FirstChild(); child !=
nullptr; child = child->NextSibling()) {
111 if (child->ToElement()) {
113 }
else if (child->ToComment()) {
114 ret.comment = child->Value();
115 }
else if (child->ToText()) {
116 ret.text = child->ToText()->Value();
117 }
else if (child->ToDeclaration()) {
119 }
else if (child->ToDocument()) {
122 casadi_error(
"Unknown node type");
XmlNode import_node(TiXmlNode *n)
References casadi::XmlNode::children, casadi::XmlNode::comment, casadi::XmlNode::line, casadi::XmlNode::name, casadi::XmlNode::set_attribute(), and casadi::XmlNode::text.
Referenced by parse().
◆ initSingleton()
Called in the constructor of singletons to avoid that the counter reaches zero
Definition at line 71 of file generic_shared_internal.hpp.
72 casadi_assert_dev(
static_cast<Internal*
>(
this)->count==0);
73 static_cast<Internal*
>(
this)->count++;
◆ 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.
◆ parse()
XmlNode casadi::TinyXmlInterface::parse |
( |
const std::string & |
filename | ) |
|
|
overridevirtual |
◆ plugin_deserialize()
Definition at line 82 of file plugin_interface.hpp.
164 casadi_assert(m,
"Plugin \"" + pname +
"\" does not support deserialize");
◆ plugin_name()
const char* casadi::TinyXmlInterface::plugin_name |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ 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;
◆ registerPlugin() [2/2]
◆ serialize_type()
◆ shared_from_this() [1/2]
Definition at line 83 of file generic_shared_internal.hpp.
84 casadi_assert_dev(B::test_cast(
static_cast<Internal*
>(
this)));
86 ret.own(
static_cast<Internal*
>(
this));
◆ shared_from_this() [2/2]
Definition at line 92 of file generic_shared_internal.hpp.
93 casadi_assert_dev(B::test_cast(
static_cast<const Internal*
>(
this)));
95 ret.own(
const_cast<Internal*
>(
static_cast<const Internal*
>(
this)));
◆ weak()
◆ doc_
TiXmlDocument casadi::TinyXmlInterface::doc_ |
◆ infix_
const std::string casadi::XmlFileInternal::infix_ = "xmlfile" |
|
staticinherited |
◆ meta_doc
const std::string casadi::TinyXmlInterface::meta_doc |
|
static |
◆ solvers_
std::map< std::string, XmlFileInternal::Plugin > casadi::XmlFileInternal::solvers_ |
|
staticinherited |
The documentation for this class was generated from the following files: