op-b-b.cc

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1996-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026 
00027 #include "gripes.h"
00028 #include "oct-obj.h"
00029 #include "ov.h"
00030 #include "ov-bool.h"
00031 #include "ov-bool-mat.h"
00032 #include "ov-scalar.h"
00033 #include "ov-float.h"
00034 #include "ov-re-mat.h"
00035 #include "ov-typeinfo.h"
00036 #include "ops.h"
00037 #include "xdiv.h"
00038 #include "xpow.h"
00039 
00040 // bool unary ops.
00041 
00042 // scalar unary ops.
00043 
00044 DEFUNOP_OP (not, bool, !)
00045 
00046 UNOPDECL (uplus, a)
00047 {
00048   CAST_UNOP_ARG (const octave_bool&);
00049   return octave_value (v.double_value ());
00050 }
00051 
00052 UNOPDECL (uminus, a)
00053 {
00054   CAST_UNOP_ARG (const octave_bool&);
00055   return octave_value (- v.double_value ());
00056 }
00057 
00058 DEFUNOP_OP (transpose, bool, /* no-op */)
00059 DEFUNOP_OP (hermitian, bool, /* no-op */)
00060 
00061 // bool by bool ops.
00062 
00063 DEFBINOP_OP (eq, bool, bool, ==)
00064 DEFBINOP_OP (ne, bool, bool, !=)
00065 DEFBINOP_OP (el_and, bool, bool, &&)
00066 DEFBINOP_OP (el_or, bool, bool, ||)
00067 
00068 DEFNDCATOP_FN (b_b, bool, bool, bool_array, bool_array, concat)
00069 DEFNDCATOP_FN (b_s, bool, scalar, array, array, concat)
00070 DEFNDCATOP_FN (s_b, scalar, bool, array, array, concat)
00071 DEFNDCATOP_FN (b_f, bool, float_scalar, float_array, float_array, concat)
00072 DEFNDCATOP_FN (f_b, float_scalar, bool, float_array, float_array, concat)
00073 
00074 void
00075 install_b_b_ops (void)
00076 {
00077   INSTALL_UNOP (op_not, octave_bool, not);
00078   INSTALL_UNOP (op_uplus, octave_bool, uplus);
00079   INSTALL_UNOP (op_uminus, octave_bool, uminus);
00080   INSTALL_UNOP (op_transpose, octave_bool, transpose);
00081   INSTALL_UNOP (op_hermitian, octave_bool, hermitian);
00082 
00083   INSTALL_BINOP (op_eq, octave_bool, octave_bool, eq);
00084   INSTALL_BINOP (op_ne, octave_bool, octave_bool, ne);
00085   INSTALL_BINOP (op_el_and, octave_bool, octave_bool, el_and);
00086   INSTALL_BINOP (op_el_or, octave_bool, octave_bool, el_or);
00087 
00088   INSTALL_CATOP (octave_bool, octave_bool, b_b);
00089   INSTALL_CATOP (octave_bool, octave_scalar, b_s);
00090   INSTALL_CATOP (octave_scalar, octave_bool, s_b);
00091   INSTALL_CATOP (octave_bool, octave_float_scalar, b_f);
00092   INSTALL_CATOP (octave_float_scalar, octave_bool, f_b);
00093 
00094   INSTALL_ASSIGNCONV (octave_bool, octave_bool, octave_bool_matrix);
00095 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines