GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
octave::symbol_scope_rep Class Reference

#include "symscope.h"

Inheritance diagram for octave::symbol_scope_rep:
Collaboration diagram for octave::symbol_scope_rep:

Public Types

typedef std::map< std::string, octave_value >::const_iterator subfunctions_const_iterator
 
typedef std::map< std::string, octave_value >::iterator subfunctions_iterator
 
typedef std::map< std::string, symbol_record >::const_iterator table_const_iterator
 
typedef std::map< std::string, symbol_record >::iterator table_iterator
 

Public Member Functions

 symbol_scope_rep (const std::string &name="")
 
 symbol_scope_rep (const symbol_scope &)=delete
 
 ~symbol_scope_rep (void)=default
 
std::list< symbol_recordall_variables (bool defined_only=true, unsigned int exclude=symbol_record::hidden) const
 
void assign (const std::string &name, const octave_value &value, bool force_add)
 
void assign (const std::string &name, const octave_value &value=octave_value())
 
void bind_script_symbols (const std::shared_ptr< symbol_scope_rep > &curr_scope)
 
void cache_name (const std::string &name)
 
void clear_objects (void)
 
void clear_variable (const std::string &name)
 
void clear_variable_pattern (const std::string &pat)
 
void clear_variable_regexp (const std::string &pat)
 
void clear_variables (void)
 
symbol_record::context_id current_context (void) const
 
octave_value dump (void) const
 
octave_value dump_symbols_map (void) const
 
std::shared_ptr< symbol_scope_repdup (void) const
 
void erase_subfunctions (void)
 
octave_value find (const std::string &name, const octave_value_list &args, bool skip_variables, bool local_funcs)
 
octave_value find_subfunction (const std::string &name) const
 
symbol_record find_symbol (const std::string &name)
 
void force_assign (const std::string &name, const octave_value &value)
 
octave_user_functionfunction (void)
 
std::list< symbol_recordglob (const std::string &pattern, bool vars_only=false) const
 
bool has_subfunctions (void) const
 
void inherit (const std::shared_ptr< symbol_scope_rep > &donor_scope_rep)
 
void inherit_internal (const std::shared_ptr< symbol_scope_rep > &donor_scope_rep)
 
symbol_recordinsert (const std::string &name, bool force_add=false)
 
void insert_symbol_record (const symbol_record &sr)
 
void install_nestfunction (const std::string &name, const octave_value &fval, const symbol_scope &fcn_scope)
 
void install_subfunction (const std::string &name, const octave_value &fval)
 
bool is_global (const std::string &name) const
 
bool is_local_variable (const std::string &name) const
 
bool is_nested (void) const
 
bool is_static (void) const
 
bool is_variable (const std::string &name) const
 
void lock_subfunctions (void)
 
bool look_nonlocal (const std::string &name, symbol_record &result)
 
void mark_automatic (const std::string &name)
 
void mark_global (const std::string &name)
 
void mark_hidden (const std::string &name)
 
void mark_nested (void)
 
void mark_static (void)
 
void mark_subfunctions_in_scope_as_private (const std::string &class_name)
 
std::string name (void) const
 
symbol_scope_repoperator= (const symbol_scope &)=delete
 
std::shared_ptr< symbol_scope_repparent_scope_rep (void) const
 
void pop_context (void)
 
void push_context (void)
 
void refresh (void)
 
std::list< symbol_recordregexp (const std::string &pattern, bool vars_only=false) const
 
void rename (const std::string &old_name, const std::string &new_name)
 
void set_context (symbol_record::context_id context)
 
void set_function (octave_user_function *fcn)
 
void set_parent (const std::shared_ptr< symbol_scope_rep > &parent)
 
void stash_subfunction_names (const std::list< std::string > &names)
 
std::list< std::stringsubfunction_names (void) const
 
std::map< std::string, octave_valuesubfunctions (void) const
 
void unbind_script_symbols (void)
 
void unlock_subfunctions (void)
 
void update_nest (void)
 
std::list< std::stringvariable_names (void)
 
octave_value varval (const std::string &name) const
 

Private Attributes

std::vector< symbol_scopem_children
 Child nested functions. More...
 
symbol_record::context_id m_context
 
octave_user_functionm_fcn
 The associated user code (may be null). More...
 
bool m_is_nested
 If true, then this scope belongs to a nested function. More...
 
bool m_is_static
 If true then no variables can be added. More...
 
std::string m_name
 Name for this scope (usually the corresponding filename of the function corresponding to the scope). More...
 
std::weak_ptr< symbol_scope_repm_parent
 Parent of nested function (may be null). More...
 
std::list< std::stringm_subfunction_names
 The list of subfunctions (if any) in the order they appear in the function file. More...
 
