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
ov-base.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2015 John W. Eaton
4 Copyright (C) 2009-2010 VZLU Prague
5 
6 This file is part of Octave.
7 
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if !defined (octave_ov_base_h)
25 #define octave_ov_base_h 1
26 
27 #include <cstdlib>
28 
29 #include <iosfwd>
30 #include <list>
31 #include <string>
32 
33 #include "Range.h"
34 #include "data-conv.h"
35 #include "mx-base.h"
36 #include "str-vec.h"
37 
38 #include "error.h"
39 #include "oct-hdf5-id.h"
40 
41 class Cell;
42 class mxArray;
43 class octave_map;
44 class octave_scalar_map;
45 class octave_value;
46 class octave_value_list;
47 class octave_stream;
48 class octave_function;
50 class octave_user_script;
51 class octave_user_code;
52 class octave_fcn_handle;
53 class octave_fcn_inline;
54 class octave_value_list;
55 class octave_lvalue;
56 
57 class tree_walker;
58 
60 {
80 };
81 
82 extern OCTINTERP_API std::string
84 
86 get_builtin_classes (void);
87 
88 inline bool btyp_isnumeric (builtin_type_t btyp)
89 { return btyp <= btyp_uint64; }
90 
91 inline bool btyp_isinteger (builtin_type_t btyp)
92 { return btyp >= btyp_int8 && btyp <= btyp_uint64; }
93 
94 inline bool btyp_isfloat (builtin_type_t btyp)
95 { return btyp <= btyp_float_complex; }
96 
97 inline bool btyp_isarray (builtin_type_t btyp)
98 { return btyp <= btyp_char; }
99 
100 // Compute numeric type for a possible mixed-type operation, using these rules:
101 // bool -> double
102 // single + double -> single
103 // real + complex -> complex
104 // integer + real -> integer
105 // uint + uint -> uint (the bigger one)
106 // sint + sint -> sint (the bigger one)
107 //
108 // failing otherwise.
109 
110 extern OCTINTERP_API
112 
113 template <class T>
115 {
117 };
118 
119 #define DEF_CLASS_TO_BTYP(CLASS,BTYP) \
120 template <> \
121 struct class_to_btyp<CLASS> \
122 { static const builtin_type_t btyp = BTYP; }
123 
138 
139 // T_ID is the type id of struct objects, set by register_type().
140 // T_NAME is the type name of struct objects.
141 
142 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA \
143  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2 (OCTAVE_EMPTY_CPP_ARG)
144 
145 #define DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA \
146  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(virtual)
147 
148 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(VIRTUAL) \
149  public: \
150  VIRTUAL int type_id (void) const { return t_id; } \
151  VIRTUAL std::string type_name (void) const { return t_name; } \
152  VIRTUAL std::string class_name (void) const { return c_name; } \
153  static int static_type_id (void) { return t_id; } \
154  static std::string static_type_name (void) { return t_name; } \
155  static std::string static_class_name (void) { return c_name; } \
156  static void register_type (void); \
157  \
158  private: \
159  static int t_id; \
160  static const std::string t_name; \
161  static const std::string c_name;
162 
163 
164 #define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c) \
165  int t::t_id (-1); \
166  const std::string t::t_name (n); \
167  const std::string t::c_name (c); \
168  void t::register_type (void) \
169  { \
170  static t exemplar; \
171  octave_value v (&exemplar, true); \
172  t_id = octave_value_typeinfo::register_type (t::t_name, t::c_name, v); \
173  }
174 
175 // A base value type, so that derived types only have to redefine what
176 // they need (if they are derived from octave_base_value instead of
177 // octave_value).
178 
179 class
182 {
183 public:
184 
185  typedef octave_base_value * (*type_conv_fcn) (const octave_base_value&);
186 
187  // type conversion, including result type information
189  {
190  public:
191  type_conv_info (type_conv_fcn f = 0, int t = -1)
192  : _fcn (f), _type_id (t) { }
193 
194  operator type_conv_fcn (void) const { return _fcn; }
195 
196  octave_base_value * operator () (const octave_base_value &v) const
197  { return (*_fcn) (v); }
198 
199  int type_id (void) const { return _type_id; }
200 
201  private:
202  type_conv_fcn _fcn;
203  int _type_id;
204  };
205 
206  friend class octave_value;
207 
208  octave_base_value (void) : count (1) { }
209 
210  octave_base_value (const octave_base_value&) : count (1) { }
211 
212  virtual ~octave_base_value (void) { }
213 
214  // Unconditional clone. Always clones.
215  virtual octave_base_value *
216  clone (void) const { return new octave_base_value (*this); }
217 
218  // Empty clone.
219  virtual octave_base_value *
220  empty_clone (void) const;
221 
222  // Unique clone. Usually clones, but may be overridden to fake the
223  // cloning when sharing copies is to be controlled from within an
224  // instance (see octave_class).
225  virtual octave_base_value *
226  unique_clone (void) { return clone (); }
227 
228  virtual type_conv_info
230  { return type_conv_info (); }
231 
232  virtual type_conv_info
234  { return type_conv_info (); }
235 
236  virtual octave_value squeeze (void) const;
237 
238  virtual octave_value full_value (void) const;
239 
240  virtual octave_base_value *try_narrowing_conversion (void) { return 0; }
241 
242  virtual void maybe_economize (void) { }
243 
244  virtual Matrix size (void);
245 
246  virtual octave_idx_type numel (const octave_value_list&);
247 
248  virtual octave_value
249  subsref (const std::string& type,
250  const std::list<octave_value_list>& idx);
251 
252  virtual octave_value_list
253  subsref (const std::string& type,
254  const std::list<octave_value_list>& idx,
255  int nargout);
256 
257  virtual octave_value
258  subsref (const std::string& type,
259  const std::list<octave_value_list>& idx,
260  bool auto_add);
261 
262  virtual octave_value_list
263  subsref (const std::string& type,
264  const std::list<octave_value_list>& idx,
265  int nargout,
266  const std::list<octave_lvalue> *lvalue_list);
267 
268  virtual octave_value
269  do_index_op (const octave_value_list& idx, bool resize_ok = false);
270 
271  virtual octave_value_list
272  do_multi_index_op (int nargout, const octave_value_list& idx);
273 
274  virtual octave_value_list
275  do_multi_index_op (int nargout, const octave_value_list& idx,
276  const std::list<octave_lvalue> *lvalue_list);
277 
278  virtual void assign (const std::string&, const octave_value&) { }
279 
280  virtual octave_value
281  subsasgn (const std::string& type,
282  const std::list<octave_value_list>& idx,
283  const octave_value& rhs);
284 
285  virtual octave_value
286  undef_subsasgn (const std::string& type,
287  const std::list<octave_value_list>& idx,
288  const octave_value& rhs);
289 
290  virtual idx_vector index_vector (bool require_integers = false) const;
291 
292  virtual dim_vector dims (void) const { return dim_vector (); }
293 
294  octave_idx_type rows (void) const
295  {
296  const dim_vector dv = dims ();
297 
298  return dv(0);
299  }
300 
302  {
303  const dim_vector dv = dims ();
304 
305  return dv(1);
306  }
307 
308  virtual int ndims (void) const
309  { return dims ().length (); }
310 
311  virtual octave_idx_type numel (void) const { return dims ().numel (); }
312 
313  virtual octave_idx_type capacity (void) const { return numel (); }
314 
315  virtual size_t byte_size (void) const { return 0; }
316 
317  virtual octave_idx_type nnz (void) const;
318 
319  virtual octave_idx_type nzmax (void) const;
320 
321  virtual octave_idx_type nfields (void) const;
322 
323  virtual octave_value reshape (const dim_vector&) const;
324 
325  virtual octave_value permute (const Array<int>& vec, bool = false) const;
326 
327  virtual octave_value resize (const dim_vector&, bool fill = false) const;
328 
329  virtual MatrixType matrix_type (void) const;
330 
331  virtual MatrixType matrix_type (const MatrixType& typ) const;
332 
333  virtual bool is_defined (void) const { return false; }
334 
335  bool is_empty (void) const { return (dims ().any_zero ()); }
336 
337  virtual bool is_cell (void) const { return false; }
338 
339  virtual bool is_cellstr (void) const { return false; }
340 
341  virtual bool is_real_scalar (void) const { return false; }
342 
343  virtual bool is_real_matrix (void) const { return false; }
344 
345  virtual bool is_complex_scalar (void) const { return false; }
346 
347  virtual bool is_complex_matrix (void) const { return false; }
348 
349  virtual bool is_bool_scalar (void) const { return false; }
350 
351  virtual bool is_bool_matrix (void) const { return false; }
352 
353  virtual bool is_char_matrix (void) const { return false; }
354 
355  virtual bool is_diag_matrix (void) const { return false; }
356 
357  virtual bool is_perm_matrix (void) const { return false; }
358 
359  virtual bool is_string (void) const { return false; }
360 
361  virtual bool is_sq_string (void) const { return false; }
362 
363  virtual bool is_range (void) const { return false; }
364 
365  virtual bool is_map (void) const { return false; }
366 
367  virtual bool is_object (void) const { return false; }
368 
369  virtual bool is_classdef_object (void) const { return false; }
370 
371  virtual bool is_java (void) const { return false; }
372 
373  virtual bool is_cs_list (void) const { return false; }
374 
375  virtual bool is_magic_colon (void) const { return false; }
376 
377  virtual bool is_all_va_args (void) const { return false; }
378 
379  virtual octave_value all (int = 0) const;
380 
381  virtual octave_value any (int = 0) const;
382 
383  virtual builtin_type_t builtin_type (void) const { return btyp_unknown; }
384 
385  virtual bool is_double_type (void) const { return false; }
386 
387  virtual bool is_single_type (void) const { return false; }
388 
389  virtual bool is_float_type (void) const { return false; }
390 
391  virtual bool is_int8_type (void) const { return false; }
392 
393  virtual bool is_int16_type (void) const { return false; }
394 
395  virtual bool is_int32_type (void) const { return false; }
396 
397  virtual bool is_int64_type (void) const { return false; }
398 
399  virtual bool is_uint8_type (void) const { return false; }
400 
401  virtual bool is_uint16_type (void) const { return false; }
402 
403  virtual bool is_uint32_type (void) const { return false; }
404 
405  virtual bool is_uint64_type (void) const { return false; }
406 
407  virtual bool is_bool_type (void) const { return false; }
408 
409  virtual bool is_integer_type (void) const { return false; }
410 
411  virtual bool is_real_type (void) const { return false; }
412 
413  virtual bool is_complex_type (void) const { return false; }
414 
415  // Would be nice to get rid of the next four functions:
416 
417  virtual bool is_scalar_type (void) const { return false; }
418 
419  virtual bool is_matrix_type (void) const { return false; }
420 
421  virtual bool is_numeric_type (void) const { return false; }
422 
423  virtual bool is_sparse_type (void) const { return false; }
424 
425  virtual bool is_true (void) const { return false; }
426 
427  virtual bool is_null_value (void) const { return false; }
428 
429  virtual bool is_constant (void) const { return false; }
430 
431  virtual bool is_function_handle (void) const { return false; }
432 
433  virtual bool is_anonymous_function (void) const { return false; }
434 
435  virtual bool is_inline_function (void) const { return false; }
436 
437  virtual bool is_function (void) const { return false; }
438 
439  virtual bool is_user_script (void) const { return false; }
440 
441  virtual bool is_user_function (void) const { return false; }
442 
443  virtual bool is_user_code (void) const { return false; }
444 
445  virtual bool is_builtin_function (void) const { return false; }
446 
447  virtual bool is_dld_function (void) const { return false; }
448 
449  virtual bool is_mex_function (void) const { return false; }
450 
451  virtual void erase_subfunctions (void) { }
452 
453  virtual short int short_value (bool = false, bool = false) const;
454 
455  virtual unsigned short int ushort_value (bool = false, bool = false) const;
456 
457  virtual int int_value (bool = false, bool = false) const;
458 
459  virtual unsigned int uint_value (bool = false, bool = false) const;
460 
461  virtual int nint_value (bool = false) const;
462 
463  virtual long int long_value (bool = false, bool = false) const;
464 
465  virtual unsigned long int ulong_value (bool = false, bool = false) const;
466 
467  virtual int64_t int64_value (bool = false, bool = false) const;
468 
469  virtual uint64_t uint64_value (bool = false, bool = false) const;
470 
471  virtual double double_value (bool = false) const;
472 
473  virtual float float_value (bool = false) const;
474 
475  virtual double scalar_value (bool frc_str_conv = false) const
476  { return double_value (frc_str_conv); }
477 
478  virtual float float_scalar_value (bool frc_str_conv = false) const
479  { return float_value (frc_str_conv); }
480 
481  virtual Cell cell_value (void) const;
482 
483  virtual Matrix matrix_value (bool = false) const;
484 
485  virtual FloatMatrix float_matrix_value (bool = false) const;
486 
487  virtual NDArray array_value (bool = false) const;
488 
489  virtual FloatNDArray float_array_value (bool = false) const;
490 
491  virtual Complex complex_value (bool = false) const;
492 
493  virtual FloatComplex float_complex_value (bool = false) const;
494 
495  virtual ComplexMatrix complex_matrix_value (bool = false) const;
496 
497  virtual FloatComplexMatrix float_complex_matrix_value (bool = false) const;
498 
499  virtual ComplexNDArray complex_array_value (bool = false) const;
500 
501  virtual FloatComplexNDArray float_complex_array_value (bool = false) const;
502 
503  virtual bool bool_value (bool = false) const;
504 
505  virtual boolMatrix bool_matrix_value (bool = false) const;
506 
507  virtual boolNDArray bool_array_value (bool = false) const;
508 
509  virtual charMatrix char_matrix_value (bool force = false) const;
510 
511  virtual charNDArray char_array_value (bool = false) const;
512 
513  virtual SparseMatrix sparse_matrix_value (bool = false) const;
514 
515  virtual SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
516 
517  virtual SparseBoolMatrix sparse_bool_matrix_value (bool = false) const;
518 
519  virtual DiagMatrix diag_matrix_value (bool = false) const;
520 
521  virtual FloatDiagMatrix float_diag_matrix_value (bool = false) const;
522 
523  virtual ComplexDiagMatrix complex_diag_matrix_value (bool = false) const;
524 
525  virtual FloatComplexDiagMatrix
526  float_complex_diag_matrix_value (bool = false) const;
527 
528  virtual PermMatrix perm_matrix_value (void) const;
529 
530  virtual octave_int8 int8_scalar_value (void) const;
531 
532  virtual octave_int16 int16_scalar_value (void) const;
533 
534  virtual octave_int32 int32_scalar_value (void) const;
535 
536  virtual octave_int64 int64_scalar_value (void) const;
537 
538  virtual octave_uint8 uint8_scalar_value (void) const;
539 
540  virtual octave_uint16 uint16_scalar_value (void) const;
541 
542  virtual octave_uint32 uint32_scalar_value (void) const;
543 
544  virtual octave_uint64 uint64_scalar_value (void) const;
545 
546  virtual int8NDArray int8_array_value (void) const;
547 
548  virtual int16NDArray int16_array_value (void) const;
549 
550  virtual int32NDArray int32_array_value (void) const;
551 
552  virtual int64NDArray int64_array_value (void) const;
553 
554  virtual uint8NDArray uint8_array_value (void) const;
555 
556  virtual uint16NDArray uint16_array_value (void) const;
557 
558  virtual uint32NDArray uint32_array_value (void) const;
559 
560  virtual uint64NDArray uint64_array_value (void) const;
561 
562  virtual string_vector all_strings (bool pad = false) const;
563 
564  virtual std::string string_value (bool force = false) const;
565 
566  virtual Array<std::string> cellstr_value (void) const;
567 
568  virtual Range range_value (void) const;
569 
570  virtual octave_map map_value (void) const;
571 
572  virtual octave_scalar_map scalar_map_value (void) const;
573 
574  virtual string_vector map_keys (void) const;
575 
576  virtual size_t nparents (void) const;
577 
578  virtual std::list<std::string> parent_class_name_list (void) const;
579 
580  virtual string_vector parent_class_names (void) const;
581 
582  virtual octave_base_value *find_parent_class (const std::string&)
583  { return 0; }
584 
585  virtual octave_base_value *unique_parent_class (const std::string&)
586  { return 0; }
587 
588  virtual bool is_instance_of (const std::string&) const
589  { return false; }
590 
591  virtual octave_function *function_value (bool silent = false);
592 
593  virtual octave_user_function *user_function_value (bool silent = false);
594 
595  virtual octave_user_script *user_script_value (bool silent = false);
596 
597  virtual octave_user_code *user_code_value (bool silent = false);
598 
599  virtual octave_fcn_handle *fcn_handle_value (bool silent = false);
600 
601  virtual octave_fcn_inline *fcn_inline_value (bool silent = false);
602 
603  virtual octave_value_list list_value (void) const;
604 
605  virtual octave_value convert_to_str (bool pad = false, bool force = false,
606  char type = '\'') const;
607  virtual octave_value
608  convert_to_str_internal (bool pad, bool force, char type) const;
609 
610  virtual void convert_to_row_or_column_vector (void);
611 
612  virtual bool print_as_scalar (void) const { return false; }
613 
614  virtual void print (std::ostream& os, bool pr_as_read_syntax = false);
615 
616  virtual void
617  print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
618 
619  virtual bool
620  print_name_tag (std::ostream& os, const std::string& name) const;
621 
622  virtual void
623  print_with_name (std::ostream& output_buf, const std::string& name,
624  bool print_padding = true);
625 
626  virtual void short_disp (std::ostream& os) const { os << "..."; }
627 
628  virtual void print_info (std::ostream& os, const std::string& prefix) const;
629 
630  virtual bool save_ascii (std::ostream& os);
631 
632  virtual bool load_ascii (std::istream& is);
633 
634  virtual bool save_binary (std::ostream& os, bool& save_as_floats);
635 
636  virtual bool load_binary (std::istream& is, bool swap,
638 
639  virtual bool
640  save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats);
641 
642  virtual bool
643  load_hdf5 (octave_hdf5_id loc_id, const char *name);
644 
645  virtual int
646  write (octave_stream& os, int block_size,
647  oct_data_conv::data_type output_type, int skip,
648  oct_mach_info::float_format flt_fmt) const;
649 
650  virtual void *mex_get_data (void) const { return 0; }
651 
652  virtual octave_idx_type *mex_get_ir (void) const { return 0; }
653 
654  virtual octave_idx_type *mex_get_jc (void) const { return 0; }
655 
656  virtual mxArray *as_mxArray (void) const;
657 
658  virtual octave_value diag (octave_idx_type k = 0) const;
659 
660  virtual octave_value diag (octave_idx_type m, octave_idx_type n) const;
661 
662  virtual octave_value sort (octave_idx_type dim = 0,
663  sortmode mode = ASCENDING) const;
665  octave_idx_type dim = 0,
666  sortmode mode = ASCENDING) const;
667 
668  virtual sortmode is_sorted (sortmode mode = UNSORTED) const;
669 
670  virtual Array<octave_idx_type>
671  sort_rows_idx (sortmode mode = ASCENDING) const;
672 
673  virtual sortmode is_sorted_rows (sortmode mode = UNSORTED) const;
674 
675  virtual void lock (void);
676 
677  virtual void unlock (void);
678 
679  virtual bool islocked (void) const { return false; }
680 
681  virtual void dump (std::ostream& os) const;
682 
683  // Standard mappers. Register new ones here.
685  {
748  num_unary_mappers = umap_unknown
749  };
750 
751  virtual octave_value map (unary_mapper_t) const;
752 
753  // These are fast indexing & assignment shortcuts for extracting
754  // or inserting a single scalar from/to an array.
755 
756  // Extract the n-th element, aka val(n). Result is undefined if val is not an
757  // array type or n is out of range. Never error.
758  virtual octave_value
760 
761  // Assign the n-th element, aka val(n) = x. Returns false if val is not an
762  // array type, x is not a matching scalar type, or n is out of range.
763  // Never error.
764  virtual bool
766 
767  // This is a helper for the above, to be overridden in scalar types. The
768  // whole point is to handle the insertion efficiently with just *two* VM
769  // calls, which is basically the theoretical minimum.
770  virtual bool
771  fast_elem_insert_self (void *where, builtin_type_t btyp) const;
772 
773  // Grab the reference count. For use by jit.
774  void
775  grab (void)
776  {
777  ++count;
778  }
779 
780  // Release the reference count. For use by jit.
781  void
782  release (void)
783  {
784  if (--count == 0)
785  delete this;
786  }
787 
788 protected:
789 
790  // This should only be called for derived types.
791 
792  octave_value numeric_assign (const std::string& type,
793  const std::list<octave_value_list>& idx,
794  const octave_value& rhs);
795 
796  void reset_indent_level (void) const
797  { curr_print_indent_level = 0; }
798 
799  void increment_indent_level (void) const
800  { curr_print_indent_level += 2; }
801 
802  void decrement_indent_level (void) const
803  { curr_print_indent_level -= 2; }
804 
805  int current_print_indent_level (void) const
806  { return curr_print_indent_level; }
807 
808  void indent (std::ostream& os) const;
809 
810  void newline (std::ostream& os) const;
811 
812  void reset (void) const;
813 
814  // A reference count.
815  // NOTE: the declaration is octave_idx_type because with 64-bit indexing,
816  // it is well possible to have more than MAX_INT copies of a single value
817  // (think of an empty cell array with >2G elements).
819 
820  static const char *get_umap_name (unary_mapper_t);
821 
822  void gripe_load (const char *type) const;
823  void gripe_save (const char *type) const;
824 
825 private:
826 
828  static bool beginning_of_line;
829 
831 };
832 
833 // TRUE means to perform automatic sparse to real mutation if there
834 // is memory to be saved
836 
837 // Utility function to convert C++ arguments used in subsref/subsasgn into an
838 // octave_value_list object that can be used to call a function/method in the
839 // interpreter.
841 make_idx_args (const std::string& type,
842  const std::list<octave_value_list>& idx,
843  const std::string& who);
844 
845 // Tells whether some regular octave_value_base methods are being called from
846 // within the "builtin" function.
847 extern OCTINTERP_API bool called_from_builtin (void);
848 
849 #endif
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
Definition: ov.h:1144
uint8NDArray uint8_array_value(void) const
Definition: ov.h:882
virtual bool is_uint32_type(void) const
Definition: ov-base.h:403
virtual octave_base_value * unique_parent_class(const std::string &)
Definition: ov-base.h:585
virtual dim_vector dims(void) const
Definition: ov-base.h:292
octave_idx_type nnz(void) const
Definition: ov.h:492
#define DEF_CLASS_TO_BTYP(CLASS, BTYP)
Definition: ov-base.h:119
virtual octave_idx_type capacity(void) const
Definition: ov-base.h:313
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
Definition: ov.h:798
bool btyp_isfloat(builtin_type_t btyp)
Definition: ov-base.h:94
virtual bool is_sparse_type(void) const
Definition: ov-base.h:423
virtual bool is_bool_matrix(void) const
Definition: ov-base.h:351
FloatComplexDiagMatrix float_complex_diag_matrix_value(bool force=false) const
Definition: ov.h:840
OCTINTERP_API octave_value make_idx_args(const std::string &type, const std::list< octave_value_list > &idx, const std::string &who)
Definition: ov-base.cc:1570
virtual bool is_mex_function(void) const
Definition: ov-base.h:449
Definition: Cell.h:35
virtual bool is_true(void) const
Definition: ov-base.h:425
virtual bool is_complex_matrix(void) const
Definition: ov-base.h:347
size_t nparents(void) const
Definition: ov.h:913
charNDArray char_array_value(bool frc_str_conv=false) const
Definition: ov.h:817
virtual bool is_function(void) const
Definition: ov-base.h:437
bool load_binary(std::istream &is, bool swap, oct_mach_info::float_format fmt)
Definition: ov.h:1099
octave_refcount< octave_idx_type > count
Definition: ov-base.h:818
virtual bool is_real_type(void) const
Definition: ov-base.h:411
boolMatrix bool_matrix_value(bool warn=false) const
Definition: ov.h:808
virtual bool is_function_handle(void) const
Definition: ov-base.h:431
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Definition: ov.h:401
bool print_name_tag(std::ostream &os, const std::string &name) const
Definition: ov.h:1037
virtual type_conv_info numeric_conversion_function(void) const
Definition: ov-base.h:229
octave_value reshape(const dim_vector &dv) const
Definition: ov.h:498
octave_value permute(const Array< int > &vec, bool inv=false) const
Definition: ov.h:501
void increment_indent_level(void) const
Definition: ov-base.h:799
virtual bool is_double_type(void) const
Definition: ov-base.h:385
octave_int16 int16_scalar_value(void) const
Definition: ov.h:849
octave_value full_value(void) const
Definition: ov.h:385
unsigned int uint_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:734
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov.h:1103
int8NDArray int8_array_value(void) const
Definition: ov.h:870
octave_idx_type columns(void) const
Definition: ov-base.h:301
void print_info(std::ostream &os, const std::string &prefix=std::string()) const
Definition: ov.cc:2488
FloatComplexMatrix float_complex_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:795
octave_base_value * empty_clone(void) const
Definition: ov.h:314
mxArray * as_mxArray(void) const
Definition: ov.h:1124
virtual bool is_bool_type(void) const
Definition: ov-base.h:407
sortmode
Definition: oct-sort.h:103
virtual bool is_real_matrix(void) const
Definition: ov-base.h:343
virtual void short_disp(std::ostream &os) const
Definition: ov-base.h:626
int16NDArray int16_array_value(void) const
Definition: ov.h:873
virtual type_conv_info numeric_demotion_function(void) const
Definition: ov-base.h:233
octave_idx_type nfields(void) const
Definition: ov.h:496
std::list< std::string > parent_class_name_list(void) const
Definition: ov.h:916
virtual bool is_magic_colon(void) const
Definition: ov-base.h:375
octave_map map_value(void) const
Definition: ov.cc:1585
octave_user_code * user_code_value(bool silent=false) const
Definition: ov.cc:1615
octave_value diag(octave_idx_type k=0) const
Definition: ov.h:1126
virtual void assign(const std::string &, const octave_value &)
Definition: ov-base.h:278
virtual bool is_int8_type(void) const
Definition: ov-base.h:391
virtual void maybe_economize(void)
Definition: ov-base.h:242
virtual octave_idx_type * mex_get_ir(void) const
Definition: ov-base.h:652
int int_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:730
Definition: Range.h:31
uint64NDArray uint64_array_value(void) const
Definition: ov.h:891
virtual bool is_classdef_object(void) const
Definition: ov-base.h:369
int64_t int64_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:749
OCTINTERP_API string_vector get_builtin_classes(void)
Definition: ov-base.cc:93
virtual bool is_user_code(void) const
Definition: ov-base.h:443
virtual double scalar_value(bool frc_str_conv=false) const
Definition: ov-base.h:475
octave_int32 int32_scalar_value(void) const
Definition: ov.h:852
float float_value(bool frc_str_conv=false) const
Definition: ov.h:762
int32NDArray int32_array_value(void) const
Definition: ov.h:876
virtual bool is_anonymous_function(void) const
Definition: ov-base.h:433
bool btyp_isarray(builtin_type_t btyp)
Definition: ov-base.h:97
octave_value map(octave_base_value::unary_mapper_t umap) const
Definition: ov.h:1226
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Definition: ov.h:1141
virtual bool is_perm_matrix(void) const
Definition: ov-base.h:357
virtual float float_scalar_value(bool frc_str_conv=false) const
Definition: ov-base.h:478
virtual bool is_numeric_type(void) const
Definition: ov-base.h:421
octave_value resize(const dim_vector &dv, bool fill=false) const
Definition: ov.h:507
OCTINTERP_API std::string btyp_class_name[btyp_num_types]
Definition: ov-base.cc:83
octave_idx_type nzmax(void) const
Definition: ov.h:494
virtual size_t byte_size(void) const
Definition: ov-base.h:315
octave_value convert_to_str_internal(bool pad, bool force, char type) const
Definition: ov.h:1022
virtual bool is_cs_list(void) const
Definition: ov-base.h:373
virtual bool is_cell(void) const
Definition: ov-base.h:337
octave_fcn_handle * fcn_handle_value(bool silent=false) const
Definition: ov.cc:1621
virtual bool is_null_value(void) const
Definition: ov-base.h:427
builtin_type_t
Definition: ov-base.h:59
ComplexDiagMatrix complex_diag_matrix_value(bool force=false) const
Definition: ov.h:836
virtual bool is_int64_type(void) const
Definition: ov-base.h:397
virtual bool is_cellstr(void) const
Definition: ov-base.h:339
OCTINTERP_API bool called_from_builtin(void)
Definition: ov-base.cc:1647
bool is_empty(void) const
Definition: ov-base.h:335
boolNDArray bool_array_value(bool warn=false) const
Definition: ov.h:811
virtual octave_idx_type * mex_get_jc(void) const
Definition: ov-base.h:654
virtual bool is_scalar_type(void) const
Definition: ov-base.h:417
octave_base_value * clone(void) const
Definition: ov.cc:1265
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
Definition: dim-vector.h:361
string_vector all_strings(bool pad=false) const
Definition: ov.h:894
virtual void * mex_get_data(void) const
Definition: ov-base.h:650
virtual bool is_range(void) const
Definition: ov-base.h:363
virtual bool is_map(void) const
Definition: ov-base.h:365
virtual octave_idx_type numel(void) const
Definition: ov-base.h:311
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov.cc:1414
octave_base_value(void)
Definition: ov-base.h:208
int64NDArray int64_array_value(void) const
Definition: ov.h:879
Cell cell_value(void) const
Definition: ov.cc:1566
static int curr_print_indent_level
Definition: ov-base.h:827
virtual bool is_single_type(void) const
Definition: ov-base.h:387
OCTINTERP_API bool Vsparse_auto_mutate
Definition: ov-base.cc:118
sortmode is_sorted(sortmode mode=UNSORTED) const
Definition: ov.h:1138
idx_vector index_vector(bool require_integers=false) const
Definition: ov.h:463
virtual bool is_uint64_type(void) const
Definition: ov-base.h:405
void lock(void)
Definition: ov.h:1147
Array< std::string > cellstr_value(void) const
Definition: ov.h:900
octave_value_list do_multi_index_op(int nargout, const octave_value_list &idx)
Definition: ov.cc:1382
static const builtin_type_t btyp
Definition: ov-base.h:116
virtual octave_base_value * clone(void) const
Definition: ov-base.h:216
octave_value any(int dim=0) const
Definition: ov.h:600
long int long_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:741
virtual octave_base_value * try_narrowing_conversion(void)
Definition: ov-base.h:240
FloatNDArray float_array_value(bool frc_str_conv=false) const
Definition: ov.h:782
void dump(std::ostream &os) const
Definition: ov.h:1153
virtual octave_base_value * find_parent_class(const std::string &)
Definition: ov-base.h:582
#define DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:145
unsigned long int ulong_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:745
octave_uint8 uint8_scalar_value(void) const
Definition: ov.h:858
virtual bool is_builtin_function(void) const
Definition: ov-base.h:445
virtual bool is_integer_type(void) const
Definition: ov-base.h:409
F77_RET_T const double const double * f
#define OCTINTERP_API
Definition: mexproto.h:66
octave_value convert_to_str(bool pad=false, bool force=false, char type= '\'') const
Definition: ov.h:1017
uint64_t uint64_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:753
octave_value squeeze(void) const
Definition: ov.h:381
virtual bool is_all_va_args(void) const
Definition: ov-base.h:377
virtual bool is_object(void) const
Definition: ov-base.h:367
void print(std::ostream &os, bool pr_as_read_syntax=false)
Definition: ov.h:1031
std::string string_value(bool force=false) const
Definition: ov.h:897
FloatDiagMatrix float_diag_matrix_value(bool force=false) const
Definition: ov.h:833
virtual int ndims(void) const
Definition: ov-base.h:308
int nint_value(bool frc_str_conv=false) const
Definition: ov.h:737
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Definition: ov.h:1107
FloatComplex float_complex_value(bool frc_str_conv=false) const
Definition: ov.h:788
virtual bool is_bool_scalar(void) const
Definition: ov-base.h:349
Range range_value(void) const
Definition: ov.h:903
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
Definition: ov.h:802
virtual bool is_int16_type(void) const
Definition: ov-base.h:393
octave_user_function * user_function_value(bool silent=false) const
Definition: ov.cc:1603
bool save_binary(std::ostream &os, bool &save_as_floats)
Definition: ov.h:1096
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
Definition: ov.h:827
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov.h:1034
virtual bool is_int32_type(void) const
Definition: ov-base.h:395
bool btyp_isnumeric(builtin_type_t btyp)
Definition: ov-base.h:88
virtual bool is_real_scalar(void) const
Definition: ov-base.h:341
virtual bool is_instance_of(const std::string &) const
Definition: ov-base.h:588
virtual bool print_as_scalar(void) const
Definition: ov-base.h:612
virtual bool is_complex_type(void) const
Definition: ov-base.h:413
virtual bool is_user_script(void) const
Definition: ov-base.h:439
string_vector map_keys(void) const
Definition: ov.h:910
virtual bool is_user_function(void) const
Definition: ov-base.h:441
Definition: dMatrix.h:35
octave_value all(int dim=0) const
Definition: ov.h:597
size_t size(T const (&)[z])
Definition: help.cc:103
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:824
string_vector parent_class_names(void) const
Definition: ov.h:919
bool btyp_isinteger(builtin_type_t btyp)
Definition: ov-base.h:91
dim_vector dims(void) const
Definition: ov.h:470
Matrix matrix_value(bool frc_str_conv=false) const
Definition: ov.h:773
virtual bool is_dld_function(void) const
Definition: ov-base.h:447
int write(octave_stream &os, int block_size, oct_data_conv::data_type output_type, int skip, oct_mach_info::float_format flt_fmt) const
Definition: ov.cc:1956
void decrement_indent_level(void) const
Definition: ov-base.h:802
virtual bool is_defined(void) const
Definition: ov-base.h:333
virtual bool is_sq_string(void) const
Definition: ov-base.h:361
virtual bool is_java(void) const
Definition: ov-base.h:371
octave_idx_type numel(void) const
Definition: ov.h:483
charMatrix char_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:814
virtual octave_base_value * unique_clone(void)
Definition: ov-base.h:226
octave_function * function_value(bool silent=false) const
Definition: ov.cc:1597
bool save_ascii(std::ostream &os)
Definition: ov.h:1092
MatrixType matrix_type(void) const
Definition: ov.h:510
DiagMatrix diag_matrix_value(bool force=false) const
Definition: ov.h:830
virtual bool is_constant(void) const
Definition: ov-base.h:429
void grab(void)
Definition: ov-base.h:775
unsigned short int ushort_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:727
Handles the reference counting for all the derived classes.
Definition: Array.h:45
octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
Definition: ov.h:1132
virtual bool islocked(void) const
Definition: ov-base.h:679
octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov.cc:1422
virtual ~octave_base_value(void)
Definition: ov-base.h:212
NDArray array_value(bool frc_str_conv=false) const
Definition: ov.h:779
octave_base_value(const octave_base_value &)
Definition: ov-base.h:210
octave_int8 int8_scalar_value(void) const
Definition: ov.h:846
virtual bool is_float_type(void) const
Definition: ov-base.h:389
virtual void erase_subfunctions(void)
Definition: ov-base.h:451
octave_scalar_map scalar_map_value(void) const
Definition: ov.cc:1591
type_conv_info(type_conv_fcn f=0, int t=-1)
Definition: ov-base.h:191
void unlock(void)
Definition: ov.h:1149
bool load_ascii(std::istream &is)
Definition: ov.h:1094
bool bool_value(bool warn=false) const
Definition: ov.h:805
virtual bool is_complex_scalar(void) const
Definition: ov-base.h:345
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:791
virtual bool is_string(void) const
Definition: ov-base.h:359
int current_print_indent_level(void) const
Definition: ov-base.h:805
virtual bool is_uint16_type(void) const
Definition: ov-base.h:401
Complex complex_value(bool frc_str_conv=false) const
Definition: ov.h:785
FloatMatrix float_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:776
void print_with_name(std::ostream &os, const std::string &name) const
Definition: ov.h:1040
virtual bool is_matrix_type(void) const
Definition: ov-base.h:419
virtual bool is_inline_function(void) const
Definition: ov-base.h:435
octave_int64 int64_scalar_value(void) const
Definition: ov.h:855
virtual builtin_type_t builtin_type(void) const
Definition: ov-base.h:383
OCTINTERP_API builtin_type_t btyp_mixed_numeric(builtin_type_t x, builtin_type_t y)
Definition: ov-base.cc:59
virtual bool is_char_matrix(void) const
Definition: ov-base.h:353
octave_uint64 uint64_scalar_value(void) const
Definition: ov.h:867
octave_value fast_elem_extract(octave_idx_type n) const
Definition: ov.h:1232
octave_value_list list_value(void) const
Definition: ov.cc:1633
std::complex< float > FloatComplex
Definition: oct-cmplx.h:30
virtual bool fast_elem_insert(octave_idx_type n, const octave_value &x)
Definition: ov.h:1239
PermMatrix perm_matrix_value(void) const
Definition: ov.h:843
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:820
virtual bool is_uint8_type(void) const
Definition: ov-base.h:399
void reset_indent_level(void) const
Definition: ov-base.h:796
virtual bool is_diag_matrix(void) const
Definition: ov-base.h:355
std::complex< double > Complex
Definition: oct-cmplx.h:29
octave_fcn_inline * fcn_inline_value(bool silent=false) const
Definition: ov.cc:1627
double double_value(bool frc_str_conv=false) const
Definition: ov.h:759
static bool beginning_of_line
Definition: ov-base.h:828
void release(void)
Definition: ov-base.h:782
octave_user_script * user_script_value(bool silent=false) const
Definition: ov.cc:1609
octave_uint32 uint32_scalar_value(void) const
Definition: ov.h:864
uint32NDArray uint32_array_value(void) const
Definition: ov.h:888
int length(void) const
Definition: dim-vector.h:281
uint16NDArray uint16_array_value(void) const
Definition: ov.h:885
void convert_to_row_or_column_vector(void)
Definition: ov.h:1025
octave_uint16 uint16_scalar_value(void) const
Definition: ov.h:861
octave_idx_type rows(void) const
Definition: ov-base.h:294
F77_RET_T const double * x
short int short_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:723
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
Definition: ov.h:438