Defines | 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.

Defines

#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)

Define 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); \
      } \
    else \
      error ("%s method not defined for %s class", \
             #name, dispatch_type.c_str ()); \
 \
    return retval; \
  }

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); \
      } \
    else \
      error ("%s method not defined for %s class", \
             #name, class_name.c_str ()); \
 \
    return retval; \
  }

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

#define INSTALL_CLASS_BINOP (   op,
  f 
)
Value:
octave_value_typeinfo::register_binary_class_op \
    (octave_value::op, oct_binop_ ## f)

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

Referenced by install_class_ops().

#define INSTALL_CLASS_UNOP (   op,
  f 
)
Value:
octave_value_typeinfo::register_unary_class_op \
    (octave_value::op, oct_unop_ ## f)

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

Referenced by install_class_ops().


Function Documentation

void install_class_ops ( void   ) 

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

References INSTALL_CLASS_BINOP, INSTALL_CLASS_UNOP, and transpose().

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines