26 #if ! defined (octave_oct_shlib_h)
27 #define octave_oct_shlib_h 1
29 #include "octave-config.h"
47 typedef std::function<std::string (
const std::string&)>
name_mangler;
54 : m_count (1), m_fcn_names (), m_file (), m_time_loaded (time_t ()),
55 m_search_all_loaded (false)
66 s_instances.erase (m_file);
72 virtual void *
search (
const std::string&,
76 bool is_out_of_date (
void)
const;
79 static dynlib_rep * new_instance (
const std::string&
f);
81 static dynlib_rep * get_instance (
const std::string&
f,
bool fake);
84 {
return m_time_loaded; }
91 std::list<std::string> function_names (
void)
const;
93 void add_fcn_name (
const std::string&);
95 bool remove_fcn_name (
const std::string&);
105 void fake_reload (
void);
132 if (--m_rep->m_count == 0 && m_rep != &s_nil_rep)
144 if (m_rep != sl.
m_rep)
146 if (--m_rep->m_count == 0 && m_rep != &s_nil_rep)
157 {
return (m_rep == sl.
m_rep); }
159 operator bool ()
const {
return m_rep->is_open (); }
166 std::list<std::string> removed_fcns = m_rep->function_names ();
168 m_rep->clear_fcn_names ();
178 void *
f = m_rep->search (nm, mangler);
180 m_rep->add_fcn_name (nm);
186 { m_rep->add_fcn_name (
name); }
189 {
return m_rep->remove_fcn_name (
name); }
192 {
return m_rep->num_fcn_names (); }
195 {
return m_rep->is_out_of_date (); }
198 {
return m_rep->file_name (); }
201 {
return m_rep->time_loaded (); }
virtual ~dynlib_rep(void)
void clear_fcn_names(void)
static std::map< std::string, dynlib_rep * > s_instances
std::map< std::string, size_t > m_fcn_names
virtual bool is_open(void) const
std::map< std::string, size_t >::iterator fcn_names_iterator
std::string file_name(void) const
size_t num_fcn_names(void) const
std::map< std::string, size_t >::const_iterator fcn_names_const_iterator
virtual void * search(const std::string &, const name_mangler &=name_mangler())
refcount< octave_idx_type > m_count
sys::time time_loaded(void) const
sys::time time_loaded(void) const
bool remove(const std::string &name)
dynamic_library(const dynamic_library &sl)
std::function< std::string(const std::string &)> name_mangler
void add(const std::string &name)
std::list< std::string > close(void)
bool is_out_of_date(void) const
static dynlib_rep s_nil_rep
size_t number_of_functions_loaded(void) const
std::string file_name(void) const
dynamic_library(const std::string &f, bool fake=true)
void open(const std::string &f)
void * search(const std::string &nm, const name_mangler &mangler=name_mangler()) const
static double f(double k, double l_nu, double c_pm)
bool operator==(const cdef_class &clsa, const cdef_class &clsb)