std::map< std::string, octave_valuem_subfunctions
 Map from symbol names to subfunctions. More...
 
std::map< std::string, symbol_recordm_symbols
 Map from symbol names to symbol info. More...
 

Detailed Description

Definition at line 52 of file symscope.h.

Member Typedef Documentation

◆ subfunctions_const_iterator

◆ subfunctions_iterator

◆ table_const_iterator

Definition at line 58 of file symscope.h.

◆ table_iterator

Constructor & Destructor Documentation

◆ symbol_scope_rep() [1/2]

octave::symbol_scope_rep::symbol_scope_rep ( const std::string name = "")
inline

Definition at line 67 of file symscope.h.

Referenced by dup().

◆ symbol_scope_rep() [2/2]

octave::symbol_scope_rep::symbol_scope_rep ( const symbol_scope )
delete

◆ ~symbol_scope_rep()

octave::symbol_scope_rep::~symbol_scope_rep ( void  )
default

Member Function Documentation

◆ all_variables()

std::list<symbol_record> octave::symbol_scope_rep::all_variables ( bool  defined_only = true,
unsigned int  exclude = symbol_record::hidden 
) const
inline

◆ assign() [1/2]

void octave::symbol_scope_rep::assign ( const std::string name,
const octave_value value,
bool  force_add 
)
inline

Definition at line 196 of file symscope.h.

References octave::symbol_record::assign(), insert(), m_context, m_symbols, name(), p, and value.

Referenced by assign().

◆ assign() [2/2]

void octave::symbol_scope_rep::assign ( const std::string name,
const octave_value value = octave_value () 
)
inline

Definition at line 211 of file symscope.h.

References assign(), name(), and value.

◆ bind_script_symbols()

void octave::symbol_scope_rep::bind_script_symbols ( const std::shared_ptr< symbol_scope_rep > &  curr_scope)

Definition at line 229 of file symscope.cc.

◆ cache_name()

void octave::symbol_scope_rep::cache_name ( const std::string name)
inline

Definition at line 539 of file symscope.h.

References m_name, and name().

◆ clear_objects()

void octave::symbol_scope_rep::clear_objects ( void  )
inline

Definition at line 293 of file symscope.h.

References m_context, m_symbols, val, and octave::symbol_record::varval().

◆ clear_variable()

void octave::symbol_scope_rep::clear_variable ( const std::string name)
inline

Definition at line 304 of file symscope.h.

References m_context, m_is_nested, m_symbols, name(), p, and parent_scope_rep().

◆ clear_variable_pattern()

void octave::symbol_scope_rep::clear_variable_pattern ( const std::string pat)
inline

◆ clear_variable_regexp()

void octave::symbol_scope_rep::clear_variable_regexp ( const std::string pat)
inline

◆ clear_variables()

void octave::symbol_scope_rep::clear_variables ( void  )
inline

Definition at line 287 of file symscope.h.

References m_context, and m_symbols.

◆ current_context()

symbol_record::context_id octave::symbol_scope_rep::current_context ( void  ) const
inline

Definition at line 117 of file symscope.h.

References m_context.

◆ dump()

octave_value octave::symbol_scope_rep::dump ( void  ) const

◆ dump_symbols_map()

octave_value octave::symbol_scope_rep::dump_symbols_map ( void  ) const

Definition at line 124 of file symscope.cc.

References octave::symbol_record::dump(), m_context, m_symbols, nm, octave_value(), and string.

Referenced by dump().

◆ dup()

std::shared_ptr<symbol_scope_rep> octave::symbol_scope_rep::dup ( void  ) const
inline

Definition at line 99 of file symscope.h.

References m_name, m_parent, m_symbols, and symbol_scope_rep().

◆ erase_subfunctions()

void octave::symbol_scope_rep::erase_subfunctions ( void  )
inline

Definition at line 513 of file symscope.h.

References m_subfunctions.

◆ find()

◆ find_subfunction()

octave_value octave::symbol_scope_rep::find_subfunction ( const std::string name) const

Definition at line 139 of file symscope.cc.

References m_parent, m_subfunctions, name(), octave_value(), and p.

Referenced by find().

◆ find_symbol()

symbol_record octave::symbol_scope_rep::find_symbol ( const std::string name)
inline

Definition at line 122 of file symscope.h.

References insert(), m_symbols, name(), and p.

◆ force_assign()

void octave::symbol_scope_rep::force_assign ( const std::string name,
const octave_value value 
)
inline

Definition at line 217 of file symscope.h.

References octave::symbol_record::assign(), insert(), m_context, m_symbols, name(), p, and value.

◆ function()

octave_user_function* octave::symbol_scope_rep::function ( void  )
inline

Definition at line 541 of file symscope.h.

References m_fcn.

◆ glob()

std::list<symbol_record> octave::symbol_scope_rep::glob ( const std::string pattern,
bool  vars_only = false 
) const
inline

◆ has_subfunctions()

bool octave::symbol_scope_rep::has_subfunctions ( void  ) const
inline

Definition at line 520 of file symscope.h.

References m_subfunction_names.

◆ inherit()

void octave::symbol_scope_rep::inherit ( const std::shared_ptr< symbol_scope_rep > &  donor_scope_rep)
inline

Definition at line 158 of file symscope.h.

References inherit_internal(), and parent_scope_rep().

◆ inherit_internal()

void octave::symbol_scope_rep::inherit_internal ( const std::shared_ptr< symbol_scope_rep > &  donor_scope_rep)
inline

◆ insert()

symbol_record & octave::symbol_scope_rep::insert ( const std::string name,
bool  force_add = false 
)

◆ insert_symbol_record()

void octave::symbol_scope_rep::insert_symbol_record ( const symbol_record sr)
inline

Definition at line 81 of file symscope.h.

References m_symbols, and octave::symbol_record::name().

◆ install_nestfunction()

void octave::symbol_scope_rep::install_nestfunction ( const std::string name,
const octave_value fval,
const symbol_scope fcn_scope 
)
inline

Definition at line 485 of file symscope.h.

References m_children, m_subfunctions, and name().

◆ install_subfunction()

void octave::symbol_scope_rep::install_subfunction ( const std::string name,
const octave_value fval 
)
inline

Definition at line 479 of file symscope.h.

References m_subfunctions, and name().

◆ is_global()

bool octave::symbol_scope_rep::is_global ( const std::string name) const
inline

Definition at line 472 of file symscope.h.

References m_symbols, name(), and p.

◆ is_local_variable()

bool octave::symbol_scope_rep::is_local_variable ( const std::string name) const
inline

Definition at line 463 of file symscope.h.

References m_context, m_symbols, name(), and p.

◆ is_nested()

bool octave::symbol_scope_rep::is_nested ( void  ) const
inline

Definition at line 86 of file symscope.h.

References m_is_nested.

◆ is_static()

bool octave::symbol_scope_rep::is_static ( void  ) const
inline

Definition at line 90 of file symscope.h.

References m_is_static.

◆ is_variable()

bool octave::symbol_scope_rep::is_variable ( const std::string name) const
inline

Definition at line 239 of file symscope.h.

References octave::symbol_record::is_variable(), m_context, m_symbols, name(), p, and retval.

◆ lock_subfunctions()

void octave::symbol_scope_rep::lock_subfunctions ( void  )
inline

Definition at line 496 of file symscope.h.

References m_subfunctions.

◆ look_nonlocal()

bool octave::symbol_scope_rep::look_nonlocal ( const std::string name,
symbol_record result 
)

Definition at line 207 of file symscope.cc.

References m_is_nested, m_parent, m_symbols, name(), p, and result.

◆ mark_automatic()

void octave::symbol_scope_rep::mark_automatic ( const std::string name)
inline

Definition at line 367 of file symscope.h.

References insert(), octave::symbol_record::mark_automatic(), and name().

◆ mark_global()

void octave::symbol_scope_rep::mark_global ( const std::string name)
inline

Definition at line 377 of file symscope.h.

References insert(), octave::symbol_record::mark_global(), and name().

◆ mark_hidden()

void octave::symbol_scope_rep::mark_hidden ( const std::string name)
inline

Definition at line 372 of file symscope.h.

References insert(), octave::symbol_record::mark_hidden(), and name().

◆ mark_nested()

void octave::symbol_scope_rep::mark_nested ( void  )
inline

Definition at line 88 of file symscope.h.

References m_is_nested.

◆ mark_static()

void octave::symbol_scope_rep::mark_static ( void  )
inline

Definition at line 92 of file symscope.h.

References m_is_static.

◆ mark_subfunctions_in_scope_as_private()

void octave::symbol_scope_rep::mark_subfunctions_in_scope_as_private ( const std::string class_name)

◆ name()

◆ operator=()

symbol_scope_rep& octave::symbol_scope_rep::operator= ( const symbol_scope )
delete

◆ parent_scope_rep()

std::shared_ptr<symbol_scope_rep> octave::symbol_scope_rep::parent_scope_rep ( void  ) const
inline

Definition at line 94 of file symscope.h.

References m_parent.

Referenced by clear_variable(), clear_variable_pattern(), clear_variable_regexp(), and inherit().

◆ pop_context()

void octave::symbol_scope_rep::pop_context ( void  )
inline

Definition at line 261 of file symscope.h.

References m_symbols.

◆ push_context()

void octave::symbol_scope_rep::push_context ( void  )
inline

Definition at line 255 of file symscope.h.

References m_symbols.

◆ refresh()

◆ regexp()

std::list<symbol_record> octave::symbol_scope_rep::regexp ( const std::string pattern,
bool  vars_only = false 
) const
inline

◆ rename()

void octave::symbol_scope_rep::rename ( const std::string old_name,
const std::string new_name 
)
inline

Definition at line 180 of file symscope.h.

References m_symbols, p, and octave::symbol_record::rename().

◆ set_context()

void octave::symbol_scope_rep::set_context ( symbol_record::context_id  context)
inline

Definition at line 112 of file symscope.h.

References octave::context, and m_context.

◆ set_function()

void octave::symbol_scope_rep::set_function ( octave_user_function fcn)
inline

Definition at line 543 of file symscope.h.

References fcn, and m_fcn.

◆ set_parent()

void octave::symbol_scope_rep::set_parent ( const std::shared_ptr< symbol_scope_rep > &  parent)

Definition at line 167 of file symscope.cc.

References m_parent.

◆ stash_subfunction_names()

void octave::symbol_scope_rep::stash_subfunction_names ( const std::list< std::string > &  names)
inline

Definition at line 525 of file symscope.h.

References m_subfunction_names.

◆ subfunction_names()

std::list<std::string> octave::symbol_scope_rep::subfunction_names ( void  ) const
inline

Definition at line 530 of file symscope.h.

References m_subfunction_names.

◆ subfunctions()

std::map<std::string, octave_value> octave::symbol_scope_rep::subfunctions ( void  ) const
inline

Definition at line 508 of file symscope.h.

References m_subfunctions.

◆ unbind_script_symbols()

void octave::symbol_scope_rep::unbind_script_symbols ( void  )

Definition at line 237 of file symscope.cc.

References m_symbols.

◆ unlock_subfunctions()

void octave::symbol_scope_rep::unlock_subfunctions ( void  )
inline

Definition at line 502 of file symscope.h.

References m_subfunctions.

◆ update_nest()

void octave::symbol_scope_rep::update_nest ( void  )

◆ variable_names()

std::list<std::string> octave::symbol_scope_rep::variable_names ( void  )
inline

Definition at line 448 of file symscope.h.

References m_context, m_symbols, retval, and octave_value::sort().

◆ varval()

octave_value octave::symbol_scope_rep::varval ( const std::string name) const
inline

Definition at line 231 of file symscope.h.

References m_context, m_symbols, name(), octave_value(), and p.

Member Data Documentation

◆ m_children

std::vector<symbol_scope> octave::symbol_scope_rep::m_children
private

Child nested functions.

Definition at line 587 of file symscope.h.

Referenced by install_nestfunction(), and update_nest().

◆ m_context

◆ m_fcn

octave_user_function* octave::symbol_scope_rep::m_fcn
private

The associated user code (may be null).

Definition at line 579 of file symscope.h.

Referenced by function(), and set_function().

◆ m_is_nested

bool octave::symbol_scope_rep::m_is_nested
private

If true, then this scope belongs to a nested function.

Definition at line 591 of file symscope.h.

Referenced by clear_variable(), clear_variable_pattern(), clear_variable_regexp(), insert(), is_nested(), look_nonlocal(), mark_nested(), and update_nest().

◆ m_is_static

bool octave::symbol_scope_rep::m_is_static
private

If true then no variables can be added.

Definition at line 595 of file symscope.h.

Referenced by insert(), is_static(), mark_static(), and update_nest().

◆ m_name

std::string octave::symbol_scope_rep::m_name
private

Name for this scope (usually the corresponding filename of the function corresponding to the scope).

Definition at line 562 of file symscope.h.

Referenced by cache_name(), dump(), dup(), and name().

◆ m_parent

std::weak_ptr<symbol_scope_rep> octave::symbol_scope_rep::m_parent
private

Parent of nested function (may be null).

Definition at line 583 of file symscope.h.

Referenced by dup(), find_subfunction(), insert(), look_nonlocal(), parent_scope_rep(), set_parent(), and update_nest().

◆ m_subfunction_names

std::list<std::string> octave::symbol_scope_rep::m_subfunction_names
private

The list of subfunctions (if any) in the order they appear in the function file.

Definition at line 575 of file symscope.h.

Referenced by has_subfunctions(), stash_subfunction_names(), and subfunction_names().

◆ m_subfunctions

std::map<std::string, octave_value> octave::symbol_scope_rep::m_subfunctions
private

◆ m_symbols


The documentation for this class was generated from the following files: