GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Macros | Functions
ov-classdef.cc File Reference
#include <algorithm>
#include "defun.h"
#include "load-path.h"
#include "ov-builtin.h"
#include "ov-classdef.h"
#include "ov-fcn-handle.h"
#include "ov-typeinfo.h"
#include "ov-usr-fcn.h"
#include "pt-assign.h"
#include "pt-classdef.h"
#include "pt-funcall.h"
#include "pt-misc.h"
#include "pt-stmt.h"
#include "pt-walk.h"
#include "singleton-cleanup.h"
#include "symtab.h"
#include "toplev.h"
#include "Array.cc"
Include dependency graph for ov-classdef.cc:

Go to the source code of this file.

Classes

class  ctor_analyzer
 
class  octave_classdef_meta
 
class  octave_classdef_superclass_ref
 

Macros

#define DEBUG_TRACE   0
 
#define META_CLASS_CMP(OP, CLSA, CLSB, FUN)
 

Functions

template<class T >
static std::string attribute_value_to_string (T *t, octave_value v)
 
static bool check_access (const cdef_class &cls, const octave_value &acc, const std::string &meth_name=std::string(), const std::string &prop_name=std::string(), bool is_prop_set=false)
 
static octave_value_list class_eq (const octave_value_list &args, int)
 
static octave_value_list class_fevalStatic (const octave_value_list &args, int nargout)
 
static octave_value_list class_fromName (const octave_value_list &args, int)
 
static octave_value_list class_ge (const octave_value_list &args, int)
 
static octave_value_list class_get_inferiorclasses (const octave_value_list &args, int)
 
static octave_value_list class_get_methods (const octave_value_list &args, int)
 
static octave_value_list class_get_properties (const octave_value_list &args, int)
 
static octave_value_list class_get_superclasses (const octave_value_list &args, int)
 
static octave_value_list class_getConstant (const octave_value_list &args, int)
 
static octave_value_list class_gt (const octave_value_list &args, int)
 
static octave_value_list class_le (const octave_value_list &args, int)
 
static octave_value_list class_lt (const octave_value_list &args, int)
 
static octave_value_list class_ne (const octave_value_list &args, int)
 
static octave_value compute_attribute_value (tree_classdef_attribute *t)
 
octave_value_list execute_ov (octave_value val, const octave_value_list &args, int nargout)
 
OCTAVE_EXPORT octave_value_list F__meta_class_query__ (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list F__meta_get_package__ (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list F__superclass_reference__ (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fmetaclass (const octave_value_list &args, int)
 
static std::string get_base_name (const std::string &nm)
 
static cdef_class get_class_context (std::string &name, bool &in_constructor)
 
cdef_class get_class_context (void)
 
static void gripe_method_access (const std::string &from, const cdef_method &meth)
 
static void gripe_property_access (const std::string &from, const cdef_property &prop, bool is_set=false)
 
static octave_value_list handle_delete (const octave_value_list &, int)
 
static bool in_class_method (const cdef_class &cls)
 
void install_classdef (void)
 
bool is_direct_superclass (const cdef_class &clsa, const cdef_class &clsb)
 
static bool is_dummy_method (const octave_value &fcn)
 
bool is_method_executing (const octave_value &ov, const cdef_object &obj)
 
bool is_strict_superclass (const cdef_class &clsa, const cdef_class &clsb)
 
static bool is_superclass (const cdef_class &clsa, const cdef_class &clsb, bool allow_equal=true, int max_depth=-1)
 
static cdef_class lookup_class (const std::string &name, bool error_if_not_found=true, bool load_if_not_found=true)
 
static cdef_class lookup_class (const cdef_class &cls)
 
static cdef_class lookup_class (const octave_value &ov)
 
static std::list< cdef_classlookup_classes (const Cell &cls_list)
 
static cdef_package lookup_package (const std::string &name)
 
cdef_property make_attribute (const cdef_class &cls, const std::string &name)
 
static cdef_class make_class (const std::string &name, const std::list< cdef_class > &super_list=std::list< cdef_class >())
 
static cdef_class make_class (const std::string &name, const cdef_class &super)
 
static octave_value make_fcn_handle (octave_builtin::fcn ff, const std::string &nm)
 
static octave_value make_fcn_handle (const octave_value &fcn, const std::string &nm)
 
static void make_function_of_class (const std::string &class_name, const octave_value &fcn)
 
static void make_function_of_class (const cdef_class &cls, const octave_value &fcn)
 
static cdef_class make_meta_class (const std::string &name, const cdef_class &super)
 
static cdef_method make_method (const cdef_class &cls, const std::string &name, const octave_value &fcn, const std::string &m_access="public", bool is_static=false)
 
cdef_method make_method (const cdef_class &cls, const std::string &name, octave_builtin::fcn ff, const std::string &m_access="public", bool is_static=false)
 
static cdef_package make_package (const std::string &nm, const std::string &parent=std::string())
 
static cdef_property make_property (const cdef_class &cls, const std::string &name, const octave_value &get_method=Matrix(), const std::string &get_access="public", const octave_value &set_method=Matrix(), const std::string &set_access="public")
 
template<class T1 , class T2 >
Cell map2Cell (const std::map< T1, T2 > &m)
 
static octave_value_list package_fromName (const octave_value_list &args, int)
 
static octave_value_list package_get_classes (const octave_value_list &args, int)
 
static octave_value_list package_get_functions (const octave_value_list &args, int)
 
static octave_value_list package_get_packages (const octave_value_list &args, int)
 
static octave_value_list package_getAllPackages (const octave_value_list &, int)
 
octave_value_list property_get_defaultvalue (const octave_value_list &args, int)
 
static octave_value to_ov (const std::list< cdef_class > &class_list)
 

Macro Definition Documentation

#define DEBUG_TRACE   0

Definition at line 49 of file ov-classdef.cc.

#define META_CLASS_CMP (   OP,
  CLSA,
  CLSB,
  FUN 
)
Value:
static octave_value_list \
class_ ## OP (const octave_value_list& args, int /* nargout */) \
{ \
octave_value_list retval; \
\
if (args.length () == 2 \
&& args(0).type_name () == "object" \
&& args(1).type_name () == "object" \
&& args(0).class_name () == "meta.class" \
&& args(1).class_name () == "meta.class") \
{ \
cdef_class clsa = to_cdef (args(0)); \
\
cdef_class clsb = to_cdef (args(1)); \
\
if (! error_state) \
retval(0) = FUN (CLSA, CLSB); \
error (#OP ": invalid objects, expected meta.class objects"); \
} \
error (#OP ": invalid arguments"); \
\
return retval; \
}
void error(const char *fmt,...)
Definition: error.cc:476
int error_state
Definition: error.cc:101
cdef_object to_cdef(const octave_value &val)
Definition: ov-classdef.h:1511

Definition at line 637 of file ov-classdef.cc.

Function Documentation

template<class T >
static std::string attribute_value_to_string ( T *  t,
octave_value  v 
)
static
static bool check_access ( const cdef_class cls,
const octave_value acc,
const std::string &  meth_name = std::string (),
const std::string &  prop_name = std::string (),
bool  is_prop_set = false 
)
static
static octave_value_list class_eq ( const octave_value_list args,
int   
)
static

Definition at line 668 of file ov-classdef.cc.

Referenced by install_classdef().

static octave_value_list class_fevalStatic ( const octave_value_list args,
int  nargout 
)
static
static octave_value_list class_fromName ( const octave_value_list args,
int   
)
static

Definition at line 535 of file ov-classdef.cc.

References error(), error_state, octave_value_list::length(), lookup_class(), and to_ov().

Referenced by install_classdef().

static octave_value_list class_ge ( const octave_value_list args,
int   
)
static

Definition at line 667 of file ov-classdef.cc.

Referenced by install_classdef().

static octave_value_list class_get_inferiorclasses ( const octave_value_list args,
int   
)
static
static octave_value_list class_get_methods ( const octave_value_list args,
int   
)
static

Definition at line 484 of file ov-classdef.cc.

References cdef_class::get_methods(), octave_value_list::length(), and to_cdef().

Referenced by install_classdef().

static octave_value_list class_get_properties ( const octave_value_list args,
int   
)
static

Definition at line 260 of file ov-classdef.cc.

References cdef_class::get_properties(), octave_value_list::length(), and to_cdef().

Referenced by install_classdef().

static octave_value_list class_get_superclasses ( const octave_value_list args,
int   
)
static
static octave_value_list class_getConstant ( const octave_value_list args,
int   
)
static
static octave_value_list class_gt ( const octave_value_list args,
int   
)
static

Definition at line 666 of file ov-classdef.cc.

Referenced by install_classdef().

static octave_value_list class_le ( const octave_value_list args,
int   
)
static

Definition at line 665 of file ov-classdef.cc.

Referenced by install_classdef().

static octave_value_list class_lt ( const octave_value_list args,
int   
)
static

Definition at line 664 of file ov-classdef.cc.

Referenced by install_classdef().

static octave_value_list class_ne ( const octave_value_list args,
int   
)
static

Definition at line 669 of file ov-classdef.cc.

Referenced by install_classdef().

static octave_value compute_attribute_value ( tree_classdef_attribute t)
static
octave_value_list execute_ov ( octave_value  val,
const octave_value_list args,
int  nargout 
)
inline
OCTAVE_EXPORT octave_value_list F__meta_class_query__ ( const octave_value_list args,
int   
)

Definition at line 4030 of file ov-classdef.cc.

References error(), error_state, lookup_class(), print_usage(), and to_ov().

OCTAVE_EXPORT octave_value_list F__meta_get_package__ ( const octave_value_list args,
int   
)

Definition at line 3998 of file ov-classdef.cc.

References error(), error_state, lookup_package(), print_usage(), and to_ov().

OCTAVE_EXPORT octave_value_list F__superclass_reference__ ( const octave_value_list args,
int   
)

Definition at line 4021 of file ov-classdef.cc.

References octave_value().

OCTAVE_EXPORT octave_value_list Fmetaclass ( const octave_value_list args,
int   
)

Definition at line 4059 of file ov-classdef.cc.

References error_state, cdef_object::get_class(), print_usage(), to_cdef(), and to_ov().

static std::string get_base_name ( const std::string &  nm)
static
static cdef_class get_class_context ( std::string &  name,
bool in_constructor 
)
static
cdef_class get_class_context ( void  )
inline

Definition at line 301 of file ov-classdef.cc.

References get_class_context().

static void gripe_method_access ( const std::string &  from,
const cdef_method meth 
)
static
static void gripe_property_access ( const std::string &  from,
const cdef_property prop,
bool  is_set = false 
)
static
static octave_value_list handle_delete ( const octave_value_list ,
int   
)
static

Definition at line 692 of file ov-classdef.cc.

Referenced by install_classdef().

static bool in_class_method ( const cdef_class cls)
static
void install_classdef ( void  )
bool is_direct_superclass ( const cdef_class clsa,
const cdef_class clsb 
)
inline

Definition at line 256 of file ov-classdef.cc.

References is_superclass().

Referenced by octave_classdef_superclass_ref::do_multi_index_op().

static bool is_dummy_method ( const octave_value fcn)
static
bool is_method_executing ( const octave_value ov,
const cdef_object obj 
)
bool is_strict_superclass ( const cdef_class clsa,
const cdef_class clsb 
)
inline

Definition at line 252 of file ov-classdef.cc.

References is_superclass().

Referenced by check_access(), and octave_classdef_superclass_ref::do_multi_index_op().

static bool is_superclass ( const cdef_class clsa,
const cdef_class clsb,
bool  allow_equal = true,
int  max_depth = -1 
)
static
static cdef_class lookup_class ( const std::string &  name,
bool  error_if_not_found = true,
bool  load_if_not_found = true 
)
static
static cdef_class lookup_class ( const cdef_class cls)
static

Definition at line 168 of file ov-classdef.cc.

static cdef_class lookup_class ( const octave_value ov)
static
static std::list<cdef_class> lookup_classes ( const Cell cls_list)
static
static cdef_package lookup_package ( const std::string &  name)
static

Definition at line 3439 of file ov-classdef.cc.

References cdef_manager::find_package().

Referenced by F__meta_get_package__(), and package_fromName().

cdef_property make_attribute ( const cdef_class cls,
const std::string &  name 
)
inline

Definition at line 817 of file ov-classdef.cc.

References make_property().

Referenced by install_classdef().

static cdef_class make_class ( const std::string &  name,
const std::list< cdef_class > &  super_list = std::list<cdef_class> () 
)
static
static cdef_class make_class ( const std::string &  name,
const cdef_class super 
)
static

Definition at line 763 of file ov-classdef.cc.

References make_class().

static octave_value make_fcn_handle ( octave_builtin::fcn  ff,
const std::string &  nm 
)
static
static octave_value make_fcn_handle ( const octave_value fcn,
const std::string &  nm 
)
static

Definition at line 139 of file ov-classdef.cc.

References octave_value::is_defined().

static void make_function_of_class ( const std::string &  class_name,
const octave_value fcn 
)
static
static void make_function_of_class ( const cdef_class cls,
const octave_value fcn 
)
static

Definition at line 123 of file ov-classdef.cc.

References cdef_class::get_name(), and make_function_of_class().

static cdef_class make_meta_class ( const std::string &  name,
const cdef_class super 
)
static
static cdef_method make_method ( const cdef_class cls,
const std::string &  name,
const octave_value fcn,
const std::string &  m_access = "public",
bool  is_static = false 
)
static
cdef_method make_method ( const cdef_class cls,
const std::string &  name,
octave_builtin::fcn  ff,
const std::string &  m_access = "public",
bool  is_static = false 
)
inline

Definition at line 851 of file ov-classdef.cc.

References make_method().

static cdef_package make_package ( const std::string &  nm,
const std::string &  parent = std::string () 
)
static
static cdef_property make_property ( const cdef_class cls,
const std::string &  name,
const octave_value get_method = Matrix (),
const std::string &  get_access = "public",
const octave_value set_method = Matrix (),
const std::string &  set_access = "public" 
)
static
template<class T1 , class T2 >
Cell map2Cell ( const std::map< T1, T2 > &  m)
static octave_value_list package_fromName ( const octave_value_list args,
int   
)
static

Definition at line 3445 of file ov-classdef.cc.

References error(), error_state, octave_value_list::length(), lookup_package(), and to_ov().

Referenced by install_classdef().

static octave_value_list package_get_classes ( const octave_value_list args,
int   
)
static

Definition at line 3465 of file ov-classdef.cc.

References cdef_package::get_classes(), octave_value_list::length(), and to_cdef().

Referenced by install_classdef().

static octave_value_list package_get_functions ( const octave_value_list args,
int   
)
static

Definition at line 3481 of file ov-classdef.cc.

References cdef_package::get_functions(), octave_value_list::length(), and to_cdef().

Referenced by install_classdef().

static octave_value_list package_get_packages ( const octave_value_list args,
int   
)
static

Definition at line 3497 of file ov-classdef.cc.

References cdef_package::get_packages(), octave_value_list::length(), and to_cdef().

Referenced by install_classdef().

static octave_value_list package_getAllPackages ( const octave_value_list ,
int   
)
static
octave_value_list property_get_defaultvalue ( const octave_value_list args,
int   
)

Definition at line 672 of file ov-classdef.cc.

References error_with_id(), cdef_object::get(), cdef_property::get_name(), and to_cdef().

Referenced by install_classdef().

static octave_value to_ov ( const std::list< cdef_class > &  class_list)
static