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
Macros | Functions
op-class.cc File Reference
#include "oct-time.h"
#include "gripes.h"
#include "load-path.h"
#include "oct-obj.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(op, f)
 
#define INSTALL_CLASS_UNOP(op, f)
 

Functions

void install_class_ops (void)
 
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

#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.is_object () ? a1.class_name () : a2.class_name (); \
\
octave_value meth = symbol_table::find_method (#name, dispatch_type); \
\
if (meth.is_defined ()) \
{ \
octave_value_list args; \
\
args(1) = a2; \
args(0) = a1; \
\
octave_value_list tmp = feval (meth.function_value (), args, 1); \
\
if (tmp.length () > 0) \
retval = tmp(0); \
} \
error ("%s method not defined for %s class", \
#name, dispatch_type.c_str ()); \
\
return retval; \
}
static octave_value find_method(const std::string &name, const std::string &dispatch_type)
Definition: symtab.h:1501
void error(const char *fmt,...)
Definition: error.cc:476
octave_value_list feval(const std::string &name, const octave_value_list &args, int nargout)
Definition: oct-parse.cc:8625
const octave_base_value & a2
virtual std::string class_name(void) const
Definition: ov-base.h:830
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))

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

#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_value meth = symbol_table::find_method (#name, class_name); \
\
if (meth.is_defined ()) \
{ \
octave_value_list args; \
\
args(0) = a; \
\
octave_value_list tmp = feval (meth.function_value (), args, 1); \
\
if (tmp.length () > 0) \
retval = tmp(0); \
} \
error ("%s method not defined for %s class", \
#name, class_name.c_str ()); \
\
return retval; \
}
static octave_value find_method(const std::string &name, const std::string &dispatch_type)
Definition: symtab.h:1501
void error(const char *fmt,...)
Definition: error.cc:476
octave_value_list feval(const std::string &name, const octave_value_list &args, int nargout)
Definition: oct-parse.cc:8625
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))

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

#define INSTALL_CLASS_BINOP (   op,
  f 
)
Value:
(octave_value::op, oct_binop_ ## f)
F77_RET_T const double const double * f
static bool register_binary_class_op(octave_value::binary_op, binary_class_op_fcn)
Definition: ov-typeinfo.cc:99

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

Referenced by install_class_ops().

#define INSTALL_CLASS_UNOP (   op,
  f 
)
Value:
(octave_value::op, oct_unop_ ## f)
static bool register_unary_class_op(octave_value::unary_op, unary_class_op_fcn)
Definition: ov-typeinfo.cc:73
F77_RET_T const double const double * f

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

Referenced by install_class_ops().

Function Documentation

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static octave_value oct_unop_ctranspose ( const octave_value a)
static

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

static octave_value oct_unop_not ( const octave_value a)
static

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

static octave_value oct_unop_transpose ( const octave_value a)
static

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

static octave_value oct_unop_uminus ( const octave_value a)
static

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

static octave_value oct_unop_uplus ( const octave_value a)
static

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