RAII class for reading from a zip file. More...
#include <resource.hpp>
Extra doc: https://github.com/casadi/casadi/wiki/L_2cn
Definition at line 42 of file resource.hpp.
Public Types | |
using | internal_base_type = SharedObjectInternal |
using | base_type = SharedObject |
Public Member Functions | |
Resource (const std::string &path) | |
Initialize with a path. More... | |
Resource () | |
Default constructor. More... | |
ResourceInternal * | get () const |
const ResourceInternal * | operator-> () const |
Access a member function or object. More... | |
ResourceInternal * | operator-> () |
Access a member function or object. More... | |
const ResourceInternal & | operator* () const |
Reference to internal structure. More... | |
const std::string & | path () const |
Get path for a consumer. More... | |
void | serialize (SerializingStream &s) const |
Serialize an object. More... | |
void | change_option (const std::string &option_name, const GenericType &option_value) |
Change option after object creation for debugging. More... | |
std::string | class_name () const |
Get class name. More... | |
void | disp (std::ostream &stream, bool more=false) const |
Print a description of the object. More... | |
std::string | get_str (bool more=false) const |
Get string representation. More... | |
void | print_ptr (std::ostream &stream=casadi::uout()) const |
void | own (SharedObjectInternal *node) |
void | assign (SharedObjectInternal *node) |
Assign the node to a node class pointer without reference counting. More... | |
casadi_int | getCount () const |
Get the reference count. More... | |
void | swap (GenericShared &other) |
Swap content with another instance. More... | |
std::string | debug_repr () const |
bool | is_null () const |
Is a null pointer? More... | |
casadi_int | __hash__ () const |
Returns a number that is unique for a given Node. More... | |
GenericWeakRef< SharedObject, SharedObjectInternal > * | weak () |
Get a weak reference to the object. More... | |
Static Public Member Functions | |
static std::string | type_name () |
Readable name of the public class. More... | |
static bool | test_cast (const SharedObjectInternal *ptr) |
Check if a particular cast is allowed. More... | |
static Resource | create (ResourceInternal *node) |
Create from node. More... | |
static Resource | deserialize (DeserializingStream &s) |
Deserialize with type disambiguation. More... | |
Protected Member Functions | |
void | count_up () |
void | count_down () |
|
inherited |
Definition at line 103 of file shared_object.hpp.
|
inherited |
Definition at line 102 of file shared_object.hpp.
casadi::Resource::Resource | ( | 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_2co
Definition at line 35 of file resource.cpp.
References casadi::Filesystem::is_directory(), casadi::Filesystem::is_enabled(), casadi::GenericShared< SharedObject, SharedObjectInternal >::own(), and path().
|
explicit |
Definition at line 32 of file resource.cpp.
|
inherited |
If the Object does not point to any node, "0" is returned.
Extra doc: https://github.com/casadi/casadi/wiki/L_av
Definition at line 124 of file generic_shared_impl.hpp.
|
inherited |
improper use will cause memory leaks!
Extra doc: https://github.com/casadi/casadi/wiki/L_at
Definition at line 97 of file generic_shared_impl.hpp.
void casadi::Resource::change_option | ( | const std::string & | option_name, |
const GenericType & | option_value | ||
) |
This is only possible for a selected number of options that do not change the numerical results of the comput
Extra doc: https://github.com/casadi/casadi/wiki/L_2d4
Definition at line 74 of file resource.cpp.
Referenced by casadi::DaeBuilderInternal::DaeBuilderInternal().
|
inherited |
Extra doc: https://github.com/casadi/casadi/wiki/L_au
Definition at line 31 of file shared_object.cpp.
Referenced by casadi::FmuFunction::check_mem_count(), casadi::MXFunction::export_code_body(), and casadi::BlazingSplineFunction::merge().
|
protectedinherited |
Definition at line 134 of file generic_shared_impl.hpp.
|
protectedinherited |
Definition at line 133 of file generic_shared_impl.hpp.
|
static |
Extra doc: https://github.com/casadi/casadi/wiki/L_2cp
Definition at line 44 of file resource.cpp.
References casadi::GenericShared< Shared, Internal >::own().
Referenced by deserialize().
|
inherited |
Definition at line 113 of file generic_shared_impl.hpp.
|
static |
Extra doc: https://github.com/casadi/casadi/wiki/L_2cr
Definition at line 82 of file resource.cpp.
References create(), and casadi::ResourceInternal::deserialize().
|
inherited |
Definition at line 35 of file shared_object.cpp.
References casadi::GenericShared< SharedObject, SharedObjectInternal >::is_null().
Referenced by casadi::Nlpsol::disp_more(), and casadi::CsparseInterface::nfact().
ResourceInternal * casadi::Resource::get | ( | ) | const |
Definition at line 66 of file resource.cpp.
References casadi::GenericShared< SharedObject, SharedObjectInternal >::get().
Referenced by operator*().
|
inlineinherited |
Definition at line 91 of file shared_object.hpp.
|
inherited |
Definition at line 103 of file generic_shared_impl.hpp.
|
inherited |
Definition at line 117 of file generic_shared_impl.hpp.
const ResourceInternal & casadi::Resource::operator* | ( | ) | const |
ResourceInternal * casadi::Resource::operator-> | ( | ) |
Definition at line 54 of file resource.cpp.
References casadi::GenericShared< SharedObject, SharedObjectInternal >::operator->().
const ResourceInternal * casadi::Resource::operator-> | ( | ) | const |
Definition at line 50 of file resource.cpp.
References casadi::GenericShared< SharedObject, SharedObjectInternal >::operator->().
|
inherited |
Assign the node to a node class pointer (or null)
Definition at line 90 of file generic_shared_impl.hpp.
const std::string & casadi::Resource::path | ( | ) | const |
Definition at line 70 of file resource.cpp.
Referenced by casadi::FmuInternal::finalize(), and Resource().
|
inherited |
Print the pointer to the internal class
Definition at line 43 of file shared_object.cpp.
References casadi::GenericShared< SharedObject, SharedObjectInternal >::get().
void casadi::Resource::serialize | ( | SerializingStream & | s | ) | const |
Extra doc: https://github.com/casadi/casadi/wiki/L_2cq
Definition at line 78 of file resource.cpp.
|
inherited |
Definition at line 106 of file generic_shared_impl.hpp.
|
static |
Definition at line 62 of file resource.cpp.
|
inlinestatic |
Definition at line 59 of file resource.hpp.
|
inherited |
Extra doc: https://github.com/casadi/casadi/wiki/L_aw
Definition at line 131 of file generic_shared_impl.hpp.