26 #if ! defined (octave_fcn_info_h)
27 #define octave_fcn_info_h 1
29 #include "octave-config.h"
46 typedef std::map<std::string, octave_value>::const_iterator
57 : name (nm), package_name (), local_functions (),
58 private_functions (), class_constructors (), class_methods (),
59 cmdline_function (), autoload_function (), function_on_path (),
62 std::size_t pos = name.rfind (
'.');
64 if (pos != std::string::npos)
66 package_name = name.substr (0, pos);
67 name = name.substr (pos+1);
81 octave_value load_private_function (
const std::string& dir_name);
85 octave_value load_class_method (
const std::string& dispatch_type);
94 octave_value find_private_function (
const std::string& dir_name);
96 octave_value find_method (
const std::string& dispatch_type);
108 return function_on_path.is_defined ();
114 return find (search_scope, args);
119 cmdline_function =
f;
123 const std::string& file_name)
125 local_functions[file_name] =
f;
130 function_on_path =
f;
135 built_in_function =
f;
138 void install_built_in_dispatch (
const std::string& klass);
140 template <
typename T>
142 clear_map (std::map<T, octave_value>& map,
bool force =
false)
144 auto p = map.begin ();
146 while (p != map.end ())
148 if (force || ! p->second.islocked ())
157 if (force || ! autoload_function.islocked ())
165 clear_autoload_function (force);
167 if (force || ! function_on_path.islocked ())
170 if (force || ! cmdline_function.islocked ())
176 if (function_on_path.is_mex_function ())
177 clear_user_function ();
182 package = octave_value ();
187 clear_map (local_functions, force);
188 clear_map (private_functions, force);
189 clear_map (class_constructors, force);
190 clear_map (class_methods, force);
192 clear_autoload_function (force);
193 clear_user_function (force);
201 if (package_name.empty ())
204 return package_name +
'.' + name;
255 return m_rep->find (search_scope, args);
261 return m_rep->builtin_find (search_scope);
266 return m_rep->find_scoped_function (search_scope);
271 return m_rep->find_private_function (dir_name);
276 return m_rep->find_method (dispatch_type);
281 return m_rep->built_in_function;
286 return m_rep->cmdline_function;
291 return m_rep->find_autoload ();
297 return m_rep->find_user_function ();
302 return m_rep->is_user_function_defined ();
309 return m_rep->find_function (search_scope, args);
314 m_rep->install_cmdline_function (
f);
318 const std::string& file_name)
320 m_rep->install_local_function (
f, file_name);
325 m_rep->install_user_function (
f);
330 m_rep->install_built_in_function (
f);
335 m_rep->install_built_in_dispatch (klass);
338 void clear (
bool force =
false) { m_rep->clear (force); }
342 m_rep->clear_user_function (force);
347 m_rep->clear_autoload_function (force);
356 std::shared_ptr<fcn_info_rep>
m_rep;
359 extern OCTINTERP_API std::string
362 extern OCTINTERP_API std::string
fcn_info_rep(const std::string &nm)
void clear_mex_function(void)
bool is_user_function_defined(void) const
void clear_map(std::map< T, octave_value > &map, bool force=false)
std::string full_name(void) const
~fcn_info_rep(void)=default
octave_value install_local_function(const std::string &file_name)
void install_built_in_function(const octave_value &f)
octave_value autoload_function
void install_user_function(const octave_value &f)
void clear_autoload_function(bool force=false)
octave_value find_function(const symbol_scope &search_scope, const octave_value_list &args)
octave_value function_on_path
void install_cmdline_function(const octave_value &f)
void clear_user_function(bool force=false)
std::map< std::string, octave_value > private_functions
std::map< std::string, octave_value > local_functions
std::map< std::string, octave_value > class_methods
octave_value built_in_function
void install_local_function(const octave_value &f, const std::string &file_name)
std::map< std::string, octave_value > class_constructors
fcn_info_rep(const fcn_info_rep &)=delete
void clear(bool force=false)
octave_value cmdline_function
octave_value find_method(const std::string &dispatch_type) const
fcn_info(const fcn_info &)=default
octave_value find_scoped_function(const symbol_scope &search_scope) const
octave_value find_function(const symbol_scope &search_scope, const octave_value_list &args=octave_value_list())
std::map< std::string, octave_value >::const_iterator str_val_const_iterator
void install_built_in_dispatch(const std::string &klass)
octave_value builtin_find(const symbol_scope &search_scope)
void clear(bool force=false)
bool is_user_function_defined(void) const
octave_value find_built_in_function(void) const
void clear_autoload_function(bool force=false)
void install_user_function(const octave_value &f)
void install_local_function(const octave_value &f, const std::string &file_name)
void install_cmdline_function(const octave_value &f)
octave_value find_autoload(void)
octave_value find(const symbol_scope &search_scope, const octave_value_list &args=octave_value_list())
void clear_user_function(bool force=false)
fcn_info(const std::string &nm="")
octave_value find_private_function(const std::string &dir_name) const
octave_value find_cmdline_function(void) const
octave_value dump(void) const
std::shared_ptr< fcn_info_rep > m_rep
std::map< std::string, octave_value >::iterator str_val_iterator
octave_value find_user_function(void)
void clear_mex_function(void)
void install_built_in_function(const octave_value &f)
octave_value dump(void) const
static octave_idx_type find(octave_idx_type i, octave_idx_type *pp)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
OCTINTERP_API std::string get_dispatch_type(const octave_value_list &args)
octave_value dump_function_map(const std::map< std::string, octave_value > &fcn_map)
F77_RET_T const F77_DBLE const F77_DBLE * f
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))