RAII class for reading from a zip file. More...
#include <resource_internal.hpp>
Extra doc: https://github.com/casadi/casadi/wiki/L_2c5
Definition at line 97 of file resource_internal.hpp.
Public Types | |
using | weak_ref_type = WeakRefInternal |
Public Member Functions | |
ZipResource (const std::string &path) | |
Initialize with a path. More... | |
~ZipResource () override | |
const std::string & | path () const override |
Get path for a consumer. More... | |
void | unpack () |
std::string | class_name () const override |
Get type name. More... | |
void | disp (std::ostream &stream, bool more) const override |
Print description. More... | |
void | serialize_type (SerializingStream &s) const override |
Potentially decay into ZipMemResource. More... | |
void | serialize_body (SerializingStream &s) const override |
void | serialize (SerializingStream &s) const |
void | change_option (const std::string &option_name, const GenericType &option_value) |
casadi_int | getCount () const |
Get the reference count. More... | |
std::string | debug_repr (const SharedObjectInternal *) const |
GenericWeakRef< SharedObject, SharedObjectInternal > * | weak () |
Get a weak reference to the object. More... | |
Static Public Member Functions | |
static ResourceInternal * | deserialize (DeserializingStream &s) |
Protected Member Functions | |
ZipResource (DeserializingStream &s) | |
void | initSingleton () |
void | destroySingleton () |
B | shared_from_this () |
Get a shared object from the current internal object. More... | |
const B | shared_from_this () const |
Get a shared object from the current internal object. More... | |
Protected Attributes | |
std::string | serialize_mode_ |
|
inherited |
Definition at line 152 of file shared_object.hpp.
casadi::ZipResource::ZipResource | ( | const std::string & | path | ) |
If the path is a directory or empty, the path is passed through to the consumer. Otherwise, the zip file is extracted to a temporary directory.
Upon destruction, the temporary directory is removed.
Extra doc: https://github.com/casadi/casadi/wiki/L_2c6
Definition at line 99 of file resource_internal.cpp.
References path(), and unpack().
Referenced by deserialize().
|
override |
Definition at line 119 of file resource_internal.cpp.
References casadi::Filesystem::remove(), and casadi::Filesystem::remove_all().
|
explicitprotected |
Definition at line 194 of file resource_internal.cpp.
References unpack(), casadi::DeserializingStream::unpack(), and casadi::DeserializingStream::version().
|
inherited |
Definition at line 53 of file resource_internal.cpp.
References casadi::ResourceInternal::serialize_mode_, and casadi::GenericType::to_string().
|
inlineoverridevirtual |
Extra doc: https://github.com/casadi/casadi/wiki/L_2cw
Implements casadi::SharedObjectInternal.
Definition at line 117 of file resource_internal.hpp.
Referenced by serialize_type().
|
inherited |
Definition at line 62 of file generic_shared_internal.hpp.
|
static |
Definition at line 179 of file resource_internal.cpp.
References ZipResource().
Referenced by casadi::ResourceInternal::deserialize().
|
inlineprotectedinherited |
Called in the destructor of singletons
Definition at line 77 of file generic_shared_internal.hpp.
|
overridevirtual |
Implements casadi::SharedObjectInternal.
Definition at line 111 of file resource_internal.cpp.
|
inherited |
Definition at line 60 of file generic_shared_internal.hpp.
|
inlineprotectedinherited |
Called in the constructor of singletons to avoid that the counter reaches zero
Definition at line 71 of file generic_shared_internal.hpp.
|
inlineoverridevirtual |
Implements casadi::ResourceInternal.
Definition at line 110 of file resource_internal.hpp.
Referenced by ZipResource().
|
inherited |
Definition at line 145 of file resource_internal.cpp.
References casadi::ResourceInternal::serialize_body(), casadi::ResourceInternal::serialize_type(), and casadi::SerializingStream::version().
|
overridevirtual |
Reimplemented from casadi::ResourceInternal.
Definition at line 241 of file resource_internal.cpp.
References casadi::SerializingStream::pack(), casadi::ResourceInternal::serialize_body(), casadi::ResourceInternal::serialize_mode_, and casadi::SerializingStream::version().
|
overridevirtual |
Extra doc: https://github.com/casadi/casadi/wiki/L_2cx
Reimplemented from casadi::ResourceInternal.
Definition at line 214 of file resource_internal.cpp.
References class_name(), casadi::SerializingStream::pack(), and casadi::ResourceInternal::serialize_mode_.
|
inlineprotectedinherited |
Definition at line 83 of file generic_shared_internal.hpp.
|
inlineprotectedinherited |
Definition at line 92 of file generic_shared_internal.hpp.
void casadi::ZipResource::unpack | ( | ) |
Definition at line 64 of file resource_internal.cpp.
References casadi::Filesystem::filename(), casadi::PluginInterface< Archiver >::getPlugin(), casadi::PluginInterface< Archiver >::has_plugin(), casadi::Filesystem::is_enabled(), and casadi::temporary_file().
Referenced by ZipResource().
|
inherited |
Extra doc: https://github.com/casadi/casadi/wiki/L_1ai
Definition at line 67 of file generic_shared_internal.hpp.
|
protectedinherited |
Definition at line 63 of file resource_internal.hpp.
Referenced by casadi::ResourceInternal::change_option(), casadi::ResourceInternal::ResourceInternal(), casadi::ResourceInternal::serialize_body(), casadi::DirResource::serialize_body(), serialize_body(), casadi::DirResource::serialize_type(), and serialize_type().