GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
op-class.cc File Reference
#include "oct-time.h"
#include "errwarn.h"
#include "interpreter-private.h"
#include "load-path.h"
#include "ovl.h"
#include "ov.h"
#include "ov-class.h"
#include "ov-typeinfo.h"
#include "ops.h"
#include "symtab.h"
#include "parse.h"
Include dependency graph for op-class.cc:

Go to the source code of this file.

Macros

#define DEF_CLASS_BINOP(name)
 
#define DEF_CLASS_UNOP(name)
 
#define INSTALL_CLASS_BINOP_TI(ti, op, f)   ti.install_binary_class_op (octave_value::op, oct_binop_ ## f)
 
#define INSTALL_CLASS_UNOP_TI(ti, op, f)   ti.install_unary_class_op (octave_value::op, oct_unop_ ## f)
 

Functions

void install_class_ops (octave::type_info &ti)
 
static octave_value oct_binop_and (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_eq (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_ge (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_gt (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_ldivide (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_le (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_lt (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_minus (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_mldivide (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_mpower (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_mrdivide (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_mtimes (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_ne (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_or (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_plus (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_power (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_rdivide (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_binop_times (const octave_value &a1, const octave_value &a2)
 
static octave_value oct_unop_ctranspose (const octave_value &a)
 
static octave_value oct_unop_not (const octave_value &a)
 
static octave_value oct_unop_transpose (const octave_value &a)
 
static octave_value oct_unop_uminus (const octave_value &a)
 
static octave_value oct_unop_uplus (const octave_value &a)
 

Macro Definition Documentation

◆ DEF_CLASS_BINOP

#define DEF_CLASS_BINOP (   name)
Value:
static octave_value \
oct_binop_ ## name (const octave_value& a1, const octave_value& a2) \
{ \
octave_value retval; \
\
std::string dispatch_type \
= (a1.isobject () ? a1.class_name () : a2.class_name ()); \
\
octave::symbol_table& symtab \
= octave::__get_symbol_table__ ("oct_unop_" #name); \
\
octave_value meth = symtab.find_method (#name, dispatch_type); \
if (meth.is_undefined ()) \
error ("%s method not defined for %s class", #name, \
dispatch_type.c_str ()); \
\
octave_value_list args; \
\
args(1) = a2; \
args(0) = a1; \
\
octave_value_list tmp = octave::feval (meth.function_value (), args, 1); \
if (tmp.length () > 0) \
retval = tmp(0); \
\
return retval; \
}
OCTINTERP_API octave_value_list feval(const std::string &name, const octave_value_list &args=octave_value_list(), int nargout=0)
void error(const char *fmt,...)
Definition: error.cc:578
const octave_base_value & a2
symbol_table & __get_symbol_table__(const std::string &who)
nd deftypefn *std::string name
Definition: sysdep.cc:647
if(nargin< 2) print_usage()
Definition: cellfun.cc:407
double tmp
Definition: data.cc:6252
octave_value retval
Definition: data.cc:6246
virtual std::string class_name(void) const
Definition: ov-base.h:876
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:888

Definition at line 79 of file op-class.cc.

◆ DEF_CLASS_UNOP

#define DEF_CLASS_UNOP (   name)
Value:
static octave_value \
oct_unop_ ## name (const octave_value& a) \
{ \
octave_value retval; \
\
std::string class_name = a.class_name (); \
\
octave::symbol_table& symtab \
= octave::__get_symbol_table__ ("oct_unop_" #name); \
\
octave_value meth = symtab.find_method (#name, class_name); \
if (meth.is_undefined ()) \
error ("%s method not defined for %s class", #name, \
class_name.c_str ()); \
\
octave_value_list args; \
\
args(0) = a; \
\
octave_value_list tmp = octave::feval (meth.function_value (), args, 1); \
if (tmp.length () > 0) \
retval = tmp(0); \
\
return retval; \
}
OCTINTERP_API octave_value_list feval(const std::string &name, const octave_value_list &args=octave_value_list(), int nargout=0)
void error(const char *fmt,...)
Definition: error.cc:578
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:400
symbol_table & __get_symbol_table__(const std::string &who)
nd deftypefn *std::string name
Definition: sysdep.cc:647
if(nargin< 2) print_usage()
Definition: cellfun.cc:407
double tmp
Definition: data.cc:6252
octave_value retval
Definition: data.cc:6246
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:888

Definition at line 42 of file op-class.cc.

◆ INSTALL_CLASS_BINOP_TI

#define INSTALL_CLASS_BINOP_TI (   ti,
  op,
  f 
)    ti.install_binary_class_op (octave_value::op, oct_binop_ ## f)

Definition at line 132 of file op-class.cc.

Referenced by install_class_ops().

◆ INSTALL_CLASS_UNOP_TI

#define INSTALL_CLASS_UNOP_TI (   ti,
  op,
  f 
)    ti.install_unary_class_op (octave_value::op, oct_unop_ ## f)

Definition at line 129 of file op-class.cc.

Referenced by install_class_ops().

Function Documentation

◆ install_class_ops()

◆ oct_binop_and()

static octave_value oct_binop_and ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 126 of file op-class.cc.

◆ oct_binop_eq()

static octave_value oct_binop_eq ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 118 of file op-class.cc.

◆ oct_binop_ge()

static octave_value oct_binop_ge ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 119 of file op-class.cc.

◆ oct_binop_gt()

static octave_value oct_binop_gt ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 120 of file op-class.cc.

◆ oct_binop_ldivide()

static octave_value oct_binop_ldivide ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 125 of file op-class.cc.

◆ oct_binop_le()

static octave_value oct_binop_le ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 117 of file op-class.cc.

◆ oct_binop_lt()

static octave_value oct_binop_lt ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 116 of file op-class.cc.

◆ oct_binop_minus()

static octave_value oct_binop_minus ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 111 of file op-class.cc.

◆ oct_binop_mldivide()

static octave_value oct_binop_mldivide ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 115 of file op-class.cc.

◆ oct_binop_mpower()

static octave_value oct_binop_mpower ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 114 of file op-class.cc.

◆ oct_binop_mrdivide()

static octave_value oct_binop_mrdivide ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 113 of file op-class.cc.

◆ oct_binop_mtimes()

static octave_value oct_binop_mtimes ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 112 of file op-class.cc.

◆ oct_binop_ne()

static octave_value oct_binop_ne ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 121 of file op-class.cc.

◆ oct_binop_or()

static octave_value oct_binop_or ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 127 of file op-class.cc.

◆ oct_binop_plus()

static octave_value oct_binop_plus ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 110 of file op-class.cc.

◆ oct_binop_power()

static octave_value oct_binop_power ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 124 of file op-class.cc.

◆ oct_binop_rdivide()

static octave_value oct_binop_rdivide ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 123 of file op-class.cc.

◆ oct_binop_times()

static octave_value oct_binop_times ( const octave_value a1,
const octave_value a2 
)
static

Definition at line 122 of file op-class.cc.

◆ oct_unop_ctranspose()

static octave_value oct_unop_ctranspose ( const octave_value a)
static

Definition at line 75 of file op-class.cc.

◆ oct_unop_not()

static octave_value oct_unop_not ( const octave_value a)
static

Definition at line 71 of file op-class.cc.

◆ oct_unop_transpose()

static octave_value oct_unop_transpose ( const octave_value a)
static

Definition at line 74 of file op-class.cc.

◆ oct_unop_uminus()

static octave_value oct_unop_uminus ( const octave_value a)
static

Definition at line 73 of file op-class.cc.

◆ oct_unop_uplus()

static octave_value oct_unop_uplus ( const octave_value a)
static

Definition at line 72 of file op-class.cc.