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

#include "cdef-class.h"

Inheritance diagram for cdef_class:
cdef_meta_object cdef_object

Public Types

enum  { property_normal , property_inherited , property_all }
 

Public Member Functions

 cdef_class ()
 
 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 ()=default
 
octave_value construct (const octave_value_list &args)
 
cdef_object construct_object (const octave_value_list &args)
 
void delete_object (const cdef_object &obj)
 
std::string file_name () const
 
void file_name (const std::string &nm)
 
cdef_method find_method (const std::string &nm, bool local=false)
 
cdef_property find_property (const std::string &nm)
 
octave_value get_constructor_function ()
 
std::string get_directory () const
 
octave_value get_method (const std::string &nm) const
 
octave_value get_method (int ln) 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 () const
 
string_vector get_names ()
 
Cell get_properties (int mode=property_normal)
 
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_abstract () const
 
bool is_builtin () const
 
bool is_handle_class () const
 
bool is_meta_class () const
 
bool is_sealed () const
 
void mark_as_handle_class ()
 
void mark_as_meta_class ()
 
cdef_classoperator= (const cdef_class &cls)
 
void run_constructor (cdef_object &obj, const octave_value_list &args)
 
void set_directory (const std::string &dir)
 
- Public Member Functions inherited from cdef_meta_object
 cdef_meta_object ()
 
 cdef_meta_object (cdef_meta_object_rep *r)
 
 cdef_meta_object (const cdef_meta_object &obj)
 
 cdef_meta_object (const cdef_object &obj)
 
 ~cdef_meta_object ()=default
 
std::string doc_string () const
 
void doc_string (const std::string &txt)
 
bool is_class () const
 
bool is_method () const
 
bool is_package () const
 
bool is_property () const
 
bool meta_accepts_postfix_index (char type) const
 
void meta_release ()
 
octave_value_list meta_subsref (const std::string &type, const std::list< octave_value_list > &idx, int nargout)
 
cdef_meta_objectoperator= (const cdef_object &)=delete
 
- Public Member Functions inherited from cdef_object
 cdef_object ()
 
 cdef_object (cdef_object_rep *r)
 
 cdef_object (const cdef_object &obj)
 
virtual ~cdef_object ()
 
Array< cdef_objectarray_value () const
 
void break_closure_cycles (const std::shared_ptr< stack_frame > &frame)
 
std::string class_name () const
 
cdef_object clone () const
 
cdef_object copy () const
 
dim_vector dims () const
 
cdef_object empty_clone () const
 
octave_value get (const std::string &pname) const
 
cdef_class get_class () const
 
octave_value get_property (octave_idx_type idx, const std::string &pname) const
 
const cdef_object_repget_rep () const
 
bool is (const cdef_object &obj) const
 
bool is_array () const
 
bool is_constructed () const
 
bool is_constructed_for (const cdef_class &cls) const
 
bool is_handle_object () const
 
bool is_meta_object () const
 
bool is_partially_constructed_for (const cdef_class &cls) const
 
bool is_value_object () const
 
cdef_object make_array () const
 
string_vector map_keys () const
 
octave_map map_value () const
 
void mark_as_constructed ()
 
void mark_as_constructed (const cdef_class &cls)
 
void mark_for_construction (const cdef_class &cls)
 
bool ok () const
 
cdef_objectoperator= (const cdef_object &obj)
 
void put (const std::string &pname, const octave_value &val)
 
void set_class (const cdef_class &cls)
 
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, std::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...
 

Friends

void install_classdef (octave::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 &)
 

Additional Inherited Members

- Protected Member Functions inherited from cdef_object
cdef_object_repget_rep ()
 
void make_unique (int ignore_copies)
 

Detailed Description

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

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
property_normal 
property_inherited 
property_all 

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

Constructor & Destructor Documentation

◆ cdef_class() [1/4]

cdef_class::cdef_class ( )
inline

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

◆ cdef_class() [2/4]

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

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

◆ cdef_class() [3/4]

cdef_class::cdef_class ( const cdef_class cls)
inline

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

◆ cdef_class() [4/4]

cdef_class::cdef_class ( const cdef_object obj)
inline

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

References error().

◆ ~cdef_class()

cdef_class::~cdef_class ( )
default

Member Function Documentation

◆ construct()

octave_value cdef_class::construct ( const octave_value_list args)
inline

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

◆ construct_object()

cdef_object cdef_class::construct_object ( const octave_value_list args)
inline

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

Referenced by cdef_object_array::subsasgn().

◆ delete_object()

void cdef_class::delete_object ( const cdef_object obj)
inline

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

Referenced by cdef_object_rep::release().

◆ file_name() [1/2]

std::string cdef_class::file_name ( ) const
inline

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

◆ file_name() [2/2]

void cdef_class::file_name ( const std::string &  nm)
inline

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

Referenced by make_meta_class().

◆ find_method()

cdef_method cdef_class::find_method ( const std::string &  nm,
bool  local = false 
)
inline

◆ find_property()

cdef_property cdef_class::find_property ( const std::string &  nm)
inline

◆ get_constructor_function()

octave_value cdef_class::get_constructor_function ( )
inline

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

Referenced by tree_classdef::make_meta_class().

◆ get_directory()

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

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

◆ get_method() [1/2]

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

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

Referenced by cdef_manager::find_method().

◆ get_method() [2/2]

octave_value cdef_class::get_method ( int  ln) const
inline

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

◆ get_method_function()

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

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

References octave_value().

◆ get_method_map()

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

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

Referenced by F__methods__().

◆ get_methods()

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

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

◆ get_name()

◆ get_names()

string_vector cdef_class::get_names ( )
inline

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

Referenced by cdef_object_rep::map_keys().

◆ get_properties()

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

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

◆ get_property_map()

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

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

Referenced by Fproperties(), and cdef_object::map_value().

◆ initialize_object()

void cdef_class::initialize_object ( cdef_object obj)
inline

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

◆ install_method()

void cdef_class::install_method ( const cdef_method meth)
inline

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

◆ install_property()

void cdef_class::install_property ( const cdef_property prop)
inline

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

Referenced by cdef_manager::cdef_manager().

◆ is_abstract()

bool cdef_class::is_abstract ( ) const
inline

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

◆ is_builtin()

bool cdef_class::is_builtin ( ) const
inline

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

Referenced by cdef_manager::find_class().

◆ is_handle_class()

bool cdef_class::is_handle_class ( ) const
inline

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

◆ is_meta_class()

bool cdef_class::is_meta_class ( ) const
inline

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

◆ is_sealed()

bool cdef_class::is_sealed ( ) const
inline

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

◆ make_meta_class()

cdef_class 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 872 of file cdef-class.cc.

References __get_cdef_manager__(), tree_classdef::attribute_list(), octave_value::bool_value(), cdef_object::class_name(), tree_classdef::doc_string(), cdef_meta_object::doc_string(), error(), tree_classdef::file_name(), file_name(), cdef_manager::find_package(), cdef_object::get(), interpreter::get_evaluator(), tree_classdef::ident(), lookup_class(), cdef_manager::make_class(), tree_identifier::name(), cdef_object::ok(), tree_classdef::package_name(), tree_evaluator::pop_scope(), tree_evaluator::push_dummy_scope(), cdef_object::put(), tree_classdef::superclass_list(), and to_ov().

Referenced by tree_classdef::make_meta_class().

◆ mark_as_handle_class()

void cdef_class::mark_as_handle_class ( )
inline

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

Referenced by cdef_manager::make_class().

◆ mark_as_meta_class()

void cdef_class::mark_as_meta_class ( )
inline

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

Referenced by cdef_manager::make_meta_class().

◆ operator=()

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

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

References cdef_object::operator=().

◆ run_constructor()

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

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

◆ set_directory()

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

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

Friends And Related Function Documentation

◆ install_classdef

void install_classdef ( octave::interpreter &  interp)
friend

◆ operator!=

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

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

◆ operator<

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

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

◆ operator==

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

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


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