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

#include "cdef-class.h"

Inheritance diagram for octave::cdef_class:
Collaboration diagram for octave::cdef_class:

Classes

class  cdef_class_rep
 

Public Types

enum  { property_normal , property_inherited , property_all }
 

Public Member Functions

 cdef_class (const cdef_class &cls)
 
 cdef_class (const cdef_object &obj)
 
 cdef_class (const std::string &nm, const std::list< cdef_class > &superclasses)
 
 cdef_class (void)
 
 ~cdef_class (void)=default
 
Array< cdef_objectarray_value (void) const
 
std::string class_name (void) const
 
cdef_object clone (void) const
 
octave_value construct (const octave_value_list &args)
 
cdef_object construct_object (const octave_value_list &args)
 
cdef_object copy (void) const
 
void delete_object (const cdef_object &obj)
 
dim_vector dims (void) const
 
void doc_string (const std::string &txt)
 
std::string doc_string (void) const
 
cdef_object empty_clone (void) const
 
cdef_method find_method (const std::string &nm, bool local=false)
 
cdef_property find_property (const std::string &nm)
 
octave_value get (const std::string &pname) const
 
cdef_class get_class (void) const
 
octave_value get_constructor_function (void)
 
std::string get_directory (void) const
 
octave_value get_method (const std::string &nm) const
 
octave_value get_method_function (const std::string &nm)
 
std::map< std::string, cdef_methodget_method_map (bool only_inherited=false, bool include_ctor=false)
 
Cell get_methods (bool include_ctor=false)
 
std::string get_name (void) const
 
string_vector get_names (void)
 
Cell get_properties (int mode=property_normal)
 
octave_value get_property (octave_idx_type idx, const std::string &pname) const
 
std::map< std::string, cdef_propertyget_property_map (int mode=property_normal)
 
void initialize_object (cdef_object &obj)
 
void install_method (const cdef_method &meth)
 
void install_property (const cdef_property &prop)
 
bool is (const cdef_object &obj) const
 
bool is_abstract (void) const
 
bool is_array (void) const
 
bool is_builtin (void) const
 
bool is_class (void) const
 
bool is_constructed (void) const
 
bool is_constructed_for (const cdef_class &cls) const
 
bool is_handle_class (void) const
 
bool is_handle_object (void) const
 
bool is_meta_class (void) const
 
bool is_meta_object (void) const
 
bool is_method (void) const
 
bool is_package (void) const
 
bool is_partially_constructed_for (const cdef_class &cls) const
 
bool is_property (void) const
 
bool is_sealed (void) const
 
bool is_value_object (void) const
 
cdef_object make_array (void) const
 
string_vector map_keys (void) const
 
octave_map map_value (void) const
 
void mark_as_constructed (const cdef_class &cls)
 
void mark_as_constructed (void)
 
void mark_as_handle_class (void)
 
void mark_as_meta_class (void)
 
void mark_for_construction (const cdef_class &cls)
 
bool meta_accepts_postfix_index (char type) const
 
void meta_release (void)
 
octave_value_list meta_subsref (const std::string &type, const std::list< octave_value_list > &idx, int nargout)
 
bool ok (void) const
 
cdef_classoperator= (const cdef_class &cls)
 
void put (const std::string &pname, const octave_value &val)
 
void run_constructor (cdef_object &obj, const octave_value_list &args)
 
void set_class (const cdef_class &cls)
 
void set_directory (const std::string &dir)
 
void set_property (octave_idx_type idx, const std::string &pname, const octave_value &pval)
 
octave_value subsasgn (const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs, int ignore_copies=0)
 
octave_value_list subsref (const std::string &type, const std::list< octave_value_list > &idx, int nargout, size_t &skip, const cdef_class &context, bool auto_add=false)
 

Static Public Member Functions

static cdef_class make_meta_class (interpreter &interp, tree_classdef *t, bool is_at_folder=false)
 Analyze the tree_classdef tree and transform it to a cdef_class. More...
 

Protected Member Functions

void make_unique (int ignore_copies)
 

Private Member Functions

cdef_class_repget_rep (void)
 
const cdef_class_repget_rep (void) const
 

Private Attributes

cdef_object_reprep
 

Friends

void install_classdef (interpreter &interp)
 
bool operator!= (const cdef_class &, const cdef_class &)
 
bool operator< (const cdef_class &, const cdef_class &)
 
bool operator== (const cdef_class &, const cdef_class &)
 

Detailed Description

Definition at line 50 of file cdef-class.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
property_normal 
property_inherited 
property_all 

Definition at line 389 of file cdef-class.h.

Constructor & Destructor Documentation

◆ cdef_class() [1/4]

octave::cdef_class::cdef_class ( void  )
inline

Definition at line 224 of file cdef-class.h.

◆ cdef_class() [2/4]

octave::cdef_class::cdef_class ( const std::string &  nm,
const std::list< cdef_class > &  superclasses 
)
inline

Definition at line 226 of file cdef-class.h.

◆ cdef_class() [3/4]

octave::cdef_class::cdef_class ( const cdef_class cls)
inline

Definition at line 232 of file cdef-class.h.

◆ cdef_class() [4/4]

octave::cdef_class::cdef_class ( const cdef_object obj)
inline

Definition at line 234 of file cdef-class.h.

References error().

◆ ~cdef_class()

octave::cdef_class::~cdef_class ( void  )
default

Member Function Documentation

◆ array_value()

Array<cdef_object> octave::cdef_object::array_value ( void  ) const
inlineinherited

◆ class_name()

std::string octave::cdef_object::class_name ( void  ) const
inlineinherited

◆ clone()

cdef_object octave::cdef_object::clone ( void  ) const
inlineinherited

Definition at line 230 of file cdef-object.h.

◆ construct()

octave_value octave::cdef_class::construct ( const octave_value_list args)
inline

Definition at line 349 of file cdef-class.h.

Referenced by octave::cdef_class::cdef_class_rep::meta_subsref().

◆ construct_object()

cdef_object octave::cdef_class::construct_object ( const octave_value_list args)
inline

◆ copy()

cdef_object octave::cdef_object::copy ( void  ) const
inlineinherited

Definition at line 244 of file cdef-object.h.

Referenced by octave::cdef_object_array::fill_empty_values().

◆ delete_object()

void octave::cdef_class::delete_object ( const cdef_object obj)
inline

◆ dims()

dim_vector octave::cdef_object::dims ( void  ) const
inlineinherited

Definition at line 237 of file cdef-object.h.

◆ doc_string() [1/2]

void octave::cdef_class::doc_string ( const std::string &  txt)
inline

Definition at line 383 of file cdef-class.h.

Referenced by octave_classdef_meta::doc_string().

◆ doc_string() [2/2]

std::string octave::cdef_class::doc_string ( void  ) const
inline

Definition at line 385 of file cdef-class.h.

◆ empty_clone()

cdef_object octave::cdef_object::empty_clone ( void  ) const
inlineinherited

Definition at line 232 of file cdef-object.h.

◆ find_method()

◆ find_property()

◆ get()

◆ get_class()

◆ get_constructor_function()

octave_value octave::cdef_class::get_constructor_function ( void  )
inline

◆ get_directory()

std::string octave::cdef_class::get_directory ( void  ) const
inline

Definition at line 299 of file cdef-class.h.

◆ get_method()

octave_value octave::cdef_class::get_method ( const std::string &  nm) const
inline

Definition at line 337 of file cdef-class.h.

Referenced by octave::cdef_manager::find_method().

◆ get_method_function()

octave_value octave::cdef_class::get_method_function ( const std::string &  nm)

Definition at line 1153 of file cdef-class.cc.

References octave_value().

◆ get_method_map()

std::map<std::string, cdef_method> octave::cdef_class::get_method_map ( bool  only_inherited = false,
bool  include_ctor = false 
)
inline

Definition at line 265 of file cdef-class.h.

Referenced by F__methods__().

◆ get_methods()

Cell octave::cdef_class::get_methods ( bool  include_ctor = false)
inline

Definition at line 259 of file cdef-class.h.

Referenced by octave::class_get_methods(), and make_meta_class().

◆ get_name()

◆ get_names()

string_vector octave::cdef_class::get_names ( void  )
inline

Definition at line 288 of file cdef-class.h.

Referenced by octave::cdef_object_rep::map_keys().

◆ get_properties()

Cell octave::cdef_class::get_properties ( int  mode = property_normal)
inline

Definition at line 277 of file cdef-class.h.

Referenced by octave::class_get_properties().

◆ get_property()

octave_value octave::cdef_object::get_property ( octave_idx_type  idx,
const std::string &  pname 
) const
inlineinherited

Definition at line 273 of file cdef-object.h.

◆ get_property_map()

std::map<std::string, cdef_property> octave::cdef_class::get_property_map ( int  mode = property_normal)
inline

◆ get_rep() [1/2]

◆ get_rep() [2/2]

const cdef_class_rep* octave::cdef_class::get_rep ( void  ) const
inlineprivate

Definition at line 403 of file cdef-class.h.

References octave::cdef_object::get_rep().

◆ initialize_object()

void octave::cdef_class::initialize_object ( cdef_object obj)
inline

Definition at line 359 of file cdef-class.h.

Referenced by octave::cdef_class::cdef_class_rep::construct_object().

◆ install_method()

void octave::cdef_class::install_method ( const cdef_method meth)
inline

Definition at line 254 of file cdef-class.h.

Referenced by octave::cdef_manager::cdef_manager().

◆ install_property()

void octave::cdef_class::install_property ( const cdef_property prop)
inline

Definition at line 272 of file cdef-class.h.

Referenced by octave::cdef_manager::cdef_manager().

◆ is()

bool octave::cdef_object::is ( const cdef_object obj) const
inlineinherited

◆ is_abstract()

bool octave::cdef_class::is_abstract ( void  ) const
inline

Definition at line 290 of file cdef-class.h.

Referenced by octave::cdef_class::cdef_class_rep::construct_object().

◆ is_array()

bool octave::cdef_object::is_array ( void  ) const
inlineinherited

◆ is_builtin()

bool octave::cdef_class::is_builtin ( void  ) const
inline

Definition at line 306 of file cdef-class.h.

Referenced by octave::cdef_manager::find_class().

◆ is_class()

bool octave::cdef_meta_object::is_class ( void  ) const
inlineinherited

Definition at line 658 of file cdef-object.h.

◆ is_constructed()

bool octave::cdef_object::is_constructed ( void  ) const
inlineinherited

◆ is_constructed_for()

bool octave::cdef_object::is_constructed_for ( const cdef_class cls) const
inlineinherited

Definition at line 309 of file cdef-object.h.

◆ is_handle_class()

bool octave::cdef_class::is_handle_class ( void  ) const
inline

Definition at line 374 of file cdef-class.h.

Referenced by octave::cdef_class::cdef_class_rep::construct_object().

◆ is_handle_object()

bool octave::cdef_object::is_handle_object ( void  ) const
inlineinherited

Definition at line 250 of file cdef-object.h.

◆ is_meta_class()

bool octave::cdef_class::is_meta_class ( void  ) const
inline

Definition at line 381 of file cdef-class.h.

Referenced by octave::cdef_class::cdef_class_rep::construct_object().

◆ is_meta_object()

bool octave::cdef_object::is_meta_object ( void  ) const
inlineinherited

Definition at line 252 of file cdef-object.h.

◆ is_method()

bool octave::cdef_meta_object::is_method ( void  ) const
inlineinherited

Definition at line 662 of file cdef-object.h.

◆ is_package()

bool octave::cdef_meta_object::is_package ( void  ) const
inlineinherited

Definition at line 664 of file cdef-object.h.

◆ is_partially_constructed_for()

bool octave::cdef_object::is_partially_constructed_for ( const cdef_class cls) const
inlineinherited

◆ is_property()

bool octave::cdef_meta_object::is_property ( void  ) const
inlineinherited

Definition at line 660 of file cdef-object.h.

◆ is_sealed()

bool octave::cdef_class::is_sealed ( void  ) const
inline

Definition at line 292 of file cdef-class.h.

◆ is_value_object()

bool octave::cdef_object::is_value_object ( void  ) const
inlineinherited

Definition at line 248 of file cdef-object.h.

◆ make_array()

cdef_object octave::cdef_object::make_array ( void  ) const
inlineinherited

Definition at line 239 of file cdef-object.h.

◆ make_meta_class()

cdef_class octave::cdef_class::make_meta_class ( interpreter interp,
tree_classdef t,
bool  is_at_folder = false 
)
static

Analyze the tree_classdef tree and transform it to a cdef_class.

All attribute validation should occur here.

Classdef attribute values can be given in the form of expressions. These expressions must be evaluated before assigning them as attribute values. Evaluating them as they are parsed causes trouble with possible recursion in the parser so we do it here. For example

classdef recursion_class
methods (Access = ?recursion_class)
endmethods
endclassdef

will fail because each attempt to compute the metaclass of recursion_class will cause recursion_class to be parsed again.

Definition at line 846 of file cdef-class.cc.

References octave::__get_cdef_manager__(), octave::action_container::add_method(), octave::tree_classdef::attribute_list(), octave::attribute_value_to_string(), octave::tree_classdef::body(), octave_value::bool_value(), octave::cdef_object::class_name(), octave::compute_attribute_value(), octave::tree_classdef::doc_string(), error(), octave::tree_expression::evaluate(), Array< T >::find(), octave::cdef_manager::find_package(), octave_value::function_value(), octave::cdef_object::get(), octave::interpreter::get_evaluator(), octave::interpreter::get_load_path(), get_methods(), octave::tree_classdef::ident(), octave::lookup_class(), octave::cdef_manager::make_class(), octave::make_fcn_handle(), octave::make_function_of_class(), octave::cdef_manager::make_method(), octave::cdef_manager::make_property(), octave::load_path::methods(), octave::tree_classdef_body::methods_list(), octave_function::name(), octave::tree_identifier::name(), octave::cdef_object::ok(), octave::tree_classdef::package_name(), octave::tree_evaluator::pop_scope(), octave::tree_classdef_body::properties_list(), octave::tree_evaluator::push_dummy_scope(), octave::cdef_object::put(), retval, octave_user_function::stash_function_name(), octave::tree_classdef::superclass_list(), and octave::to_ov().

Referenced by octave::tree_classdef::make_meta_class().

◆ make_unique()

void octave::cdef_object::make_unique ( int  ignore_copies)
inlineprotectedinherited

Definition at line 330 of file cdef-object.h.

◆ map_keys()

string_vector octave::cdef_object::map_keys ( void  ) const
inlineinherited

Definition at line 294 of file cdef-object.h.

◆ map_value()

◆ mark_as_constructed() [1/2]

void octave::cdef_object::mark_as_constructed ( const cdef_class cls)
inlineinherited

Definition at line 321 of file cdef-object.h.

◆ mark_as_constructed() [2/2]

void octave::cdef_object::mark_as_constructed ( void  )
inlineinherited

Definition at line 319 of file cdef-object.h.

Referenced by octave::cdef_class::cdef_class_rep::run_constructor().

◆ mark_as_handle_class()

void octave::cdef_class::mark_as_handle_class ( void  )
inline

Definition at line 369 of file cdef-class.h.

Referenced by octave::cdef_manager::make_class().

◆ mark_as_meta_class()

void octave::cdef_class::mark_as_meta_class ( void  )
inline

Definition at line 379 of file cdef-class.h.

Referenced by octave::cdef_manager::make_meta_class().

◆ mark_for_construction()

void octave::cdef_object::mark_for_construction ( const cdef_class cls)
inlineinherited

◆ meta_accepts_postfix_index()

bool octave::cdef_meta_object::meta_accepts_postfix_index ( char  type) const
inlineinherited

Definition at line 675 of file cdef-object.h.

◆ meta_release()

void octave::cdef_meta_object::meta_release ( void  )
inlineinherited

Definition at line 673 of file cdef-object.h.

◆ meta_subsref()

octave_value_list octave::cdef_meta_object::meta_subsref ( const std::string &  type,
const std::list< octave_value_list > &  idx,
int  nargout 
)
inlineinherited

Definition at line 667 of file cdef-object.h.

◆ ok()

◆ operator=()

cdef_class& octave::cdef_class::operator= ( const cdef_class cls)
inline

Definition at line 243 of file cdef-class.h.

References octave::cdef_object::operator=().

◆ put()

◆ run_constructor()

void octave::cdef_class::run_constructor ( cdef_object obj,
const octave_value_list args 
)
inline

◆ set_class()

◆ set_directory()

void octave::cdef_class::set_directory ( const std::string &  dir)
inline

Definition at line 294 of file cdef-class.h.

◆ set_property()

void octave::cdef_object::set_property ( octave_idx_type  idx,
const std::string &  pname,
const octave_value pval 
)
inlineinherited

Definition at line 266 of file cdef-object.h.

◆ subsasgn()

octave_value octave::cdef_object::subsasgn ( const std::string &  type,
const std::list< octave_value_list > &  idx,
const octave_value rhs,
int  ignore_copies = 0 
)
inlineinherited

◆ subsref()

octave_value_list octave::cdef_object::subsref ( const std::string &  type,
const std::list< octave_value_list > &  idx,
int  nargout,
size_t &  skip,
const cdef_class context,
bool  auto_add = false 
)
inlineinherited

Definition at line 279 of file cdef-object.h.

References octave::context.

Referenced by octave::cdef_object_scalar::subsref().

Friends And Related Function Documentation

◆ install_classdef

void install_classdef ( interpreter interp)
friend

◆ operator!=

bool operator!= ( const cdef_class clsa,
const cdef_class clsb 
)
friend

Definition at line 424 of file cdef-class.h.

◆ operator<

bool operator< ( const cdef_class clsa,
const cdef_class clsb 
)
friend

Definition at line 431 of file cdef-class.h.

◆ operator==

bool operator== ( const cdef_class clsa,
const cdef_class clsb 
)
friend

Definition at line 416 of file cdef-class.h.

Member Data Documentation

◆ rep

cdef_object_rep* octave::cdef_object::rep
privateinherited

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