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

#include "symscope.h"

Inheritance diagram for symbol_scope_rep:
Collaboration diagram for 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
 
void cache_dir_name (const std::string &name)
 
void cache_fcn_file_name (const std::string &name)
 
void cache_fcn_name (const std::string &name)
 
void cache_name (const std::string &name)
 
std::string dir_name (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)
 
std::string fcn_file_name (void) const
 
std::string fcn_name (void) const
 
octave_value find_subfunction (const std::string &name) const
 
symbol_record find_symbol (const std::string &name)
 
bool has_subfunctions (void) const
 
symbol_record insert (const std::string &name)
 
symbol_record insert_local (const std::string &name)
 
void insert_symbol_record (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_nested (void) const
 
bool is_parent (void) const
 
bool is_primary_fcn_scope (void) const
 
bool is_relative (const std::shared_ptr< symbol_scope_rep > &scope) const
 
bool is_static (void) const
 
bool is_variable (const std::string &nm) const
 
std::list< octave_valuelocalfunctions (void) const
 
void lock_subfunctions (void)
 
bool look_nonlocal (const std::string &name, std::size_t offset, symbol_record &result)
 
symbol_record lookup_symbol (const std::string &name) const
 
void mark_as_variable (const std::string &nm)
 
void mark_as_variables (const std::list< std::string > &lst)
 
void mark_primary_fcn_scope (void)
 
void mark_static (void)
 
void mark_subfunctions_in_scope_as_private (const std::string &class_name)
 
std::string name (void) const
 
std::size_t nesting_depth (void) const
 
std::size_t num_symbols (void) const
 
symbol_scope_repoperator= (const symbol_scope &)=delete
 
std::list< std::string > parent_fcn_names (void) const
 
std::shared_ptr< symbol_scope_repparent_scope_rep (void) const
 
octave_valuepersistent_varref (std::size_t data_offset)
 
octave_value persistent_varval (std::size_t data_offset) const
 
std::shared_ptr< symbol_scope_repprimary_parent_scope_rep (void) const
 
void rename (const std::string &old_name, const std::string &new_name)
 
void set_nesting_depth (std::size_t depth)
 
void set_parent (const std::shared_ptr< symbol_scope_rep > &parent)
 
void set_primary_parent (const std::shared_ptr< symbol_scope_rep > &parent)
 
void set_user_code (octave_user_code *code)
 
void stash_subfunction_names (const std::list< std::string > &names)
 
std::list< std::string > subfunction_names (void) const
 
std::map< std::string, octave_valuesubfunctions (void) const
 
std::list< symbol_recordsymbol_list (void) const
 
std::map< std::string, symbol_record > & symbols (void)
 
const std::map< std::string, symbol_record > & symbols (void) const
 
void unlock_subfunctions (void)
 
void update_nest (void)
 
octave_user_codeuser_code (void) const
 

Private Attributes

std::vector< symbol_scopem_children
 Child nested functions. More...
 
octave_user_codem_code
 The associated user code (may be null). More...
 
std::string m_dir_name
 The directory associated with m_code. More...
 
std::string m_fcn_file_name
 The file name associated with m_code. More...
 
std::string m_fcn_name
 Simple name of the function corresponding to this scope. More...
 
bool m_is_primary_fcn_scope
 If true, this is the scope of a primary 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::size_t m_nesting_depth
 If true, then this scope belongs to a nested function. More...
 
std::weak_ptr< symbol_scope_repm_parent
 Parent of nested function (may be null). More...
 
std::map< std::size_t, octave_valuem_persistent_values
 Map from data offset to persistent values in this scope. More...
 
std::weak_ptr< symbol_scope_repm_primary_parent
 Primary (top) parent of nested function (may be null). More...
 
std::list< std::string > m_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 53 of file symscope.h.

Member Typedef Documentation

◆ subfunctions_const_iterator

typedef std::map<std::string, octave_value>::const_iterator symbol_scope_rep::subfunctions_const_iterator

Definition at line 64 of file symscope.h.

◆ subfunctions_iterator

typedef std::map<std::string, octave_value>::iterator symbol_scope_rep::subfunctions_iterator

Definition at line 66 of file symscope.h.

◆ table_const_iterator

typedef std::map<std::string, symbol_record>::const_iterator symbol_scope_rep::table_const_iterator

Definition at line 59 of file symscope.h.

◆ table_iterator

typedef std::map<std::string, symbol_record>::iterator symbol_scope_rep::table_iterator

Definition at line 61 of file symscope.h.

Constructor & Destructor Documentation

◆ symbol_scope_rep() [1/2]

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

Definition at line 68 of file symscope.h.

References insert_local().

◆ symbol_scope_rep() [2/2]

symbol_scope_rep::symbol_scope_rep ( const symbol_scope )
delete

◆ ~symbol_scope_rep()

symbol_scope_rep::~symbol_scope_rep ( void  )
default

Member Function Documentation

◆ cache_dir_name()

void symbol_scope_rep::cache_dir_name ( const std::string &  name)

Definition at line 230 of file symscope.cc.

References canonicalize_file_name(), m_dir_name, and name().

◆ cache_fcn_file_name()

void symbol_scope_rep::cache_fcn_file_name ( const std::string &  name)
inline

Definition at line 269 of file symscope.h.

References m_fcn_file_name, and name().

◆ cache_fcn_name()

void symbol_scope_rep::cache_fcn_name ( const std::string &  name)
inline

Definition at line 257 of file symscope.h.

References m_fcn_name, and name().

◆ cache_name()

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

Definition at line 253 of file symscope.h.

References m_name, and name().

◆ dir_name()

std::string symbol_scope_rep::dir_name ( void  ) const
inline

Definition at line 278 of file symscope.h.

References m_dir_name.

◆ dump()

octave_value symbol_scope_rep::dump ( void  ) const

◆ dump_symbols_map()

octave_value symbol_scope_rep::dump_symbols_map ( void  ) const

Definition at line 148 of file symscope.cc.

References symbol_record::dump(), m_symbols, and octave_value().

Referenced by dump().

◆ dup()

◆ erase_subfunctions()

void symbol_scope_rep::erase_subfunctions ( void  )
inline

Definition at line 225 of file symscope.h.

References m_subfunctions.

◆ fcn_file_name()

std::string symbol_scope_rep::fcn_file_name ( void  ) const
inline

Definition at line 274 of file symscope.h.

References m_fcn_file_name.

◆ fcn_name()

std::string symbol_scope_rep::fcn_name ( void  ) const
inline

Definition at line 255 of file symscope.h.

References m_fcn_name.

◆ find_subfunction()

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

Definition at line 173 of file symscope.cc.

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

◆ find_symbol()

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

Definition at line 155 of file symscope.h.

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

◆ has_subfunctions()

bool symbol_scope_rep::has_subfunctions ( void  ) const
inline

Definition at line 232 of file symscope.h.

References m_subfunction_names.

◆ insert()

symbol_record symbol_scope_rep::insert ( const std::string &  name)

◆ insert_local()

symbol_record symbol_scope_rep::insert_local ( const std::string &  name)

Definition at line 45 of file symscope.cc.

Referenced by symbol_scope_rep().

◆ insert_symbol_record()

void symbol_scope_rep::insert_symbol_record ( symbol_record sr)

◆ install_nestfunction()

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

Definition at line 196 of file symscope.h.

References m_children, m_subfunctions, and name().

◆ install_subfunction()

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

Definition at line 190 of file symscope.h.

References m_subfunctions, and name().

◆ is_nested()

bool symbol_scope_rep::is_nested ( void  ) const
inline

Definition at line 96 of file symscope.h.

References m_nesting_depth.

Referenced by insert(), is_relative(), is_variable(), look_nonlocal(), and update_nest().

◆ is_parent()

bool symbol_scope_rep::is_parent ( void  ) const
inline

Definition at line 102 of file symscope.h.

References m_children.

◆ is_primary_fcn_scope()

bool symbol_scope_rep::is_primary_fcn_scope ( void  ) const
inline

Definition at line 282 of file symscope.h.

References m_is_primary_fcn_scope.

◆ is_relative()

bool symbol_scope_rep::is_relative ( const std::shared_ptr< symbol_scope_rep > &  scope) const

Definition at line 236 of file symscope.cc.

References is_nested(), m_parent, and m_primary_parent.

◆ is_static()

bool symbol_scope_rep::is_static ( void  ) const
inline

Definition at line 104 of file symscope.h.

References m_is_static.

◆ is_variable()

bool symbol_scope_rep::is_variable ( const std::string &  nm) const

Definition at line 288 of file symscope.cc.

References is_nested(), m_parent, and m_symbols.

◆ localfunctions()

std::list< octave_value > symbol_scope_rep::localfunctions ( void  ) const

◆ lock_subfunctions()

void symbol_scope_rep::lock_subfunctions ( void  )
inline

Definition at line 207 of file symscope.h.

References m_subfunctions.

◆ look_nonlocal()

bool symbol_scope_rep::look_nonlocal ( const std::string &  name,
std::size_t  offset,
symbol_record result 
)

◆ lookup_symbol()

symbol_record symbol_scope_rep::lookup_symbol ( const std::string &  name) const
inline

Definition at line 165 of file symscope.h.

References m_symbols, and name().

◆ mark_as_variable()

void symbol_scope_rep::mark_as_variable ( const std::string &  nm)

Definition at line 274 of file symscope.cc.

References m_symbols.

Referenced by mark_as_variables().

◆ mark_as_variables()

void symbol_scope_rep::mark_as_variables ( const std::list< std::string > &  lst)

Definition at line 282 of file symscope.cc.

References mark_as_variable().

◆ mark_primary_fcn_scope()

void symbol_scope_rep::mark_primary_fcn_scope ( void  )
inline

Definition at line 280 of file symscope.h.

References m_is_primary_fcn_scope.

◆ mark_static()

void symbol_scope_rep::mark_static ( void  )
inline

Definition at line 106 of file symscope.h.

References m_is_static.

◆ mark_subfunctions_in_scope_as_private()

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

◆ name()

◆ nesting_depth()

std::size_t symbol_scope_rep::nesting_depth ( void  ) const
inline

Definition at line 98 of file symscope.h.

References m_nesting_depth.

◆ num_symbols()

std::size_t symbol_scope_rep::num_symbols ( void  ) const
inline

Definition at line 88 of file symscope.h.

References m_symbols.

Referenced by insert(), and insert_symbol_record().

◆ operator=()

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

◆ parent_fcn_names()

std::list< std::string > symbol_scope_rep::parent_fcn_names ( void  ) const

Definition at line 201 of file symscope.cc.

References parent_scope_rep().

◆ parent_scope_rep()

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

Definition at line 108 of file symscope.h.

References m_parent.

Referenced by parent_fcn_names().

◆ persistent_varref()

octave_value& symbol_scope_rep::persistent_varref ( std::size_t  data_offset)
inline

Definition at line 143 of file symscope.h.

References m_persistent_values.

◆ persistent_varval()

octave_value symbol_scope_rep::persistent_varval ( std::size_t  data_offset) const
inline

Definition at line 148 of file symscope.h.

References m_persistent_values, and octave_value().

◆ primary_parent_scope_rep()

std::shared_ptr<symbol_scope_rep> symbol_scope_rep::primary_parent_scope_rep ( void  ) const
inline

Definition at line 113 of file symscope.h.

References m_primary_parent.

◆ rename()

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

Definition at line 174 of file symscope.h.

References m_symbols, and symbol_record::rename().

◆ set_nesting_depth()

void symbol_scope_rep::set_nesting_depth ( std::size_t  depth)
inline

Definition at line 100 of file symscope.h.

References m_nesting_depth.

◆ set_parent()

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

Definition at line 218 of file symscope.cc.

References m_parent.

◆ set_primary_parent()

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

Definition at line 224 of file symscope.cc.

References m_primary_parent.

◆ set_user_code()

void symbol_scope_rep::set_user_code ( octave_user_code code)
inline

Definition at line 263 of file symscope.h.

References m_code.

◆ stash_subfunction_names()

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

Definition at line 237 of file symscope.h.

References m_subfunction_names.

◆ subfunction_names()

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

Definition at line 242 of file symscope.h.

References m_subfunction_names.

◆ subfunctions()

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

Definition at line 220 of file symscope.h.

References m_subfunctions.

◆ symbol_list()

std::list< symbol_record > symbol_scope_rep::symbol_list ( void  ) const

Definition at line 162 of file symscope.cc.

References m_symbols.

◆ symbols() [1/2]

std::map<std::string, symbol_record>& symbol_scope_rep::symbols ( void  )
inline

Definition at line 303 of file symscope.h.

References m_symbols.

◆ symbols() [2/2]

const std::map<std::string, symbol_record>& symbol_scope_rep::symbols ( void  ) const
inline

Definition at line 298 of file symscope.h.

References m_symbols.

◆ unlock_subfunctions()

void symbol_scope_rep::unlock_subfunctions ( void  )
inline

Definition at line 213 of file symscope.h.

References m_subfunctions.

◆ update_nest()

void symbol_scope_rep::update_nest ( void  )

◆ user_code()

octave_user_code* symbol_scope_rep::user_code ( void  ) const
inline

Definition at line 261 of file symscope.h.

References m_code.

Member Data Documentation

◆ m_children

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

Child nested functions.

Definition at line 360 of file symscope.h.

Referenced by dup(), install_nestfunction(), is_parent(), and update_nest().

◆ m_code

octave_user_code* symbol_scope_rep::m_code
private

The associated user code (may be null).

Definition at line 335 of file symscope.h.

Referenced by dup(), set_user_code(), and user_code().

◆ m_dir_name

std::string symbol_scope_rep::m_dir_name
private

The directory associated with m_code.

Definition at line 347 of file symscope.h.

Referenced by cache_dir_name(), dir_name(), and dup().

◆ m_fcn_file_name

std::string symbol_scope_rep::m_fcn_file_name
private

The file name associated with m_code.

Definition at line 343 of file symscope.h.

Referenced by cache_fcn_file_name(), dup(), and fcn_file_name().

◆ m_fcn_name

std::string symbol_scope_rep::m_fcn_name
private

Simple name of the function corresponding to this scope.

Definition at line 339 of file symscope.h.

Referenced by cache_fcn_name(), dup(), and fcn_name().

◆ m_is_primary_fcn_scope

bool symbol_scope_rep::m_is_primary_fcn_scope
private

If true, this is the scope of a primary function.

Definition at line 371 of file symscope.h.

Referenced by dup(), is_primary_fcn_scope(), and mark_primary_fcn_scope().

◆ m_is_static

bool symbol_scope_rep::m_is_static
private

If true then no variables can be added.

Definition at line 368 of file symscope.h.

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

◆ m_name

std::string symbol_scope_rep::m_name
private

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

Definition at line 315 of file symscope.h.

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

◆ m_nesting_depth

std::size_t symbol_scope_rep::m_nesting_depth
private

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

Definition at line 364 of file symscope.h.

Referenced by dump(), dup(), is_nested(), nesting_depth(), and set_nesting_depth().

◆ m_parent

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

Parent of nested function (may be null).

Definition at line 351 of file symscope.h.

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

◆ m_persistent_values

std::map<std::size_t, octave_value> symbol_scope_rep::m_persistent_values
private

Map from data offset to persistent values in this scope.

Definition at line 326 of file symscope.h.

Referenced by dup(), persistent_varref(), and persistent_varval().

◆ m_primary_parent

std::weak_ptr<symbol_scope_rep> symbol_scope_rep::m_primary_parent
private

Primary (top) parent of nested function (may be null).

Used to determine whether two nested functions are related.

Definition at line 356 of file symscope.h.

Referenced by dup(), is_relative(), primary_parent_scope_rep(), and set_primary_parent().

◆ m_subfunction_names

std::list<std::string> 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 331 of file symscope.h.

Referenced by dump(), dup(), has_subfunctions(), localfunctions(), stash_subfunction_names(), and subfunction_names().

◆ m_subfunctions

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

◆ m_symbols

std::map<std::string, symbol_record> symbol_scope_rep::m_symbols
private

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