ov.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1996-2012 John W. Eaton
00004 Copyright (C) 2009-2010 VZLU Prague
00005 
00006 This file is part of Octave.
00007 
00008 Octave is free software; you can redistribute it and/or modify it
00009 under the terms of the GNU General Public License as published by the
00010 Free Software Foundation; either version 3 of the License, or (at your
00011 option) any later version.
00012 
00013 Octave is distributed in the hope that it will be useful, but WITHOUT
00014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00015 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00016 for more details.
00017 
00018 You should have received a copy of the GNU General Public License
00019 along with Octave; see the file COPYING.  If not, see
00020 <http://www.gnu.org/licenses/>.
00021 
00022 */
00023 
00024 #if !defined (octave_value_h)
00025 #define octave_value_h 1
00026 
00027 #include <cstdlib>
00028 
00029 #include <iosfwd>
00030 #include <string>
00031 #include <list>
00032 
00033 #include "Range.h"
00034 #include "data-conv.h"
00035 #include "idx-vector.h"
00036 #include "mach-info.h"
00037 #include "mxarray.h"
00038 #include "mx-base.h"
00039 #include "oct-alloc.h"
00040 #include "oct-time.h"
00041 #include "str-vec.h"
00042 
00043 #include "oct-hdf5.h"
00044 #include "oct-sort.h"
00045 
00046 class Cell;
00047 class octave_map;
00048 class octave_scalar_map;
00049 class Octave_map;
00050 class octave_stream;
00051 class octave_function;
00052 class octave_user_function;
00053 class octave_fcn_handle;
00054 class octave_fcn_inline;
00055 class octave_value_list;
00056 class octave_lvalue;
00057 
00058 #include "ov-base.h"
00059 
00060 // Constants.
00061 
00062 class octave_value;
00063 
00064 class
00065 OCTINTERP_API
00066 octave_value
00067 {
00068 public:
00069 
00070   enum unary_op
00071   {
00072     op_not,            // not
00073     op_uplus,          // uplus
00074     op_uminus,         // uminus
00075     op_transpose,      // transpose
00076     op_hermitian,      // ctranspose
00077     op_incr,
00078     op_decr,
00079     num_unary_ops,
00080     unknown_unary_op
00081   };
00082 
00083   enum binary_op
00084   {
00085     op_add,            // plus
00086     op_sub,            // minus
00087     op_mul,            // mtimes
00088     op_div,            // mrdivide
00089     op_pow,            // mpower
00090     op_ldiv,           // mldivide
00091     op_lshift,
00092     op_rshift,
00093     op_lt,             // lt
00094     op_le,             // le
00095     op_eq,             // eq
00096     op_ge,             // ge
00097     op_gt,             // gt
00098     op_ne,             // ne
00099     op_el_mul,         // times
00100     op_el_div,         // rdivide
00101     op_el_pow,         // power
00102     op_el_ldiv,        // ldivide
00103     op_el_and,         // and
00104     op_el_or,          // or
00105     op_struct_ref,
00106     num_binary_ops,
00107     unknown_binary_op
00108   };
00109 
00110   enum compound_binary_op
00111   {
00112     // ** compound operations **
00113     op_trans_mul,
00114     op_mul_trans,
00115     op_herm_mul,
00116     op_mul_herm,
00117     op_trans_ldiv,
00118     op_herm_ldiv,
00119     op_el_not_and,
00120     op_el_not_or,
00121     op_el_and_not,
00122     op_el_or_not,
00123     num_compound_binary_ops,
00124     unknown_compound_binary_op
00125   };
00126 
00127   enum assign_op
00128   {
00129     op_asn_eq,
00130     op_add_eq,
00131     op_sub_eq,
00132     op_mul_eq,
00133     op_div_eq,
00134     op_ldiv_eq,
00135     op_pow_eq,
00136     op_lshift_eq,
00137     op_rshift_eq,
00138     op_el_mul_eq,
00139     op_el_div_eq,
00140     op_el_ldiv_eq,
00141     op_el_pow_eq,
00142     op_el_and_eq,
00143     op_el_or_eq,
00144     num_assign_ops,
00145     unknown_assign_op
00146   };
00147 
00148   static assign_op binary_op_to_assign_op (binary_op);
00149 
00150   static std::string unary_op_as_string (unary_op);
00151   static std::string unary_op_fcn_name (unary_op);
00152 
00153   static std::string binary_op_as_string (binary_op);
00154   static std::string binary_op_fcn_name (binary_op);
00155 
00156   static std::string binary_op_fcn_name (compound_binary_op);
00157 
00158   static std::string assign_op_as_string (assign_op);
00159 
00160   static octave_value empty_conv (const std::string& type,
00161                                   const octave_value& rhs = octave_value ());
00162 
00163   enum magic_colon { magic_colon_t };
00164 
00165   octave_value (void)
00166     {
00167       static octave_base_value nil_rep;
00168       rep = &nil_rep;
00169       rep->count++;
00170     }
00171 
00172   octave_value (short int i);
00173   octave_value (unsigned short int i);
00174   octave_value (int i);
00175   octave_value (unsigned int i);
00176   octave_value (long int i);
00177   octave_value (unsigned long int i);
00178 
00179   // FIXME -- these are kluges.  They turn into doubles
00180   // internally, which will break for very large values.  We just use
00181   // them to store things like 64-bit ino_t, etc, and hope that those
00182   // values are never actually larger than can be represented exactly
00183   // in a double.
00184 
00185 #if defined (HAVE_LONG_LONG_INT)
00186   octave_value (long long int i);
00187 #endif
00188 #if defined (HAVE_UNSIGNED_LONG_LONG_INT)
00189   octave_value (unsigned long long int i);
00190 #endif
00191 
00192   octave_value (octave_time t);
00193   octave_value (double d);
00194   octave_value (float d);
00195   octave_value (const Array<octave_value>& a, bool is_cs_list = false);
00196   octave_value (const Cell& c, bool is_cs_list = false);
00197   octave_value (const Matrix& m, const MatrixType& t = MatrixType());
00198   octave_value (const FloatMatrix& m, const MatrixType& t = MatrixType());
00199   octave_value (const NDArray& nda);
00200   octave_value (const FloatNDArray& nda);
00201   octave_value (const Array<double>& m);
00202   octave_value (const Array<float>& m);
00203   octave_value (const DiagMatrix& d);
00204   octave_value (const DiagArray2<double>& d);
00205   octave_value (const DiagArray2<float>& d);
00206   octave_value (const DiagArray2<Complex>& d);
00207   octave_value (const DiagArray2<FloatComplex>& d);
00208   octave_value (const FloatDiagMatrix& d);
00209   octave_value (const RowVector& v);
00210   octave_value (const FloatRowVector& v);
00211   octave_value (const ColumnVector& v);
00212   octave_value (const FloatColumnVector& v);
00213   octave_value (const Complex& C);
00214   octave_value (const FloatComplex& C);
00215   octave_value (const ComplexMatrix& m, const MatrixType& t = MatrixType());
00216   octave_value (const FloatComplexMatrix& m, const MatrixType& t = MatrixType());
00217   octave_value (const ComplexNDArray& cnda);
00218   octave_value (const FloatComplexNDArray& cnda);
00219   octave_value (const Array<Complex>& m);
00220   octave_value (const Array<FloatComplex>& m);
00221   octave_value (const ComplexDiagMatrix& d);
00222   octave_value (const FloatComplexDiagMatrix& d);
00223   octave_value (const ComplexRowVector& v);
00224   octave_value (const FloatComplexRowVector& v);
00225   octave_value (const ComplexColumnVector& v);
00226   octave_value (const FloatComplexColumnVector& v);
00227   octave_value (const PermMatrix& p);
00228   octave_value (bool b);
00229   octave_value (const boolMatrix& bm, const MatrixType& t = MatrixType());
00230   octave_value (const boolNDArray& bnda);
00231   octave_value (const Array<bool>& bnda);
00232   octave_value (char c, char type = '\'');
00233   octave_value (const char *s, char type = '\'');
00234   octave_value (const std::string& s, char type = '\'');
00235   octave_value (const string_vector& s, char type = '\'');
00236   octave_value (const charMatrix& chm,  char type = '\'');
00237   octave_value (const charNDArray& chnda, char type = '\'');
00238   octave_value (const Array<char>& chnda, char type = '\'');
00239   octave_value (const charMatrix& chm, bool is_string,
00240                 char type = '\'') GCC_ATTR_DEPRECATED;
00241   octave_value (const charNDArray& chnda, bool is_string,
00242                 char type = '\'') GCC_ATTR_DEPRECATED;
00243   octave_value (const Array<char>& chnda, bool is_string,
00244                 char type = '\'') GCC_ATTR_DEPRECATED;
00245   octave_value (const SparseMatrix& m, const MatrixType& t = MatrixType ());
00246   octave_value (const Sparse<double>& m, const MatrixType& t = MatrixType ());
00247   octave_value (const SparseComplexMatrix& m,
00248                 const MatrixType& t = MatrixType ());
00249   octave_value (const Sparse<Complex>& m, const MatrixType& t = MatrixType ());
00250   octave_value (const SparseBoolMatrix& bm,
00251                 const MatrixType& t = MatrixType ());
00252   octave_value (const Sparse<bool>& m, const MatrixType& t = MatrixType ());
00253   octave_value (const octave_int8& i);
00254   octave_value (const octave_int16& i);
00255   octave_value (const octave_int32& i);
00256   octave_value (const octave_int64& i);
00257   octave_value (const octave_uint8& i);
00258   octave_value (const octave_uint16& i);
00259   octave_value (const octave_uint32& i);
00260   octave_value (const octave_uint64& i);
00261   octave_value (const int8NDArray& inda);
00262   octave_value (const Array<octave_int8>& inda);
00263   octave_value (const int16NDArray& inda);
00264   octave_value (const Array<octave_int16>& inda);
00265   octave_value (const int32NDArray& inda);
00266   octave_value (const Array<octave_int32>& inda);
00267   octave_value (const int64NDArray& inda);
00268   octave_value (const Array<octave_int64>& inda);
00269   octave_value (const uint8NDArray& inda);
00270   octave_value (const Array<octave_uint8>& inda);
00271   octave_value (const uint16NDArray& inda);
00272   octave_value (const Array<octave_uint16>& inda);
00273   octave_value (const uint32NDArray& inda);
00274   octave_value (const Array<octave_uint32>& inda);
00275   octave_value (const uint64NDArray& inda);
00276   octave_value (const Array<octave_uint64>& inda);
00277   octave_value (const Array<octave_idx_type>& inda,
00278                 bool zero_based = false, bool cache_index = false);
00279   octave_value (const Array<std::string>& cellstr);
00280   octave_value (const idx_vector& idx, bool lazy = true);
00281   octave_value (double base, double limit, double inc);
00282   octave_value (const Range& r);
00283   octave_value (const octave_map& m);
00284   octave_value (const octave_scalar_map& m);
00285   octave_value (const Octave_map& m);
00286   octave_value (const Octave_map& m, const std::string& id,
00287                 const std::list<std::string>& plist);
00288   octave_value (const octave_value_list& m, bool = false);
00289   octave_value (octave_value::magic_colon);
00290 
00291   octave_value (octave_base_value *new_rep, bool borrow = false);
00292   octave_value (octave_base_value *new_rep, int xcount) GCC_ATTR_DEPRECATED;
00293 
00294   // Copy constructor.
00295 
00296   octave_value (const octave_value& a)
00297     {
00298       rep = a.rep;
00299       rep->count++;
00300     }
00301 
00302   // This should only be called for derived types.
00303 
00304   octave_base_value *clone (void) const;
00305 
00306   octave_base_value *empty_clone (void) const
00307     { return rep->empty_clone (); }
00308 
00309   // Delete the representation of this constant if the count drops to
00310   // zero.
00311 
00312   ~octave_value (void)
00313   {
00314     if (--rep->count == 0)
00315       delete rep;
00316   }
00317 
00318   void make_unique (void)
00319     {
00320       if (rep->count > 1)
00321         {
00322     octave_base_value *r = rep->unique_clone ();
00323 
00324           if (--rep->count == 0)
00325             delete rep;
00326 
00327           rep = r;
00328         }
00329     }
00330 
00331   // This uniquifies the value if it is referenced by more than a certain
00332   // number of shallow copies. This is useful for optimizations where we
00333   // know a certain copy, typically within a cell array, to be obsolete.
00334   void make_unique (int obsolete_copies)
00335     {
00336       if (rep->count > obsolete_copies + 1)
00337         {
00338           octave_base_value *r = rep->unique_clone ();
00339 
00340           if (--rep->count == 0)
00341             delete rep;
00342 
00343           rep = r;
00344         }
00345     }
00346 
00347   // Simple assignment.
00348 
00349   octave_value& operator = (const octave_value& a)
00350     {
00351       if (rep != a.rep)
00352         {
00353           if (--rep->count == 0)
00354             delete rep;
00355 
00356           rep = a.rep;
00357           rep->count++;
00358         }
00359 
00360       return *this;
00361     }
00362 
00363   octave_idx_type get_count (void) const { return rep->count; }
00364 
00365   octave_base_value::type_conv_info numeric_conversion_function (void) const
00366     { return rep->numeric_conversion_function (); }
00367 
00368   octave_base_value::type_conv_info numeric_demotion_function (void) const
00369     { return rep->numeric_demotion_function (); }
00370 
00371   void maybe_mutate (void);
00372 
00373   octave_value squeeze (void) const
00374     { return rep->squeeze (); }
00375 
00376   // The result of full().
00377   octave_value full_value (void) const
00378     { return rep->full_value (); }
00379 
00380   octave_base_value *try_narrowing_conversion (void)
00381     { return rep->try_narrowing_conversion (); }
00382 
00383   // Close to dims (), but can be overloaded for classes.
00384   Matrix size (void)
00385     { return rep->size (); }
00386 
00387   octave_idx_type numel (const octave_value_list& idx)
00388     { return rep->numel (idx); }
00389 
00390   octave_value single_subsref (const std::string& type,
00391                                const octave_value_list& idx);
00392 
00393   octave_value subsref (const std::string& type,
00394                         const std::list<octave_value_list>& idx)
00395     { return rep->subsref (type, idx); }
00396 
00397   octave_value subsref (const std::string& type,
00398                         const std::list<octave_value_list>& idx,
00399                         bool auto_add)
00400     { return rep->subsref (type, idx, auto_add); }
00401 
00402   octave_value_list subsref (const std::string& type,
00403                              const std::list<octave_value_list>& idx,
00404                              int nargout);
00405 
00406   octave_value_list subsref (const std::string& type,
00407                              const std::list<octave_value_list>& idx,
00408                              int nargout,
00409                              const std::list<octave_lvalue> *lvalue_list);
00410 
00411   octave_value next_subsref (const std::string& type, const
00412                              std::list<octave_value_list>& idx,
00413                              size_t skip = 1);
00414 
00415   octave_value_list next_subsref (int nargout,
00416                                   const std::string& type, const
00417                                   std::list<octave_value_list>& idx,
00418                                   size_t skip = 1);
00419 
00420   octave_value next_subsref (bool auto_add, const std::string& type, const
00421                              std::list<octave_value_list>& idx,
00422                              size_t skip = 1);
00423 
00424   octave_value do_index_op (const octave_value_list& idx,
00425                             bool resize_ok = false)
00426     { return rep->do_index_op (idx, resize_ok); }
00427 
00428   octave_value_list
00429   do_multi_index_op (int nargout, const octave_value_list& idx);
00430 
00431   octave_value_list
00432   do_multi_index_op (int nargout, const octave_value_list& idx,
00433                      const std::list<octave_lvalue> *lvalue_list);
00434 
00435   octave_value subsasgn (const std::string& type,
00436                                  const std::list<octave_value_list>& idx,
00437                                  const octave_value& rhs);
00438 
00439   octave_value undef_subsasgn (const std::string& type,
00440                                const std::list<octave_value_list>& idx,
00441                                const octave_value& rhs);
00442 
00443   octave_value& assign (assign_op op, const std::string& type,
00444                        const std::list<octave_value_list>& idx,
00445                        const octave_value& rhs);
00446 
00447   octave_value& assign (assign_op, const octave_value& rhs);
00448 
00449   idx_vector index_vector (void) const
00450     { return rep->index_vector (); }
00451 
00452   // Size.
00453 
00454   dim_vector dims (void) const
00455     { return rep->dims (); }
00456 
00457   octave_idx_type rows (void) const { return rep->rows (); }
00458 
00459   octave_idx_type columns (void) const { return rep->columns (); }
00460 
00461   octave_idx_type length (void) const;
00462 
00463   int ndims (void) const { return rep->ndims (); }
00464 
00465   bool all_zero_dims (void) const { return dims().all_zero (); }
00466 
00467   octave_idx_type numel (void) const
00468     { return rep->numel (); }
00469 
00470   octave_idx_type capacity (void) const
00471     { return rep->capacity (); }
00472 
00473   size_t byte_size (void) const
00474     { return rep->byte_size (); }
00475 
00476   octave_idx_type nnz (void) const { return rep->nnz (); }
00477 
00478   octave_idx_type nzmax (void) const { return rep->nzmax (); }
00479 
00480   octave_idx_type nfields (void) const { return rep->nfields (); }
00481 
00482   octave_value reshape (const dim_vector& dv) const
00483     { return rep->reshape (dv); }
00484 
00485   octave_value permute (const Array<int>& vec, bool inv = false) const
00486     { return rep->permute (vec, inv); }
00487 
00488   octave_value ipermute (const Array<int>& vec) const
00489     { return rep->permute (vec, true); }
00490 
00491   octave_value resize (const dim_vector& dv, bool fill = false) const
00492     { return rep->resize (dv, fill);}
00493 
00494   MatrixType matrix_type (void) const
00495   { return rep->matrix_type (); }
00496 
00497   MatrixType matrix_type (const MatrixType& typ) const
00498   { return rep->matrix_type (typ); }
00499 
00500   // Does this constant have a type?  Both of these are provided since
00501   // it is sometimes more natural to write is_undefined() instead of
00502   // ! is_defined().
00503 
00504   bool is_defined (void) const
00505     { return rep->is_defined (); }
00506 
00507   bool is_undefined (void) const
00508     { return ! is_defined (); }
00509 
00510   bool is_empty (void) const
00511     { return rep->is_empty (); }
00512 
00513   bool is_cell (void) const
00514     { return rep->is_cell (); }
00515 
00516   bool is_cellstr (void) const
00517     { return rep->is_cellstr (); }
00518 
00519   bool is_real_scalar (void) const
00520     { return rep->is_real_scalar (); }
00521 
00522   bool is_real_matrix (void) const
00523     { return rep->is_real_matrix (); }
00524 
00525   bool is_real_nd_array (void) const
00526     { return rep->is_real_nd_array (); }
00527 
00528   bool is_complex_scalar (void) const
00529     { return rep->is_complex_scalar (); }
00530 
00531   bool is_complex_matrix (void) const
00532     { return rep->is_complex_matrix (); }
00533 
00534   bool is_bool_scalar (void) const
00535     { return rep->is_bool_scalar (); }
00536 
00537   bool is_bool_matrix (void) const
00538     { return rep->is_bool_matrix (); }
00539 
00540   bool is_char_matrix (void) const
00541     { return rep->is_char_matrix (); }
00542 
00543   bool is_diag_matrix (void) const
00544     { return rep->is_diag_matrix (); }
00545 
00546   bool is_perm_matrix (void) const
00547     { return rep->is_perm_matrix (); }
00548 
00549   bool is_string (void) const
00550     { return rep->is_string (); }
00551 
00552   bool is_sq_string (void) const
00553     { return rep->is_sq_string (); }
00554 
00555   bool is_dq_string (void) const
00556     { return rep->is_string () && ! rep->is_sq_string (); }
00557 
00558   bool is_range (void) const
00559     { return rep->is_range (); }
00560 
00561   bool is_map (void) const
00562     { return rep->is_map (); }
00563 
00564   bool is_object (void) const
00565     { return rep->is_object (); }
00566 
00567   bool is_cs_list (void) const
00568     { return rep->is_cs_list (); }
00569 
00570   bool is_magic_colon (void) const
00571     { return rep->is_magic_colon (); }
00572 
00573   bool is_null_value (void) const
00574     { return rep->is_null_value (); }
00575 
00576   // Are any or all of the elements in this constant nonzero?
00577 
00578   octave_value all (int dim = 0) const
00579     { return rep->all (dim); }
00580 
00581   octave_value any (int dim = 0) const
00582     { return rep->any (dim); }
00583 
00584   builtin_type_t builtin_type (void) const
00585     { return rep->builtin_type (); }
00586 
00587   // Floating point types.
00588 
00589   bool is_double_type (void) const
00590     { return rep->is_double_type (); }
00591 
00592   bool is_single_type (void) const
00593     { return rep->is_single_type (); }
00594 
00595   bool is_float_type (void) const
00596     { return rep->is_float_type (); }
00597 
00598   // Integer types.
00599 
00600   bool is_int8_type (void) const
00601     { return rep->is_int8_type (); }
00602 
00603   bool is_int16_type (void) const
00604     { return rep->is_int16_type (); }
00605 
00606   bool is_int32_type (void) const
00607     { return rep->is_int32_type (); }
00608 
00609   bool is_int64_type (void) const
00610    { return rep->is_int64_type (); }
00611 
00612   bool is_uint8_type (void) const
00613     { return rep->is_uint8_type (); }
00614 
00615   bool is_uint16_type (void) const
00616     { return rep->is_uint16_type (); }
00617 
00618   bool is_uint32_type (void) const
00619     { return rep->is_uint32_type (); }
00620 
00621   bool is_uint64_type (void) const
00622     { return rep->is_uint64_type (); }
00623 
00624   // Other type stuff.
00625 
00626   bool is_bool_type (void) const
00627     { return rep->is_bool_type (); }
00628 
00629   bool is_integer_type (void) const
00630     { return rep->is_integer_type (); }
00631 
00632   bool is_real_type (void) const
00633     { return rep->is_real_type (); }
00634 
00635   bool is_complex_type (void) const
00636     { return rep->is_complex_type (); }
00637 
00638   bool is_scalar_type (void) const
00639     { return rep->is_scalar_type (); }
00640 
00641   bool is_matrix_type (void) const
00642     { return rep->is_matrix_type (); }
00643 
00644   bool is_numeric_type (void) const
00645     { return rep->is_numeric_type (); }
00646 
00647   bool is_sparse_type (void) const
00648     { return rep->is_sparse_type (); }
00649 
00650   // Does this constant correspond to a truth value?
00651 
00652   bool is_true (void) const
00653     { return rep->is_true (); }
00654 
00655   // Do two constants match (in a switch statement)?
00656 
00657   bool is_equal (const octave_value&) const;
00658 
00659   // Are the dimensions of this constant zero by zero?
00660 
00661   bool is_zero_by_zero (void) const
00662     { return (rows () == 0 && columns () == 0); }
00663 
00664   bool is_constant (void) const
00665     { return rep->is_constant (); }
00666 
00667   bool is_function_handle (void) const
00668     { return rep->is_function_handle (); }
00669 
00670   bool is_anonymous_function (void) const
00671     { return rep->is_anonymous_function (); }
00672 
00673   bool is_inline_function (void) const
00674     { return rep->is_inline_function (); }
00675 
00676   bool is_function (void) const
00677     { return rep->is_function (); }
00678 
00679   bool is_user_script (void) const
00680     { return rep->is_user_script (); }
00681 
00682   bool is_user_function (void) const
00683     { return rep->is_user_function (); }
00684 
00685   bool is_user_code (void) const
00686     { return rep->is_user_code (); }
00687 
00688   bool is_builtin_function (void) const
00689     { return rep->is_builtin_function (); }
00690 
00691   bool is_dld_function (void) const
00692     { return rep->is_dld_function (); }
00693 
00694   bool is_mex_function (void) const
00695     { return rep->is_mex_function (); }
00696 
00697   void erase_subfunctions (void) { rep->erase_subfunctions (); }
00698 
00699   // Values.
00700 
00701   octave_value eval (void) { return *this; }
00702 
00703   short int
00704   short_value (bool req_int = false, bool frc_str_conv = false) const
00705     { return rep->short_value (req_int, frc_str_conv); }
00706 
00707   unsigned short int
00708   ushort_value (bool req_int = false, bool frc_str_conv = false) const
00709     { return rep->ushort_value (req_int, frc_str_conv); }
00710 
00711   int int_value (bool req_int = false, bool frc_str_conv = false) const
00712     { return rep->int_value (req_int, frc_str_conv); }
00713 
00714   unsigned int
00715   uint_value (bool req_int = false, bool frc_str_conv = false) const
00716     { return rep->uint_value (req_int, frc_str_conv); }
00717 
00718   int nint_value (bool frc_str_conv = false) const
00719     { return rep->nint_value (frc_str_conv); }
00720 
00721   long int
00722   long_value (bool req_int = false, bool frc_str_conv = false) const
00723     { return rep->long_value (req_int, frc_str_conv); }
00724 
00725   unsigned long int
00726   ulong_value (bool req_int = false, bool frc_str_conv = false) const
00727     { return rep->ulong_value (req_int, frc_str_conv); }
00728 
00729   octave_idx_type
00730   idx_type_value (bool req_int = false, bool frc_str_conv = false) const;
00731 
00732   double double_value (bool frc_str_conv = false) const
00733     { return rep->double_value (frc_str_conv); }
00734 
00735   float float_value (bool frc_str_conv = false) const
00736     { return rep->float_value (frc_str_conv); }
00737 
00738   double scalar_value (bool frc_str_conv = false) const
00739     { return rep->scalar_value (frc_str_conv); }
00740 
00741   float float_scalar_value (bool frc_str_conv = false) const
00742     { return rep->float_scalar_value (frc_str_conv); }
00743 
00744   Cell cell_value (void) const;
00745 
00746   Matrix matrix_value (bool frc_str_conv = false) const
00747     { return rep->matrix_value (frc_str_conv); }
00748 
00749   FloatMatrix float_matrix_value (bool frc_str_conv = false) const
00750     { return rep->float_matrix_value (frc_str_conv); }
00751 
00752   NDArray array_value (bool frc_str_conv = false) const
00753     { return rep->array_value (frc_str_conv); }
00754 
00755   FloatNDArray float_array_value (bool frc_str_conv = false) const
00756     { return rep->float_array_value (frc_str_conv); }
00757 
00758   Complex complex_value (bool frc_str_conv = false) const
00759     { return rep->complex_value (frc_str_conv); }
00760 
00761   FloatComplex float_complex_value (bool frc_str_conv = false) const
00762     { return rep->float_complex_value (frc_str_conv); }
00763 
00764   ComplexMatrix complex_matrix_value (bool frc_str_conv = false) const
00765     { return rep->complex_matrix_value (frc_str_conv); }
00766 
00767   FloatComplexMatrix float_complex_matrix_value (bool frc_str_conv = false) const
00768     { return rep->float_complex_matrix_value (frc_str_conv); }
00769 
00770   ComplexNDArray complex_array_value (bool frc_str_conv = false) const
00771     { return rep->complex_array_value (frc_str_conv); }
00772 
00773   FloatComplexNDArray float_complex_array_value (bool frc_str_conv = false) const
00774     { return rep->float_complex_array_value (frc_str_conv); }
00775 
00776   bool bool_value (bool warn = false) const
00777     { return rep->bool_value (warn); }
00778 
00779   boolMatrix bool_matrix_value (bool warn = false) const
00780     { return rep->bool_matrix_value (warn); }
00781 
00782   boolNDArray bool_array_value (bool warn = false) const
00783     { return rep->bool_array_value (warn); }
00784 
00785   charMatrix char_matrix_value (bool frc_str_conv = false) const
00786     { return rep->char_matrix_value (frc_str_conv); }
00787 
00788   charNDArray char_array_value (bool frc_str_conv = false) const
00789     { return rep->char_array_value (frc_str_conv); }
00790 
00791   SparseMatrix sparse_matrix_value (bool frc_str_conv = false) const
00792     { return rep->sparse_matrix_value (frc_str_conv); }
00793 
00794   SparseComplexMatrix sparse_complex_matrix_value (bool frc_str_conv = false) const
00795     { return rep->sparse_complex_matrix_value (frc_str_conv); }
00796 
00797   SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const
00798     { return rep->sparse_bool_matrix_value (warn); }
00799 
00800   DiagMatrix diag_matrix_value (bool force = false) const
00801     { return rep->diag_matrix_value (force); }
00802 
00803   FloatDiagMatrix float_diag_matrix_value (bool force = false) const
00804     { return rep->float_diag_matrix_value (force); }
00805 
00806   ComplexDiagMatrix complex_diag_matrix_value (bool force = false) const
00807     { return rep->complex_diag_matrix_value (force); }
00808 
00809   FloatComplexDiagMatrix float_complex_diag_matrix_value (bool force = false) const
00810     { return rep->float_complex_diag_matrix_value (force); }
00811 
00812   PermMatrix perm_matrix_value (void) const
00813     { return rep->perm_matrix_value (); }
00814 
00815   octave_int8 int8_scalar_value (void) const
00816     { return rep->int8_scalar_value (); }
00817 
00818   octave_int16 int16_scalar_value (void) const
00819     { return rep->int16_scalar_value (); }
00820 
00821   octave_int32 int32_scalar_value (void) const
00822     { return rep->int32_scalar_value (); }
00823 
00824   octave_int64 int64_scalar_value (void) const
00825     { return rep->int64_scalar_value (); }
00826 
00827   octave_uint8 uint8_scalar_value (void) const
00828     { return rep->uint8_scalar_value (); }
00829 
00830   octave_uint16 uint16_scalar_value (void) const
00831     { return rep->uint16_scalar_value (); }
00832 
00833   octave_uint32 uint32_scalar_value (void) const
00834     { return rep->uint32_scalar_value (); }
00835 
00836   octave_uint64 uint64_scalar_value (void) const
00837     { return rep->uint64_scalar_value (); }
00838 
00839   int8NDArray int8_array_value (void) const
00840     { return rep->int8_array_value (); }
00841 
00842   int16NDArray int16_array_value (void) const
00843     { return rep->int16_array_value (); }
00844 
00845   int32NDArray int32_array_value (void) const
00846     { return rep->int32_array_value (); }
00847 
00848   int64NDArray int64_array_value (void) const
00849     { return rep->int64_array_value (); }
00850 
00851   uint8NDArray uint8_array_value (void) const
00852     { return rep->uint8_array_value (); }
00853 
00854   uint16NDArray uint16_array_value (void) const
00855     { return rep->uint16_array_value (); }
00856 
00857   uint32NDArray uint32_array_value (void) const
00858     { return rep->uint32_array_value (); }
00859 
00860   uint64NDArray uint64_array_value (void) const
00861     { return rep->uint64_array_value (); }
00862 
00863   string_vector all_strings (bool pad = false) const
00864     { return rep->all_strings (pad); }
00865 
00866   std::string string_value (bool force = false) const
00867     { return rep->string_value (force); }
00868 
00869   Array<std::string> cellstr_value (void) const
00870     { return rep->cellstr_value (); }
00871 
00872   Range range_value (void) const
00873     { return rep->range_value (); }
00874 
00875   octave_map map_value (void) const;
00876 
00877   octave_scalar_map scalar_map_value (void) const;
00878 
00879   string_vector map_keys (void) const
00880     { return rep->map_keys (); }
00881 
00882   size_t nparents (void) const
00883     { return rep->nparents (); }
00884 
00885   std::list<std::string> parent_class_name_list (void) const
00886     { return rep->parent_class_name_list (); }
00887 
00888   string_vector parent_class_names (void) const
00889     { return rep->parent_class_names (); }
00890 
00891   octave_base_value *
00892   find_parent_class (const std::string& parent_class_name)
00893     { return rep->find_parent_class (parent_class_name); }
00894 
00895   octave_function *function_value (bool silent = false) const;
00896 
00897   octave_user_function *user_function_value (bool silent = false) const;
00898 
00899   octave_user_script *user_script_value (bool silent = false) const;
00900 
00901   octave_user_code *user_code_value (bool silent = false) const;
00902 
00903   octave_fcn_handle *fcn_handle_value (bool silent = false) const;
00904 
00905   octave_fcn_inline *fcn_inline_value (bool silent = false) const;
00906 
00907   octave_value_list list_value (void) const;
00908 
00909   ColumnVector column_vector_value (bool frc_str_conv = false,
00910                              bool frc_vec_conv = false) const;
00911 
00912   ComplexColumnVector
00913   complex_column_vector_value (bool frc_str_conv = false,
00914                         bool frc_vec_conv = false) const;
00915 
00916   RowVector row_vector_value (bool frc_str_conv = false,
00917                               bool frc_vec_conv = false) const;
00918 
00919   ComplexRowVector
00920   complex_row_vector_value (bool frc_str_conv = false,
00921                             bool frc_vec_conv = false) const;
00922 
00923 
00924   FloatColumnVector float_column_vector_value (bool frc_str_conv = false,
00925                              bool frc_vec_conv = false) const;
00926 
00927   FloatComplexColumnVector
00928   float_complex_column_vector_value (bool frc_str_conv = false,
00929                         bool frc_vec_conv = false) const;
00930 
00931   FloatRowVector float_row_vector_value (bool frc_str_conv = false,
00932                               bool frc_vec_conv = false) const;
00933 
00934   FloatComplexRowVector
00935   float_complex_row_vector_value (bool frc_str_conv = false,
00936                             bool frc_vec_conv = false) const;
00937 
00938 
00939 
00940 
00941   Array<int> int_vector_value (bool req_int = false,
00942                                bool frc_str_conv = false,
00943                                bool frc_vec_conv = false) const;
00944 
00945   Array<octave_idx_type>
00946   octave_idx_type_vector_value (bool req_int = false,
00947                                 bool frc_str_conv = false,
00948                                 bool frc_vec_conv = false) const;
00949 
00950   Array<double> vector_value (bool frc_str_conv = false,
00951                               bool frc_vec_conv = false) const;
00952 
00953   Array<Complex> complex_vector_value (bool frc_str_conv = false,
00954                                        bool frc_vec_conv = false) const;
00955 
00956   Array<float> float_vector_value (bool frc_str_conv = false,
00957                               bool frc_vec_conv = false) const;
00958 
00959   Array<FloatComplex> float_complex_vector_value (bool frc_str_conv = false,
00960                                        bool frc_vec_conv = false) const;
00961 
00962   // Possibly economize a lazy-indexed value.
00963 
00964   void maybe_economize (void)
00965     { rep->maybe_economize (); }
00966 
00967   // The following two hook conversions are called on any octave_value prior to
00968   // storing it to a "permanent" location, like a named variable, a cell or a
00969   // struct component, or a return value of a function.
00970 
00971   octave_value storable_value (void) const;
00972 
00973   // Ditto, but in place, i.e. equivalent to *this = this->storable_value (),
00974   // but possibly more efficient.
00975 
00976   void make_storable_value (void);
00977 
00978   // Conversions.  These should probably be private.  If a user of this
00979   // class wants a certain kind of constant, he should simply ask for
00980   // it, and we should convert it if possible.
00981 
00982   octave_value convert_to_str (bool pad = false, bool force = false,
00983                                char type = '\'') const
00984     { return rep->convert_to_str (pad, force, type); }
00985 
00986   octave_value
00987   convert_to_str_internal (bool pad, bool force, char type) const
00988     { return rep->convert_to_str_internal (pad, force, type); }
00989 
00990   void convert_to_row_or_column_vector (void)
00991     { rep->convert_to_row_or_column_vector (); }
00992 
00993   bool print_as_scalar (void) const
00994     { return rep->print_as_scalar (); }
00995 
00996   void print (std::ostream& os, bool pr_as_read_syntax = false) const
00997     { rep->print (os, pr_as_read_syntax); }
00998 
00999   void print_raw (std::ostream& os,
01000                           bool pr_as_read_syntax = false) const
01001     { rep->print_raw (os, pr_as_read_syntax); }
01002 
01003   bool print_name_tag (std::ostream& os, const std::string& name) const
01004     { return rep->print_name_tag (os, name); }
01005 
01006   void print_with_name (std::ostream& os, const std::string& name) const
01007   { rep->print_with_name (os, name, true); }
01008 
01009   int type_id (void) const { return rep->type_id (); }
01010 
01011   std::string type_name (void) const { return rep->type_name (); }
01012 
01013   std::string class_name (void) const { return rep->class_name (); }
01014 
01015   // Unary and binary operations.
01016 
01017   friend OCTINTERP_API octave_value do_unary_op (unary_op op,
01018                                    const octave_value& a);
01019 
01020   octave_value& do_non_const_unary_op (unary_op op);
01021 
01022   octave_value& do_non_const_unary_op (unary_op op, const std::string& type,
01023                                       const std::list<octave_value_list>& idx);
01024 
01025   friend OCTINTERP_API octave_value do_binary_op (binary_op op,
01026                                     const octave_value& a,
01027                                     const octave_value& b);
01028 
01029   friend OCTINTERP_API octave_value do_binary_op (compound_binary_op op,
01030                                                   const octave_value& a,
01031                                                   const octave_value& b);
01032 
01033   friend OCTINTERP_API octave_value do_cat_op (const octave_value& a,
01034                                  const octave_value& b,
01035                                  const Array<octave_idx_type>& ra_idx);
01036 
01037   const octave_base_value& get_rep (void) const { return *rep; }
01038 
01039   bool is_copy_of (const octave_value &val) const { return rep == val.rep; }
01040 
01041   void print_info (std::ostream& os,
01042                            const std::string& prefix = std::string ()) const;
01043 
01044   bool save_ascii (std::ostream& os) { return rep->save_ascii (os); }
01045 
01046   bool load_ascii (std::istream& is) { return rep->load_ascii (is); }
01047 
01048   bool save_binary (std::ostream& os, bool& save_as_floats)
01049     { return rep->save_binary (os, save_as_floats); }
01050 
01051   bool load_binary (std::istream& is, bool swap,
01052                             oct_mach_info::float_format fmt)
01053     { return rep->load_binary (is, swap, fmt); }
01054 
01055 #if defined (HAVE_HDF5)
01056   bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats)
01057     { return rep->save_hdf5 (loc_id, name, save_as_floats); }
01058 
01059   bool load_hdf5 (hid_t loc_id, const char *name)
01060     { return rep->load_hdf5 (loc_id, name); }
01061 #endif
01062 
01063   int write (octave_stream& os, int block_size,
01064                      oct_data_conv::data_type output_type, int skip,
01065                      oct_mach_info::float_format flt_fmt) const;
01066 
01067   octave_base_value *internal_rep (void) const { return rep; }
01068 
01069   // Unsafe.  These functions exist to support the MEX interface.
01070   // You should not use them anywhere else.
01071   void *mex_get_data (void) const { return rep->mex_get_data (); }
01072 
01073   octave_idx_type *mex_get_ir (void) const { return rep->mex_get_ir (); }
01074 
01075   octave_idx_type *mex_get_jc (void) const { return rep->mex_get_jc (); }
01076 
01077   mxArray *as_mxArray (void) const { return rep->as_mxArray (); }
01078 
01079   octave_value diag (octave_idx_type k = 0) const
01080     { return rep->diag (k); }
01081 
01082   octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
01083     { return rep->sort (dim, mode); }
01084   octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
01085                  sortmode mode = ASCENDING) const
01086     { return rep->sort (sidx, dim, mode); }
01087 
01088   sortmode is_sorted (sortmode mode = UNSORTED) const
01089     { return rep->is_sorted (mode); }
01090 
01091   Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const
01092     { return rep->sort_rows_idx (mode); }
01093 
01094   sortmode is_sorted_rows (sortmode mode = UNSORTED) const
01095     { return rep->is_sorted_rows (mode); }
01096 
01097   void lock (void) { rep->lock (); }
01098 
01099   void unlock (void) { rep->unlock (); }
01100 
01101   bool islocked (void) const { return rep->islocked (); }
01102 
01103   void dump (std::ostream& os) const { rep->dump (os); }
01104 
01105 #define MAPPER_FORWARD(F) \
01106   octave_value F (void) const { return rep->map (octave_base_value::umap_ ## F); }
01107 
01108   MAPPER_FORWARD (abs)
01109   MAPPER_FORWARD (acos)
01110   MAPPER_FORWARD (acosh)
01111   MAPPER_FORWARD (angle)
01112   MAPPER_FORWARD (arg)
01113   MAPPER_FORWARD (asin)
01114   MAPPER_FORWARD (asinh)
01115   MAPPER_FORWARD (atan)
01116   MAPPER_FORWARD (atanh)
01117   MAPPER_FORWARD (cbrt)
01118   MAPPER_FORWARD (ceil)
01119   MAPPER_FORWARD (conj)
01120   MAPPER_FORWARD (cos)
01121   MAPPER_FORWARD (cosh)
01122   MAPPER_FORWARD (erf)
01123   MAPPER_FORWARD (erfinv)
01124   MAPPER_FORWARD (erfc)
01125   MAPPER_FORWARD (erfcx)
01126   MAPPER_FORWARD (exp)
01127   MAPPER_FORWARD (expm1)
01128   MAPPER_FORWARD (finite)
01129   MAPPER_FORWARD (fix)
01130   MAPPER_FORWARD (floor)
01131   MAPPER_FORWARD (gamma)
01132   MAPPER_FORWARD (imag)
01133   MAPPER_FORWARD (isinf)
01134   MAPPER_FORWARD (isna)
01135   MAPPER_FORWARD (isnan)
01136   MAPPER_FORWARD (lgamma)
01137   MAPPER_FORWARD (log)
01138   MAPPER_FORWARD (log2)
01139   MAPPER_FORWARD (log10)
01140   MAPPER_FORWARD (log1p)
01141   MAPPER_FORWARD (real)
01142   MAPPER_FORWARD (round)
01143   MAPPER_FORWARD (roundb)
01144   MAPPER_FORWARD (signum)
01145   MAPPER_FORWARD (sin)
01146   MAPPER_FORWARD (sinh)
01147   MAPPER_FORWARD (sqrt)
01148   MAPPER_FORWARD (tan)
01149   MAPPER_FORWARD (tanh)
01150 
01151   // These functions are prefixed with X to avoid potential macro
01152   // conflicts.
01153 
01154   MAPPER_FORWARD (xisalnum)
01155   MAPPER_FORWARD (xisalpha)
01156   MAPPER_FORWARD (xisascii)
01157   MAPPER_FORWARD (xiscntrl)
01158   MAPPER_FORWARD (xisdigit)
01159   MAPPER_FORWARD (xisgraph)
01160   MAPPER_FORWARD (xislower)
01161   MAPPER_FORWARD (xisprint)
01162   MAPPER_FORWARD (xispunct)
01163   MAPPER_FORWARD (xisspace)
01164   MAPPER_FORWARD (xisupper)
01165   MAPPER_FORWARD (xisxdigit)
01166   MAPPER_FORWARD (xtoascii)
01167   MAPPER_FORWARD (xtolower)
01168   MAPPER_FORWARD (xtoupper)
01169 
01170 #undef MAPPER_FORWARD
01171 
01172   octave_value map (octave_base_value::unary_mapper_t umap) const
01173     { return rep->map (umap); }
01174 
01175   // Extract the n-th element, aka val(n). Result is undefined if val is not an
01176   // array type or n is out of range. Never error.
01177   octave_value
01178   fast_elem_extract (octave_idx_type n) const
01179     { return rep->fast_elem_extract (n); }
01180 
01181   // Assign the n-th element, aka val(n) = x. Returns false if val is not an
01182   // array type, x is not a matching scalar type, or n is out of range.
01183   // Never error.
01184   virtual bool
01185   fast_elem_insert (octave_idx_type n, const octave_value& x)
01186     {
01187       make_unique ();
01188       return rep->fast_elem_insert (n, x);
01189     }
01190 
01191 protected:
01192 
01193   // The real representation.
01194   octave_base_value *rep;
01195 
01196 private:
01197 
01198   assign_op unary_op_to_assign_op (unary_op op);
01199 
01200   binary_op op_eq_to_binary_op (assign_op op);
01201 
01202   // This declaration protects against constructing octave_value from
01203   // const octave_base_value* which actually silently calls octave_value (bool).
01204   octave_value (const octave_base_value *);
01205 
01206   DECLARE_OCTAVE_ALLOCATOR
01207 };
01208 
01209 // Publish externally used friend functions.
01210 
01211 extern OCTINTERP_API octave_value
01212 do_unary_op (octave_value::unary_op op, const octave_value& a);
01213 
01214 extern OCTINTERP_API octave_value
01215 do_binary_op (octave_value::binary_op op,
01216               const octave_value& a, const octave_value& b);
01217 
01218 extern OCTINTERP_API octave_value
01219 do_binary_op (octave_value::compound_binary_op op,
01220               const octave_value& a, const octave_value& b);
01221 
01222 #define OV_UNOP_FN(name) \
01223   inline octave_value \
01224   name (const octave_value& a) \
01225   { \
01226     return do_unary_op (octave_value::name, a); \
01227   }
01228 
01229 #define OV_UNOP_OP(name, op) \
01230   inline octave_value \
01231   operator op (const octave_value& a) \
01232   { \
01233     return name (a); \
01234   }
01235 
01236 #define OV_UNOP_FN_OP(name, op) \
01237   OV_UNOP_FN (name) \
01238   OV_UNOP_OP (name, op)
01239 
01240 OV_UNOP_FN_OP (op_not, !)
01241 OV_UNOP_FN_OP (op_uplus, +)
01242 OV_UNOP_FN_OP (op_uminus, -)
01243 
01244 OV_UNOP_FN (op_transpose)
01245 OV_UNOP_FN (op_hermitian)
01246 
01247 // No simple way to define these for prefix and suffix ops?
01248 //
01249 //   incr
01250 //   decr
01251 
01252 #define OV_BINOP_FN(name) \
01253   inline octave_value \
01254   name (const octave_value& a1, const octave_value& a2) \
01255   { \
01256     return do_binary_op (octave_value::name, a1, a2); \
01257   }
01258 
01259 #define OV_BINOP_OP(name, op) \
01260   inline octave_value \
01261   operator op (const octave_value& a1, const octave_value& a2) \
01262   { \
01263     return name (a1, a2); \
01264   }
01265 
01266 #define OV_BINOP_FN_OP(name, op) \
01267   OV_BINOP_FN (name) \
01268   OV_BINOP_OP (name, op)
01269 
01270 OV_BINOP_FN_OP (op_add, +)
01271 OV_BINOP_FN_OP (op_sub, -)
01272 OV_BINOP_FN_OP (op_mul, *)
01273 OV_BINOP_FN_OP (op_div, /)
01274 
01275 OV_BINOP_FN (op_pow)
01276 OV_BINOP_FN (op_ldiv)
01277 OV_BINOP_FN (op_lshift)
01278 OV_BINOP_FN (op_rshift)
01279 
01280 OV_BINOP_FN_OP (op_lt, <)
01281 OV_BINOP_FN_OP (op_le, <=)
01282 OV_BINOP_FN_OP (op_eq, ==)
01283 OV_BINOP_FN_OP (op_ge, >=)
01284 OV_BINOP_FN_OP (op_gt, >)
01285 OV_BINOP_FN_OP (op_ne, !=)
01286 
01287 OV_BINOP_FN (op_el_mul)
01288 OV_BINOP_FN (op_el_div)
01289 OV_BINOP_FN (op_el_pow)
01290 OV_BINOP_FN (op_el_ldiv)
01291 OV_BINOP_FN (op_el_and)
01292 OV_BINOP_FN (op_el_or)
01293 
01294 OV_BINOP_FN (op_struct_ref)
01295 
01296 #define OV_COMP_BINOP_FN(name) \
01297   inline octave_value \
01298   name (const octave_value& a1, const octave_value& a2) \
01299   { \
01300     return do_binary_op (octave_value::name, a1, a2); \
01301   }
01302 
01303 OV_COMP_BINOP_FN (op_trans_mul)
01304 OV_COMP_BINOP_FN (op_mul_trans)
01305 OV_COMP_BINOP_FN (op_herm_mul)
01306 OV_COMP_BINOP_FN (op_mul_herm)
01307 
01308 extern OCTINTERP_API void install_types (void);
01309 
01310 // This will eventually go away, but for now it can be used to
01311 // simplify the transition to the new octave_value class hierarchy,
01312 // which uses octave_base_value instead of octave_value for the type
01313 // of octave_value::rep.
01314 #define OV_REP_TYPE octave_base_value
01315 
01316 // Templated value extractors.
01317 template<class Value>
01318 inline Value octave_value_extract (const octave_value&)
01319   { assert (false); }
01320 
01321 #define DEF_VALUE_EXTRACTOR(VALUE,MPREFIX) \
01322 template<> \
01323 inline VALUE octave_value_extract<VALUE> (const octave_value& v) \
01324   { return v.MPREFIX ## _value (); }
01325 
01326 DEF_VALUE_EXTRACTOR (double, scalar)
01327 DEF_VALUE_EXTRACTOR (float, float_scalar)
01328 DEF_VALUE_EXTRACTOR (Complex, complex)
01329 DEF_VALUE_EXTRACTOR (FloatComplex, float_complex)
01330 DEF_VALUE_EXTRACTOR (bool, bool)
01331 
01332 DEF_VALUE_EXTRACTOR (octave_int8, int8_scalar)
01333 DEF_VALUE_EXTRACTOR (octave_int16, int16_scalar)
01334 DEF_VALUE_EXTRACTOR (octave_int32, int32_scalar)
01335 DEF_VALUE_EXTRACTOR (octave_int64, int64_scalar)
01336 DEF_VALUE_EXTRACTOR (octave_uint8, uint8_scalar)
01337 DEF_VALUE_EXTRACTOR (octave_uint16, uint16_scalar)
01338 DEF_VALUE_EXTRACTOR (octave_uint32, uint32_scalar)
01339 DEF_VALUE_EXTRACTOR (octave_uint64, uint64_scalar)
01340 
01341 
01342 DEF_VALUE_EXTRACTOR (NDArray, array)
01343 DEF_VALUE_EXTRACTOR (FloatNDArray, float_array)
01344 DEF_VALUE_EXTRACTOR (ComplexNDArray, complex_array)
01345 DEF_VALUE_EXTRACTOR (FloatComplexNDArray, float_complex_array)
01346 DEF_VALUE_EXTRACTOR (boolNDArray, bool_array)
01347 
01348 DEF_VALUE_EXTRACTOR (charNDArray, char_array)
01349 DEF_VALUE_EXTRACTOR (int8NDArray, int8_array)
01350 DEF_VALUE_EXTRACTOR (int16NDArray, int16_array)
01351 DEF_VALUE_EXTRACTOR (int32NDArray, int32_array)
01352 DEF_VALUE_EXTRACTOR (int64NDArray, int64_array)
01353 DEF_VALUE_EXTRACTOR (uint8NDArray, uint8_array)
01354 DEF_VALUE_EXTRACTOR (uint16NDArray, uint16_array)
01355 DEF_VALUE_EXTRACTOR (uint32NDArray, uint32_array)
01356 DEF_VALUE_EXTRACTOR (uint64NDArray, uint64_array)
01357 
01358 DEF_VALUE_EXTRACTOR (Matrix, matrix)
01359 DEF_VALUE_EXTRACTOR (FloatMatrix, float_matrix)
01360 DEF_VALUE_EXTRACTOR (ComplexMatrix, complex_matrix)
01361 DEF_VALUE_EXTRACTOR (FloatComplexMatrix, float_complex_matrix)
01362 DEF_VALUE_EXTRACTOR (boolMatrix, bool_matrix)
01363 
01364 DEF_VALUE_EXTRACTOR (ColumnVector, column_vector)
01365 DEF_VALUE_EXTRACTOR (FloatColumnVector, float_column_vector)
01366 DEF_VALUE_EXTRACTOR (ComplexColumnVector, complex_column_vector)
01367 DEF_VALUE_EXTRACTOR (FloatComplexColumnVector, float_complex_column_vector)
01368 
01369 DEF_VALUE_EXTRACTOR (RowVector, row_vector)
01370 DEF_VALUE_EXTRACTOR (FloatRowVector, float_row_vector)
01371 DEF_VALUE_EXTRACTOR (ComplexRowVector, complex_row_vector)
01372 DEF_VALUE_EXTRACTOR (FloatComplexRowVector, float_complex_row_vector)
01373 
01374 DEF_VALUE_EXTRACTOR (DiagMatrix, diag_matrix)
01375 DEF_VALUE_EXTRACTOR (FloatDiagMatrix, float_diag_matrix)
01376 DEF_VALUE_EXTRACTOR (ComplexDiagMatrix, complex_diag_matrix)
01377 DEF_VALUE_EXTRACTOR (FloatComplexDiagMatrix, float_complex_diag_matrix)
01378 DEF_VALUE_EXTRACTOR (PermMatrix, perm_matrix)
01379 
01380 DEF_VALUE_EXTRACTOR (SparseMatrix, sparse_matrix)
01381 DEF_VALUE_EXTRACTOR (SparseComplexMatrix, sparse_complex_matrix)
01382 DEF_VALUE_EXTRACTOR (SparseBoolMatrix, sparse_bool_matrix)
01383 #undef DEF_VALUE_EXTRACTOR
01384 
01385 #define DEF_DUMMY_VALUE_EXTRACTOR(VALUE,DEFVAL) \
01386 template<> \
01387 inline VALUE octave_value_extract<VALUE> (const octave_value&) \
01388   { assert (false); return DEFVAL; }
01389 
01390 DEF_DUMMY_VALUE_EXTRACTOR (char, 0)
01391 DEF_DUMMY_VALUE_EXTRACTOR (octave_value, octave_value ())
01392 #undef DEF_DUMMY_VALUE_EXTRACTOR
01393 
01394 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines