GNU Octave  6.2.0
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
 
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)
 
void cache_parent_fcn_names (const std::list< std::string > &names)
 
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
 
std::list< octave_valuelocalfunctions (void) const
 
void lock_subfunctions (void)
 
bool look_nonlocal (const std::string &name, size_t offset, symbol_record &result)
 
symbol_record lookup_symbol (const std::string &name) const
 
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
 
size_t nesting_depth (void) const
 
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 (size_t data_offset)
 
octave_value persistent_varval (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 (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...
 
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::list< std::string > m_parent_fcn_names
 List Simple names of the parent functions corresponding to this scope. More...
 
std::map< 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 octave::symbol_scope_rep::subfunctions_const_iterator

Definition at line 64 of file symscope.h.

◆ subfunctions_iterator

typedef std::map<std::string, octave_value>::iterator octave::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 octave::symbol_scope_rep::table_const_iterator

Definition at line 59 of file symscope.h.

◆ table_iterator

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

Definition at line 61 of file symscope.h.

Constructor & Destructor Documentation

◆ symbol_scope_rep() [1/2]

octave::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]

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

◆ cache_dir_name()

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

Definition at line 212 of file symscope.cc.

References octave::sys::canonicalize_file_name(), m_dir_name, and name().

◆ cache_fcn_file_name()

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

Definition at line 278 of file symscope.h.

References m_fcn_file_name, and name().

◆ cache_fcn_name()

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

Definition at line 258 of file symscope.h.

References m_fcn_name, and name().

◆ cache_name()

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

Definition at line 254 of file symscope.h.

References m_name, and name().

◆ cache_parent_fcn_names()

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

Definition at line 265 of file symscope.h.

References m_parent_fcn_names.

◆ dir_name()

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

Definition at line 287 of file symscope.h.

References m_dir_name.

◆ 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 147 of file symscope.cc.

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

Referenced by dump().

◆ dup()

◆ erase_subfunctions()

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

Definition at line 226 of file symscope.h.

References m_subfunctions.

◆ fcn_file_name()

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

Definition at line 283 of file symscope.h.

References m_fcn_file_name.

◆ fcn_name()

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

Definition at line 256 of file symscope.h.

References m_fcn_name.

◆ find_subfunction()

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

Definition at line 172 of file symscope.cc.

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

◆ find_symbol()

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

Definition at line 156 of file symscope.h.

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

◆ has_subfunctions()

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

Definition at line 233 of file symscope.h.

References m_subfunction_names.

◆ insert()

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

◆ insert_local()

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

Definition at line 45 of file symscope.cc.

References insert_symbol_record(), and name().

Referenced by symbol_scope_rep().

◆ insert_symbol_record()

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

◆ 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 197 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 191 of file symscope.h.

References m_subfunctions, and name().

◆ is_nested()

bool octave::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(), look_nonlocal(), and update_nest().

◆ is_parent()

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

Definition at line 102 of file symscope.h.

References m_children.

◆ is_primary_fcn_scope()

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

Definition at line 291 of file symscope.h.

References m_is_primary_fcn_scope.

◆ is_relative()

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

Definition at line 218 of file symscope.cc.

References is_nested(), m_parent, and m_primary_parent.

◆ is_static()

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

Definition at line 104 of file symscope.h.

References m_is_static.

◆ localfunctions()

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

◆ lock_subfunctions()

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

Definition at line 208 of file symscope.h.

References m_subfunctions.

◆ look_nonlocal()

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

◆ lookup_symbol()

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

Definition at line 166 of file symscope.h.

References m_symbols, and name().

◆ mark_primary_fcn_scope()

void octave::symbol_scope_rep::mark_primary_fcn_scope ( void  )
inline

Definition at line 289 of file symscope.h.

References m_is_primary_fcn_scope.

◆ mark_static()

void octave::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 octave::symbol_scope_rep::mark_subfunctions_in_scope_as_private ( const std::string &  class_name)

◆ name()

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

◆ nesting_depth()

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

Definition at line 98 of file symscope.h.

References m_nesting_depth.

◆ num_symbols()

size_t octave::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& octave::symbol_scope_rep::operator= ( const symbol_scope )
delete

◆ parent_fcn_names()

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

Definition at line 260 of file symscope.h.

References m_parent_fcn_names.

Referenced by update_nest().

◆ parent_scope_rep()

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

Definition at line 108 of file symscope.h.

References m_parent.

◆ persistent_varref()

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

Definition at line 144 of file symscope.h.

References m_persistent_values.

◆ persistent_varval()

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

Definition at line 149 of file symscope.h.

References m_persistent_values, and octave_value().

◆ primary_parent_scope_rep()

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

Definition at line 113 of file symscope.h.

References m_primary_parent.

◆ rename()

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

Definition at line 175 of file symscope.h.

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

◆ set_nesting_depth()

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

Definition at line 100 of file symscope.h.

References m_nesting_depth.

◆ set_parent()

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

Definition at line 200 of file symscope.cc.

References m_parent.

◆ set_primary_parent()

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

Definition at line 206 of file symscope.cc.

References m_primary_parent.

◆ set_user_code()

void octave::symbol_scope_rep::set_user_code ( octave_user_code code)
inline

Definition at line 272 of file symscope.h.

References m_code.

◆ stash_subfunction_names()

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

Definition at line 238 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 243 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 221 of file symscope.h.

References m_subfunctions.

◆ symbol_list()

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

Definition at line 161 of file symscope.cc.

References m_symbols, and retval.

◆ symbols() [1/2]

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

Definition at line 307 of file symscope.h.

References m_symbols.

◆ symbols() [2/2]

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

Definition at line 302 of file symscope.h.

References m_symbols.

◆ unlock_subfunctions()

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

Definition at line 214 of file symscope.h.

References m_subfunctions.

◆ update_nest()

void octave::symbol_scope_rep::update_nest ( void  )

◆ user_code()

octave_user_code* octave::symbol_scope_rep::user_code ( void  ) const
inline

Definition at line 270 of file symscope.h.

References m_code.

Member Data Documentation

◆ m_children

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

Child nested functions.

Definition at line 368 of file symscope.h.

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

◆ m_code

octave_user_code* octave::symbol_scope_rep::m_code
private

The associated user code (may be null).

Definition at line 339 of file symscope.h.

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

◆ m_dir_name

std::string octave::symbol_scope_rep::m_dir_name
private

The directory associated with m_code.

Definition at line 355 of file symscope.h.

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

◆ m_fcn_file_name

std::string octave::symbol_scope_rep::m_fcn_file_name
private

The file name associated with m_code.

Definition at line 351 of file symscope.h.

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

◆ m_fcn_name

std::string octave::symbol_scope_rep::m_fcn_name
private

Simple name of the function corresponding to this scope.

Definition at line 343 of file symscope.h.

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

◆ m_is_primary_fcn_scope

bool octave::symbol_scope_rep::m_is_primary_fcn_scope
private

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

Definition at line 379 of file symscope.h.

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

◆ m_is_static

bool octave::symbol_scope_rep::m_is_static
private

If true then no variables can be added.

Definition at line 376 of file symscope.h.

Referenced by dump(), dup(), 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 319 of file symscope.h.

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

◆ m_nesting_depth

size_t octave::symbol_scope_rep::m_nesting_depth
private

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

Definition at line 372 of file symscope.h.

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

◆ 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 359 of file symscope.h.

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

◆ m_parent_fcn_names

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

List Simple names of the parent functions corresponding to this scope.

Definition at line 347 of file symscope.h.

Referenced by cache_parent_fcn_names(), dup(), and parent_fcn_names().

◆ m_persistent_values

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

Map from data offset to persistent values in this scope.

Definition at line 330 of file symscope.h.

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

◆ m_primary_parent

std::weak_ptr<symbol_scope_rep> octave::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 364 of file symscope.h.

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

◆ 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 335 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> octave::symbol_scope_rep::m_subfunctions
private

◆ m_symbols

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

Map from symbol names to symbol info.

Definition at line 323 of file symscope.h.

Referenced by dump_symbols_map(), dup(), find_symbol(), insert(), insert_symbol_record(), look_nonlocal(), lookup_symbol(), num_symbols(), rename(), symbol_list(), symbols(), and update_nest().


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