comparison libinterp/octave-value/ov.h @ 15195:2fc554ffbc28

split libinterp from src * libinterp: New directory. Move all files from src directory here except Makefile.am, main.cc, main-cli.cc, mkoctfile.in.cc, mkoctfilr.in.sh, octave-config.in.cc, octave-config.in.sh. * libinterp/Makefile.am: New file, extracted from src/Makefile.am. * src/Makefile.am: Delete everything except targets and definitions needed to build and link main and utility programs. * Makefile.am (SUBDIRS): Include libinterp in the list. * autogen.sh: Run config-module.sh in libinterp/dldfcn directory, not src/dldfcn directory. * configure.ac (AC_CONFIG_SRCDIR): Use libinterp/octave.cc, not src/octave.cc. (DL_LDFLAGS, LIBOCTINTERP): Use libinterp, not src. (AC_CONFIG_FILES): Include libinterp/Makefile in the list. * find-docstring-files.sh: Look in libinterp, not src. * gui/src/Makefile.am (liboctgui_la_CPPFLAGS): Find header files in libinterp, not src.
author John W. Eaton <jwe@octave.org>
date Sat, 18 Aug 2012 16:23:39 -0400
parents src/octave-value/ov.h@8367f326fa29
children
comparison
equal deleted inserted replaced
15194:0f0b795044c3 15195:2fc554ffbc28
1 /*
2
3 Copyright (C) 1996-2012 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_value_h)
25 #define octave_value_h 1
26
27 #include <cstdlib>
28
29 #include <iosfwd>
30 #include <string>
31 #include <list>
32
33 #include "Range.h"
34 #include "data-conv.h"
35 #include "idx-vector.h"
36 #include "mach-info.h"
37 #include "mx-base.h"
38 #include "oct-alloc.h"
39 #include "oct-time.h"
40 #include "str-vec.h"
41
42 #include "oct-hdf5.h"
43 #include "oct-sort.h"
44
45 class Cell;
46 class mxArray;
47 class octave_map;
48 class octave_scalar_map;
49 class Octave_map;
50 class octave_stream;
51 class octave_function;
52 class octave_user_function;
53 class octave_fcn_handle;
54 class octave_fcn_inline;
55 class octave_value_list;
56 class octave_lvalue;
57
58 #include "ov-base.h"
59
60 // Constants.
61
62 class octave_value;
63
64 class
65 OCTINTERP_API
66 octave_value
67 {
68 public:
69
70 enum unary_op
71 {
72 op_not, // not
73 op_uplus, // uplus
74 op_uminus, // uminus
75 op_transpose, // transpose
76 op_hermitian, // ctranspose
77 op_incr,
78 op_decr,
79 num_unary_ops,
80 unknown_unary_op
81 };
82
83 enum binary_op
84 {
85 op_add, // plus
86 op_sub, // minus
87 op_mul, // mtimes
88 op_div, // mrdivide
89 op_pow, // mpower
90 op_ldiv, // mldivide
91 op_lshift,
92 op_rshift,
93 op_lt, // lt
94 op_le, // le
95 op_eq, // eq
96 op_ge, // ge
97 op_gt, // gt
98 op_ne, // ne
99 op_el_mul, // times
100 op_el_div, // rdivide
101 op_el_pow, // power
102 op_el_ldiv, // ldivide
103 op_el_and, // and
104 op_el_or, // or
105 op_struct_ref,
106 num_binary_ops,
107 unknown_binary_op
108 };
109
110 enum compound_binary_op
111 {
112 // ** compound operations **
113 op_trans_mul,
114 op_mul_trans,
115 op_herm_mul,
116 op_mul_herm,
117 op_trans_ldiv,
118 op_herm_ldiv,
119 op_el_not_and,
120 op_el_not_or,
121 op_el_and_not,
122 op_el_or_not,
123 num_compound_binary_ops,
124 unknown_compound_binary_op
125 };
126
127 enum assign_op
128 {
129 op_asn_eq,
130 op_add_eq,
131 op_sub_eq,
132 op_mul_eq,
133 op_div_eq,
134 op_ldiv_eq,
135 op_pow_eq,
136 op_lshift_eq,
137 op_rshift_eq,
138 op_el_mul_eq,
139 op_el_div_eq,
140 op_el_ldiv_eq,
141 op_el_pow_eq,
142 op_el_and_eq,
143 op_el_or_eq,
144 num_assign_ops,
145 unknown_assign_op
146 };
147
148 static binary_op assign_op_to_binary_op (assign_op);
149
150 static assign_op binary_op_to_assign_op (binary_op);
151
152 static std::string unary_op_as_string (unary_op);
153 static std::string unary_op_fcn_name (unary_op);
154
155 static std::string binary_op_as_string (binary_op);
156 static std::string binary_op_fcn_name (binary_op);
157
158 static std::string binary_op_fcn_name (compound_binary_op);
159
160 static std::string assign_op_as_string (assign_op);
161
162 static octave_value empty_conv (const std::string& type,
163 const octave_value& rhs = octave_value ());
164
165 enum magic_colon { magic_colon_t };
166
167 octave_value (void)
168 {
169 static octave_base_value nil_rep;
170 rep = &nil_rep;
171 rep->count++;
172 }
173
174 octave_value (short int i);
175 octave_value (unsigned short int i);
176 octave_value (int i);
177 octave_value (unsigned int i);
178 octave_value (long int i);
179 octave_value (unsigned long int i);
180
181 // FIXME -- these are kluges. They turn into doubles
182 // internally, which will break for very large values. We just use
183 // them to store things like 64-bit ino_t, etc, and hope that those
184 // values are never actually larger than can be represented exactly
185 // in a double.
186
187 #if defined (HAVE_LONG_LONG_INT)
188 octave_value (long long int i);
189 #endif
190 #if defined (HAVE_UNSIGNED_LONG_LONG_INT)
191 octave_value (unsigned long long int i);
192 #endif
193
194 octave_value (octave_time t);
195 octave_value (double d);
196 octave_value (float d);
197 octave_value (const Array<octave_value>& a, bool is_cs_list = false);
198 octave_value (const Cell& c, bool is_cs_list = false);
199 octave_value (const Matrix& m, const MatrixType& t = MatrixType ());
200 octave_value (const FloatMatrix& m, const MatrixType& t = MatrixType ());
201 octave_value (const NDArray& nda);
202 octave_value (const FloatNDArray& nda);
203 octave_value (const Array<double>& m);
204 octave_value (const Array<float>& m);
205 octave_value (const DiagMatrix& d);
206 octave_value (const FloatDiagMatrix& d);
207 octave_value (const RowVector& v);
208 octave_value (const FloatRowVector& v);
209 octave_value (const ColumnVector& v);
210 octave_value (const FloatColumnVector& v);
211 octave_value (const Complex& C);
212 octave_value (const FloatComplex& C);
213 octave_value (const ComplexMatrix& m, const MatrixType& t = MatrixType ());
214 octave_value (const FloatComplexMatrix& m, const MatrixType& t = MatrixType ());
215 octave_value (const ComplexNDArray& cnda);
216 octave_value (const FloatComplexNDArray& cnda);
217 octave_value (const Array<Complex>& m);
218 octave_value (const Array<FloatComplex>& m);
219 octave_value (const ComplexDiagMatrix& d);
220 octave_value (const FloatComplexDiagMatrix& d);
221 octave_value (const ComplexRowVector& v);
222 octave_value (const FloatComplexRowVector& v);
223 octave_value (const ComplexColumnVector& v);
224 octave_value (const FloatComplexColumnVector& v);
225 octave_value (const PermMatrix& p);
226 octave_value (bool b);
227 octave_value (const boolMatrix& bm, const MatrixType& t = MatrixType ());
228 octave_value (const boolNDArray& bnda);
229 octave_value (const Array<bool>& bnda);
230 octave_value (char c, char type = '\'');
231 octave_value (const char *s, char type = '\'');
232 octave_value (const std::string& s, char type = '\'');
233 octave_value (const string_vector& s, char type = '\'');
234 octave_value (const charMatrix& chm, char type = '\'');
235 octave_value (const charNDArray& chnda, char type = '\'');
236 octave_value (const Array<char>& chnda, char type = '\'');
237 octave_value (const charMatrix& chm, bool is_string,
238 char type = '\'') GCC_ATTR_DEPRECATED;
239 octave_value (const charNDArray& chnda, bool is_string,
240 char type = '\'') GCC_ATTR_DEPRECATED;
241 octave_value (const Array<char>& chnda, bool is_string,
242 char type = '\'') GCC_ATTR_DEPRECATED;
243 octave_value (const SparseMatrix& m, const MatrixType& t = MatrixType ());
244 octave_value (const Sparse<double>& m, const MatrixType& t = MatrixType ());
245 octave_value (const SparseComplexMatrix& m,
246 const MatrixType& t = MatrixType ());
247 octave_value (const Sparse<Complex>& m, const MatrixType& t = MatrixType ());
248 octave_value (const SparseBoolMatrix& bm,
249 const MatrixType& t = MatrixType ());
250 octave_value (const Sparse<bool>& m, const MatrixType& t = MatrixType ());
251 octave_value (const octave_int8& i);
252 octave_value (const octave_int16& i);
253 octave_value (const octave_int32& i);
254 octave_value (const octave_int64& i);
255 octave_value (const octave_uint8& i);
256 octave_value (const octave_uint16& i);
257 octave_value (const octave_uint32& i);
258 octave_value (const octave_uint64& i);
259 octave_value (const int8NDArray& inda);
260 octave_value (const Array<octave_int8>& inda);
261 octave_value (const int16NDArray& inda);
262 octave_value (const Array<octave_int16>& inda);
263 octave_value (const int32NDArray& inda);
264 octave_value (const Array<octave_int32>& inda);
265 octave_value (const int64NDArray& inda);
266 octave_value (const Array<octave_int64>& inda);
267 octave_value (const uint8NDArray& inda);
268 octave_value (const Array<octave_uint8>& inda);
269 octave_value (const uint16NDArray& inda);
270 octave_value (const Array<octave_uint16>& inda);
271 octave_value (const uint32NDArray& inda);
272 octave_value (const Array<octave_uint32>& inda);
273 octave_value (const uint64NDArray& inda);
274 octave_value (const Array<octave_uint64>& inda);
275 octave_value (const Array<octave_idx_type>& inda,
276 bool zero_based = false, bool cache_index = false);
277 octave_value (const Array<std::string>& cellstr);
278 octave_value (const idx_vector& idx, bool lazy = true);
279 octave_value (double base, double limit, double inc);
280 octave_value (const Range& r);
281 octave_value (const octave_map& m);
282 octave_value (const octave_scalar_map& m);
283 octave_value (const Octave_map& m);
284 octave_value (const Octave_map& m, const std::string& id,
285 const std::list<std::string>& plist);
286 octave_value (const octave_value_list& m, bool = false);
287 octave_value (octave_value::magic_colon);
288
289 octave_value (octave_base_value *new_rep, bool borrow = false);
290 octave_value (octave_base_value *new_rep, int xcount) GCC_ATTR_DEPRECATED;
291
292 // Copy constructor.
293
294 octave_value (const octave_value& a)
295 {
296 rep = a.rep;
297 rep->count++;
298 }
299
300 // This should only be called for derived types.
301
302 octave_base_value *clone (void) const;
303
304 octave_base_value *empty_clone (void) const
305 { return rep->empty_clone (); }
306
307 // Delete the representation of this constant if the count drops to
308 // zero.
309
310 ~octave_value (void)
311 {
312 if (--rep->count == 0)
313 delete rep;
314 }
315
316 void make_unique (void)
317 {
318 if (rep->count > 1)
319 {
320 octave_base_value *r = rep->unique_clone ();
321
322 if (--rep->count == 0)
323 delete rep;
324
325 rep = r;
326 }
327 }
328
329 // This uniquifies the value if it is referenced by more than a certain
330 // number of shallow copies. This is useful for optimizations where we
331 // know a certain copy, typically within a cell array, to be obsolete.
332 void make_unique (int obsolete_copies)
333 {
334 if (rep->count > obsolete_copies + 1)
335 {
336 octave_base_value *r = rep->unique_clone ();
337
338 if (--rep->count == 0)
339 delete rep;
340
341 rep = r;
342 }
343 }
344
345 // Simple assignment.
346
347 octave_value& operator = (const octave_value& a)
348 {
349 if (rep != a.rep)
350 {
351 if (--rep->count == 0)
352 delete rep;
353
354 rep = a.rep;
355 rep->count++;
356 }
357
358 return *this;
359 }
360
361 octave_idx_type get_count (void) const { return rep->count; }
362
363 octave_base_value::type_conv_info numeric_conversion_function (void) const
364 { return rep->numeric_conversion_function (); }
365
366 octave_base_value::type_conv_info numeric_demotion_function (void) const
367 { return rep->numeric_demotion_function (); }
368
369 void maybe_mutate (void);
370
371 octave_value squeeze (void) const
372 { return rep->squeeze (); }
373
374 // The result of full().
375 octave_value full_value (void) const
376 { return rep->full_value (); }
377
378 octave_base_value *try_narrowing_conversion (void)
379 { return rep->try_narrowing_conversion (); }
380
381 // Close to dims (), but can be overloaded for classes.
382 Matrix size (void)
383 { return rep->size (); }
384
385 octave_idx_type numel (const octave_value_list& idx)
386 { return rep->numel (idx); }
387
388 octave_value single_subsref (const std::string& type,
389 const octave_value_list& idx);
390
391 octave_value subsref (const std::string& type,
392 const std::list<octave_value_list>& idx)
393 { return rep->subsref (type, idx); }
394
395 octave_value subsref (const std::string& type,
396 const std::list<octave_value_list>& idx,
397 bool auto_add)
398 { return rep->subsref (type, idx, auto_add); }
399
400 octave_value_list subsref (const std::string& type,
401 const std::list<octave_value_list>& idx,
402 int nargout);
403
404 octave_value_list subsref (const std::string& type,
405 const std::list<octave_value_list>& idx,
406 int nargout,
407 const std::list<octave_lvalue> *lvalue_list);
408
409 octave_value next_subsref (const std::string& type, const
410 std::list<octave_value_list>& idx,
411 size_t skip = 1);
412
413 octave_value_list next_subsref (int nargout,
414 const std::string& type, const
415 std::list<octave_value_list>& idx,
416 size_t skip = 1);
417
418 octave_value next_subsref (bool auto_add, const std::string& type, const
419 std::list<octave_value_list>& idx,
420 size_t skip = 1);
421
422 octave_value do_index_op (const octave_value_list& idx,
423 bool resize_ok = false)
424 { return rep->do_index_op (idx, resize_ok); }
425
426 octave_value_list
427 do_multi_index_op (int nargout, const octave_value_list& idx);
428
429 octave_value_list
430 do_multi_index_op (int nargout, const octave_value_list& idx,
431 const std::list<octave_lvalue> *lvalue_list);
432
433 octave_value subsasgn (const std::string& type,
434 const std::list<octave_value_list>& idx,
435 const octave_value& rhs);
436
437 octave_value undef_subsasgn (const std::string& type,
438 const std::list<octave_value_list>& idx,
439 const octave_value& rhs);
440
441 octave_value& assign (assign_op op, const std::string& type,
442 const std::list<octave_value_list>& idx,
443 const octave_value& rhs);
444
445 octave_value& assign (assign_op, const octave_value& rhs);
446
447 idx_vector index_vector (void) const
448 { return rep->index_vector (); }
449
450 // Size.
451
452 dim_vector dims (void) const
453 { return rep->dims (); }
454
455 octave_idx_type rows (void) const { return rep->rows (); }
456
457 octave_idx_type columns (void) const { return rep->columns (); }
458
459 octave_idx_type length (void) const;
460
461 int ndims (void) const { return rep->ndims (); }
462
463 bool all_zero_dims (void) const { return dims ().all_zero (); }
464
465 octave_idx_type numel (void) const
466 { return rep->numel (); }
467
468 octave_idx_type capacity (void) const
469 { return rep->capacity (); }
470
471 size_t byte_size (void) const
472 { return rep->byte_size (); }
473
474 octave_idx_type nnz (void) const { return rep->nnz (); }
475
476 octave_idx_type nzmax (void) const { return rep->nzmax (); }
477
478 octave_idx_type nfields (void) const { return rep->nfields (); }
479
480 octave_value reshape (const dim_vector& dv) const
481 { return rep->reshape (dv); }
482
483 octave_value permute (const Array<int>& vec, bool inv = false) const
484 { return rep->permute (vec, inv); }
485
486 octave_value ipermute (const Array<int>& vec) const
487 { return rep->permute (vec, true); }
488
489 octave_value resize (const dim_vector& dv, bool fill = false) const
490 { return rep->resize (dv, fill);}
491
492 MatrixType matrix_type (void) const
493 { return rep->matrix_type (); }
494
495 MatrixType matrix_type (const MatrixType& typ) const
496 { return rep->matrix_type (typ); }
497
498 // Does this constant have a type? Both of these are provided since
499 // it is sometimes more natural to write is_undefined() instead of
500 // ! is_defined().
501
502 bool is_defined (void) const
503 { return rep->is_defined (); }
504
505 bool is_undefined (void) const
506 { return ! is_defined (); }
507
508 bool is_empty (void) const
509 { return rep->is_empty (); }
510
511 bool is_cell (void) const
512 { return rep->is_cell (); }
513
514 bool is_cellstr (void) const
515 { return rep->is_cellstr (); }
516
517 bool is_real_scalar (void) const
518 { return rep->is_real_scalar (); }
519
520 bool is_real_matrix (void) const
521 { return rep->is_real_matrix (); }
522
523 bool is_complex_scalar (void) const
524 { return rep->is_complex_scalar (); }
525
526 bool is_complex_matrix (void) const
527 { return rep->is_complex_matrix (); }
528
529 bool is_bool_scalar (void) const
530 { return rep->is_bool_scalar (); }
531
532 bool is_bool_matrix (void) const
533 { return rep->is_bool_matrix (); }
534
535 bool is_char_matrix (void) const
536 { return rep->is_char_matrix (); }
537
538 bool is_diag_matrix (void) const
539 { return rep->is_diag_matrix (); }
540
541 bool is_perm_matrix (void) const
542 { return rep->is_perm_matrix (); }
543
544 bool is_string (void) const
545 { return rep->is_string (); }
546
547 bool is_sq_string (void) const
548 { return rep->is_sq_string (); }
549
550 bool is_dq_string (void) const
551 { return rep->is_string () && ! rep->is_sq_string (); }
552
553 bool is_range (void) const
554 { return rep->is_range (); }
555
556 bool is_map (void) const
557 { return rep->is_map (); }
558
559 bool is_object (void) const
560 { return rep->is_object (); }
561
562 bool is_cs_list (void) const
563 { return rep->is_cs_list (); }
564
565 bool is_magic_colon (void) const
566 { return rep->is_magic_colon (); }
567
568 bool is_null_value (void) const
569 { return rep->is_null_value (); }
570
571 // Are any or all of the elements in this constant nonzero?
572
573 octave_value all (int dim = 0) const
574 { return rep->all (dim); }
575
576 octave_value any (int dim = 0) const
577 { return rep->any (dim); }
578
579 builtin_type_t builtin_type (void) const
580 { return rep->builtin_type (); }
581
582 // Floating point types.
583
584 bool is_double_type (void) const
585 { return rep->is_double_type (); }
586
587 bool is_single_type (void) const
588 { return rep->is_single_type (); }
589
590 bool is_float_type (void) const
591 { return rep->is_float_type (); }
592
593 // Integer types.
594
595 bool is_int8_type (void) const
596 { return rep->is_int8_type (); }
597
598 bool is_int16_type (void) const
599 { return rep->is_int16_type (); }
600
601 bool is_int32_type (void) const
602 { return rep->is_int32_type (); }
603
604 bool is_int64_type (void) const
605 { return rep->is_int64_type (); }
606
607 bool is_uint8_type (void) const
608 { return rep->is_uint8_type (); }
609
610 bool is_uint16_type (void) const
611 { return rep->is_uint16_type (); }
612
613 bool is_uint32_type (void) const
614 { return rep->is_uint32_type (); }
615
616 bool is_uint64_type (void) const
617 { return rep->is_uint64_type (); }
618
619 // Other type stuff.
620
621 bool is_bool_type (void) const
622 { return rep->is_bool_type (); }
623
624 bool is_integer_type (void) const
625 { return rep->is_integer_type (); }
626
627 bool is_real_type (void) const
628 { return rep->is_real_type (); }
629
630 bool is_complex_type (void) const
631 { return rep->is_complex_type (); }
632
633 bool is_scalar_type (void) const
634 { return rep->is_scalar_type (); }
635
636 bool is_matrix_type (void) const
637 { return rep->is_matrix_type (); }
638
639 bool is_numeric_type (void) const
640 { return rep->is_numeric_type (); }
641
642 bool is_sparse_type (void) const
643 { return rep->is_sparse_type (); }
644
645 // Does this constant correspond to a truth value?
646
647 bool is_true (void) const
648 { return rep->is_true (); }
649
650 // Do two constants match (in a switch statement)?
651
652 bool is_equal (const octave_value&) const;
653
654 // Are the dimensions of this constant zero by zero?
655
656 bool is_zero_by_zero (void) const
657 { return (rows () == 0 && columns () == 0); }
658
659 bool is_constant (void) const
660 { return rep->is_constant (); }
661
662 bool is_function_handle (void) const
663 { return rep->is_function_handle (); }
664
665 bool is_anonymous_function (void) const
666 { return rep->is_anonymous_function (); }
667
668 bool is_inline_function (void) const
669 { return rep->is_inline_function (); }
670
671 bool is_function (void) const
672 { return rep->is_function (); }
673
674 bool is_user_script (void) const
675 { return rep->is_user_script (); }
676
677 bool is_user_function (void) const
678 { return rep->is_user_function (); }
679
680 bool is_user_code (void) const
681 { return rep->is_user_code (); }
682
683 bool is_builtin_function (void) const
684 { return rep->is_builtin_function (); }
685
686 bool is_dld_function (void) const
687 { return rep->is_dld_function (); }
688
689 bool is_mex_function (void) const
690 { return rep->is_mex_function (); }
691
692 void erase_subfunctions (void) { rep->erase_subfunctions (); }
693
694 // Values.
695
696 octave_value eval (void) { return *this; }
697
698 short int
699 short_value (bool req_int = false, bool frc_str_conv = false) const
700 { return rep->short_value (req_int, frc_str_conv); }
701
702 unsigned short int
703 ushort_value (bool req_int = false, bool frc_str_conv = false) const
704 { return rep->ushort_value (req_int, frc_str_conv); }
705
706 int int_value (bool req_int = false, bool frc_str_conv = false) const
707 { return rep->int_value (req_int, frc_str_conv); }
708
709 unsigned int
710 uint_value (bool req_int = false, bool frc_str_conv = false) const
711 { return rep->uint_value (req_int, frc_str_conv); }
712
713 int nint_value (bool frc_str_conv = false) const
714 { return rep->nint_value (frc_str_conv); }
715
716 long int
717 long_value (bool req_int = false, bool frc_str_conv = false) const
718 { return rep->long_value (req_int, frc_str_conv); }
719
720 unsigned long int
721 ulong_value (bool req_int = false, bool frc_str_conv = false) const
722 { return rep->ulong_value (req_int, frc_str_conv); }
723
724 octave_idx_type
725 idx_type_value (bool req_int = false, bool frc_str_conv = false) const;
726
727 double double_value (bool frc_str_conv = false) const
728 { return rep->double_value (frc_str_conv); }
729
730 float float_value (bool frc_str_conv = false) const
731 { return rep->float_value (frc_str_conv); }
732
733 double scalar_value (bool frc_str_conv = false) const
734 { return rep->scalar_value (frc_str_conv); }
735
736 float float_scalar_value (bool frc_str_conv = false) const
737 { return rep->float_scalar_value (frc_str_conv); }
738
739 Cell cell_value (void) const;
740
741 Matrix matrix_value (bool frc_str_conv = false) const
742 { return rep->matrix_value (frc_str_conv); }
743
744 FloatMatrix float_matrix_value (bool frc_str_conv = false) const
745 { return rep->float_matrix_value (frc_str_conv); }
746
747 NDArray array_value (bool frc_str_conv = false) const
748 { return rep->array_value (frc_str_conv); }
749
750 FloatNDArray float_array_value (bool frc_str_conv = false) const
751 { return rep->float_array_value (frc_str_conv); }
752
753 Complex complex_value (bool frc_str_conv = false) const
754 { return rep->complex_value (frc_str_conv); }
755
756 FloatComplex float_complex_value (bool frc_str_conv = false) const
757 { return rep->float_complex_value (frc_str_conv); }
758
759 ComplexMatrix complex_matrix_value (bool frc_str_conv = false) const
760 { return rep->complex_matrix_value (frc_str_conv); }
761
762 FloatComplexMatrix float_complex_matrix_value (bool frc_str_conv = false) const
763 { return rep->float_complex_matrix_value (frc_str_conv); }
764
765 ComplexNDArray complex_array_value (bool frc_str_conv = false) const
766 { return rep->complex_array_value (frc_str_conv); }
767
768 FloatComplexNDArray float_complex_array_value (bool frc_str_conv = false) const
769 { return rep->float_complex_array_value (frc_str_conv); }
770
771 bool bool_value (bool warn = false) const
772 { return rep->bool_value (warn); }
773
774 boolMatrix bool_matrix_value (bool warn = false) const
775 { return rep->bool_matrix_value (warn); }
776
777 boolNDArray bool_array_value (bool warn = false) const
778 { return rep->bool_array_value (warn); }
779
780 charMatrix char_matrix_value (bool frc_str_conv = false) const
781 { return rep->char_matrix_value (frc_str_conv); }
782
783 charNDArray char_array_value (bool frc_str_conv = false) const
784 { return rep->char_array_value (frc_str_conv); }
785
786 SparseMatrix sparse_matrix_value (bool frc_str_conv = false) const
787 { return rep->sparse_matrix_value (frc_str_conv); }
788
789 SparseComplexMatrix sparse_complex_matrix_value (bool frc_str_conv = false) const
790 { return rep->sparse_complex_matrix_value (frc_str_conv); }
791
792 SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const
793 { return rep->sparse_bool_matrix_value (warn); }
794
795 DiagMatrix diag_matrix_value (bool force = false) const
796 { return rep->diag_matrix_value (force); }
797
798 FloatDiagMatrix float_diag_matrix_value (bool force = false) const
799 { return rep->float_diag_matrix_value (force); }
800
801 ComplexDiagMatrix complex_diag_matrix_value (bool force = false) const
802 { return rep->complex_diag_matrix_value (force); }
803
804 FloatComplexDiagMatrix float_complex_diag_matrix_value (bool force = false) const
805 { return rep->float_complex_diag_matrix_value (force); }
806
807 PermMatrix perm_matrix_value (void) const
808 { return rep->perm_matrix_value (); }
809
810 octave_int8 int8_scalar_value (void) const
811 { return rep->int8_scalar_value (); }
812
813 octave_int16 int16_scalar_value (void) const
814 { return rep->int16_scalar_value (); }
815
816 octave_int32 int32_scalar_value (void) const
817 { return rep->int32_scalar_value (); }
818
819 octave_int64 int64_scalar_value (void) const
820 { return rep->int64_scalar_value (); }
821
822 octave_uint8 uint8_scalar_value (void) const
823 { return rep->uint8_scalar_value (); }
824
825 octave_uint16 uint16_scalar_value (void) const
826 { return rep->uint16_scalar_value (); }
827
828 octave_uint32 uint32_scalar_value (void) const
829 { return rep->uint32_scalar_value (); }
830
831 octave_uint64 uint64_scalar_value (void) const
832 { return rep->uint64_scalar_value (); }
833
834 int8NDArray int8_array_value (void) const
835 { return rep->int8_array_value (); }
836
837 int16NDArray int16_array_value (void) const
838 { return rep->int16_array_value (); }
839
840 int32NDArray int32_array_value (void) const
841 { return rep->int32_array_value (); }
842
843 int64NDArray int64_array_value (void) const
844 { return rep->int64_array_value (); }
845
846 uint8NDArray uint8_array_value (void) const
847 { return rep->uint8_array_value (); }
848
849 uint16NDArray uint16_array_value (void) const
850 { return rep->uint16_array_value (); }
851
852 uint32NDArray uint32_array_value (void) const
853 { return rep->uint32_array_value (); }
854
855 uint64NDArray uint64_array_value (void) const
856 { return rep->uint64_array_value (); }
857
858 string_vector all_strings (bool pad = false) const
859 { return rep->all_strings (pad); }
860
861 std::string string_value (bool force = false) const
862 { return rep->string_value (force); }
863
864 Array<std::string> cellstr_value (void) const
865 { return rep->cellstr_value (); }
866
867 Range range_value (void) const
868 { return rep->range_value (); }
869
870 octave_map map_value (void) const;
871
872 octave_scalar_map scalar_map_value (void) const;
873
874 string_vector map_keys (void) const
875 { return rep->map_keys (); }
876
877 size_t nparents (void) const
878 { return rep->nparents (); }
879
880 std::list<std::string> parent_class_name_list (void) const
881 { return rep->parent_class_name_list (); }
882
883 string_vector parent_class_names (void) const
884 { return rep->parent_class_names (); }
885
886 octave_base_value *
887 find_parent_class (const std::string& parent_class_name)
888 { return rep->find_parent_class (parent_class_name); }
889
890 octave_function *function_value (bool silent = false) const;
891
892 octave_user_function *user_function_value (bool silent = false) const;
893
894 octave_user_script *user_script_value (bool silent = false) const;
895
896 octave_user_code *user_code_value (bool silent = false) const;
897
898 octave_fcn_handle *fcn_handle_value (bool silent = false) const;
899
900 octave_fcn_inline *fcn_inline_value (bool silent = false) const;
901
902 octave_value_list list_value (void) const;
903
904 ColumnVector column_vector_value (bool frc_str_conv = false,
905 bool frc_vec_conv = false) const;
906
907 ComplexColumnVector
908 complex_column_vector_value (bool frc_str_conv = false,
909 bool frc_vec_conv = false) const;
910
911 RowVector row_vector_value (bool frc_str_conv = false,
912 bool frc_vec_conv = false) const;
913
914 ComplexRowVector
915 complex_row_vector_value (bool frc_str_conv = false,
916 bool frc_vec_conv = false) const;
917
918
919 FloatColumnVector float_column_vector_value (bool frc_str_conv = false,
920 bool frc_vec_conv = false) const;
921
922 FloatComplexColumnVector
923 float_complex_column_vector_value (bool frc_str_conv = false,
924 bool frc_vec_conv = false) const;
925
926 FloatRowVector float_row_vector_value (bool frc_str_conv = false,
927 bool frc_vec_conv = false) const;
928
929 FloatComplexRowVector
930 float_complex_row_vector_value (bool frc_str_conv = false,
931 bool frc_vec_conv = false) const;
932
933
934
935
936 Array<int> int_vector_value (bool req_int = false,
937 bool frc_str_conv = false,
938 bool frc_vec_conv = false) const;
939
940 Array<octave_idx_type>
941 octave_idx_type_vector_value (bool req_int = false,
942 bool frc_str_conv = false,
943 bool frc_vec_conv = false) const;
944
945 Array<double> vector_value (bool frc_str_conv = false,
946 bool frc_vec_conv = false) const;
947
948 Array<Complex> complex_vector_value (bool frc_str_conv = false,
949 bool frc_vec_conv = false) const;
950
951 Array<float> float_vector_value (bool frc_str_conv = false,
952 bool frc_vec_conv = false) const;
953
954 Array<FloatComplex> float_complex_vector_value (bool frc_str_conv = false,
955 bool frc_vec_conv = false) const;
956
957 // Possibly economize a lazy-indexed value.
958
959 void maybe_economize (void)
960 { rep->maybe_economize (); }
961
962 // The following two hook conversions are called on any octave_value prior to
963 // storing it to a "permanent" location, like a named variable, a cell or a
964 // struct component, or a return value of a function.
965
966 octave_value storable_value (void) const;
967
968 // Ditto, but in place, i.e. equivalent to *this = this->storable_value (),
969 // but possibly more efficient.
970
971 void make_storable_value (void);
972
973 // Conversions. These should probably be private. If a user of this
974 // class wants a certain kind of constant, he should simply ask for
975 // it, and we should convert it if possible.
976
977 octave_value convert_to_str (bool pad = false, bool force = false,
978 char type = '\'') const
979 { return rep->convert_to_str (pad, force, type); }
980
981 octave_value
982 convert_to_str_internal (bool pad, bool force, char type) const
983 { return rep->convert_to_str_internal (pad, force, type); }
984
985 void convert_to_row_or_column_vector (void)
986 { rep->convert_to_row_or_column_vector (); }
987
988 bool print_as_scalar (void) const
989 { return rep->print_as_scalar (); }
990
991 void print (std::ostream& os, bool pr_as_read_syntax = false) const
992 { rep->print (os, pr_as_read_syntax); }
993
994 void print_raw (std::ostream& os,
995 bool pr_as_read_syntax = false) const
996 { rep->print_raw (os, pr_as_read_syntax); }
997
998 bool print_name_tag (std::ostream& os, const std::string& name) const
999 { return rep->print_name_tag (os, name); }
1000
1001 void print_with_name (std::ostream& os, const std::string& name) const
1002 { rep->print_with_name (os, name, true); }
1003
1004 int type_id (void) const { return rep->type_id (); }
1005
1006 std::string type_name (void) const { return rep->type_name (); }
1007
1008 std::string class_name (void) const { return rep->class_name (); }
1009
1010 // Unary and binary operations.
1011
1012 friend OCTINTERP_API octave_value do_unary_op (unary_op op,
1013 const octave_value& a);
1014
1015 octave_value& do_non_const_unary_op (unary_op op);
1016
1017 octave_value& do_non_const_unary_op (unary_op op, const std::string& type,
1018 const std::list<octave_value_list>& idx);
1019
1020 friend OCTINTERP_API octave_value do_binary_op (binary_op op,
1021 const octave_value& a,
1022 const octave_value& b);
1023
1024 friend OCTINTERP_API octave_value do_binary_op (compound_binary_op op,
1025 const octave_value& a,
1026 const octave_value& b);
1027
1028 friend OCTINTERP_API octave_value do_cat_op (const octave_value& a,
1029 const octave_value& b,
1030 const Array<octave_idx_type>& ra_idx);
1031
1032 const octave_base_value& get_rep (void) const { return *rep; }
1033
1034 bool is_copy_of (const octave_value &val) const { return rep == val.rep; }
1035
1036 void print_info (std::ostream& os,
1037 const std::string& prefix = std::string ()) const;
1038
1039 bool save_ascii (std::ostream& os) { return rep->save_ascii (os); }
1040
1041 bool load_ascii (std::istream& is) { return rep->load_ascii (is); }
1042
1043 bool save_binary (std::ostream& os, bool& save_as_floats)
1044 { return rep->save_binary (os, save_as_floats); }
1045
1046 bool load_binary (std::istream& is, bool swap,
1047 oct_mach_info::float_format fmt)
1048 { return rep->load_binary (is, swap, fmt); }
1049
1050 #if defined (HAVE_HDF5)
1051 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats)
1052 { return rep->save_hdf5 (loc_id, name, save_as_floats); }
1053
1054 bool load_hdf5 (hid_t loc_id, const char *name)
1055 { return rep->load_hdf5 (loc_id, name); }
1056 #endif
1057
1058 int write (octave_stream& os, int block_size,
1059 oct_data_conv::data_type output_type, int skip,
1060 oct_mach_info::float_format flt_fmt) const;
1061
1062 octave_base_value *internal_rep (void) const { return rep; }
1063
1064 // Unsafe. These functions exist to support the MEX interface.
1065 // You should not use them anywhere else.
1066 void *mex_get_data (void) const { return rep->mex_get_data (); }
1067
1068 octave_idx_type *mex_get_ir (void) const { return rep->mex_get_ir (); }
1069
1070 octave_idx_type *mex_get_jc (void) const { return rep->mex_get_jc (); }
1071
1072 mxArray *as_mxArray (void) const { return rep->as_mxArray (); }
1073
1074 octave_value diag (octave_idx_type k = 0) const
1075 { return rep->diag (k); }
1076
1077 octave_value diag (octave_idx_type m, octave_idx_type n) const
1078 { return rep->diag (m, n); }
1079
1080 octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
1081 { return rep->sort (dim, mode); }
1082 octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
1083 sortmode mode = ASCENDING) const
1084 { return rep->sort (sidx, dim, mode); }
1085
1086 sortmode is_sorted (sortmode mode = UNSORTED) const
1087 { return rep->is_sorted (mode); }
1088
1089 Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const
1090 { return rep->sort_rows_idx (mode); }
1091
1092 sortmode is_sorted_rows (sortmode mode = UNSORTED) const
1093 { return rep->is_sorted_rows (mode); }
1094
1095 void lock (void) { rep->lock (); }
1096
1097 void unlock (void) { rep->unlock (); }
1098
1099 bool islocked (void) const { return rep->islocked (); }
1100
1101 void dump (std::ostream& os) const { rep->dump (os); }
1102
1103 #define MAPPER_FORWARD(F) \
1104 octave_value F (void) const { return rep->map (octave_base_value::umap_ ## F); }
1105
1106 MAPPER_FORWARD (abs)
1107 MAPPER_FORWARD (acos)
1108 MAPPER_FORWARD (acosh)
1109 MAPPER_FORWARD (angle)
1110 MAPPER_FORWARD (arg)
1111 MAPPER_FORWARD (asin)
1112 MAPPER_FORWARD (asinh)
1113 MAPPER_FORWARD (atan)
1114 MAPPER_FORWARD (atanh)
1115 MAPPER_FORWARD (cbrt)
1116 MAPPER_FORWARD (ceil)
1117 MAPPER_FORWARD (conj)
1118 MAPPER_FORWARD (cos)
1119 MAPPER_FORWARD (cosh)
1120 MAPPER_FORWARD (erf)
1121 MAPPER_FORWARD (erfinv)
1122 MAPPER_FORWARD (erfcinv)
1123 MAPPER_FORWARD (erfc)
1124 MAPPER_FORWARD (erfcx)
1125 MAPPER_FORWARD (exp)
1126 MAPPER_FORWARD (expm1)
1127 MAPPER_FORWARD (finite)
1128 MAPPER_FORWARD (fix)
1129 MAPPER_FORWARD (floor)
1130 MAPPER_FORWARD (gamma)
1131 MAPPER_FORWARD (imag)
1132 MAPPER_FORWARD (isinf)
1133 MAPPER_FORWARD (isna)
1134 MAPPER_FORWARD (isnan)
1135 MAPPER_FORWARD (lgamma)
1136 MAPPER_FORWARD (log)
1137 MAPPER_FORWARD (log2)
1138 MAPPER_FORWARD (log10)
1139 MAPPER_FORWARD (log1p)
1140 MAPPER_FORWARD (real)
1141 MAPPER_FORWARD (round)
1142 MAPPER_FORWARD (roundb)
1143 MAPPER_FORWARD (signum)
1144 MAPPER_FORWARD (sin)
1145 MAPPER_FORWARD (sinh)
1146 MAPPER_FORWARD (sqrt)
1147 MAPPER_FORWARD (tan)
1148 MAPPER_FORWARD (tanh)
1149
1150 // These functions are prefixed with X to avoid potential macro
1151 // conflicts.
1152
1153 MAPPER_FORWARD (xisalnum)
1154 MAPPER_FORWARD (xisalpha)
1155 MAPPER_FORWARD (xisascii)
1156 MAPPER_FORWARD (xiscntrl)
1157 MAPPER_FORWARD (xisdigit)
1158 MAPPER_FORWARD (xisgraph)
1159 MAPPER_FORWARD (xislower)
1160 MAPPER_FORWARD (xisprint)
1161 MAPPER_FORWARD (xispunct)
1162 MAPPER_FORWARD (xisspace)
1163 MAPPER_FORWARD (xisupper)
1164 MAPPER_FORWARD (xisxdigit)
1165 MAPPER_FORWARD (xtoascii)
1166 MAPPER_FORWARD (xtolower)
1167 MAPPER_FORWARD (xtoupper)
1168
1169 #undef MAPPER_FORWARD
1170
1171 octave_value map (octave_base_value::unary_mapper_t umap) const
1172 { return rep->map (umap); }
1173
1174 // Extract the n-th element, aka val(n). Result is undefined if val is not an
1175 // array type or n is out of range. Never error.
1176 octave_value
1177 fast_elem_extract (octave_idx_type n) const
1178 { return rep->fast_elem_extract (n); }
1179
1180 // Assign the n-th element, aka val(n) = x. Returns false if val is not an
1181 // array type, x is not a matching scalar type, or n is out of range.
1182 // Never error.
1183 virtual bool
1184 fast_elem_insert (octave_idx_type n, const octave_value& x)
1185 {
1186 make_unique ();
1187 return rep->fast_elem_insert (n, x);
1188 }
1189
1190 protected:
1191
1192 // The real representation.
1193 octave_base_value *rep;
1194
1195 private:
1196
1197 assign_op unary_op_to_assign_op (unary_op op);
1198
1199 binary_op op_eq_to_binary_op (assign_op op);
1200
1201 // This declaration protects against constructing octave_value from
1202 // const octave_base_value* which actually silently calls octave_value (bool).
1203 octave_value (const octave_base_value *);
1204
1205 DECLARE_OCTAVE_ALLOCATOR
1206 };
1207
1208 // Publish externally used friend functions.
1209
1210 extern OCTINTERP_API octave_value
1211 do_unary_op (octave_value::unary_op op, const octave_value& a);
1212
1213 extern OCTINTERP_API octave_value
1214 do_binary_op (octave_value::binary_op op,
1215 const octave_value& a, const octave_value& b);
1216
1217 extern OCTINTERP_API octave_value
1218 do_binary_op (octave_value::compound_binary_op op,
1219 const octave_value& a, const octave_value& b);
1220
1221 #define OV_UNOP_FN(name) \
1222 inline octave_value \
1223 name (const octave_value& a) \
1224 { \
1225 return do_unary_op (octave_value::name, a); \
1226 }
1227
1228 #define OV_UNOP_OP(name, op) \
1229 inline octave_value \
1230 operator op (const octave_value& a) \
1231 { \
1232 return name (a); \
1233 }
1234
1235 #define OV_UNOP_FN_OP(name, op) \
1236 OV_UNOP_FN (name) \
1237 OV_UNOP_OP (name, op)
1238
1239 OV_UNOP_FN_OP (op_not, !)
1240 OV_UNOP_FN_OP (op_uplus, +)
1241 OV_UNOP_FN_OP (op_uminus, -)
1242
1243 OV_UNOP_FN (op_transpose)
1244 OV_UNOP_FN (op_hermitian)
1245
1246 // No simple way to define these for prefix and suffix ops?
1247 //
1248 // incr
1249 // decr
1250
1251 #define OV_BINOP_FN(name) \
1252 inline octave_value \
1253 name (const octave_value& a1, const octave_value& a2) \
1254 { \
1255 return do_binary_op (octave_value::name, a1, a2); \
1256 }
1257
1258 #define OV_BINOP_OP(name, op) \
1259 inline octave_value \
1260 operator op (const octave_value& a1, const octave_value& a2) \
1261 { \
1262 return name (a1, a2); \
1263 }
1264
1265 #define OV_BINOP_FN_OP(name, op) \
1266 OV_BINOP_FN (name) \
1267 OV_BINOP_OP (name, op)
1268
1269 OV_BINOP_FN_OP (op_add, +)
1270 OV_BINOP_FN_OP (op_sub, -)
1271 OV_BINOP_FN_OP (op_mul, *)
1272 OV_BINOP_FN_OP (op_div, /)
1273
1274 OV_BINOP_FN (op_pow)
1275 OV_BINOP_FN (op_ldiv)
1276 OV_BINOP_FN (op_lshift)
1277 OV_BINOP_FN (op_rshift)
1278
1279 OV_BINOP_FN_OP (op_lt, <)
1280 OV_BINOP_FN_OP (op_le, <=)
1281 OV_BINOP_FN_OP (op_eq, ==)
1282 OV_BINOP_FN_OP (op_ge, >=)
1283 OV_BINOP_FN_OP (op_gt, >)
1284 OV_BINOP_FN_OP (op_ne, !=)
1285
1286 OV_BINOP_FN (op_el_mul)
1287 OV_BINOP_FN (op_el_div)
1288 OV_BINOP_FN (op_el_pow)
1289 OV_BINOP_FN (op_el_ldiv)
1290 OV_BINOP_FN (op_el_and)
1291 OV_BINOP_FN (op_el_or)
1292
1293 OV_BINOP_FN (op_struct_ref)
1294
1295 #define OV_COMP_BINOP_FN(name) \
1296 inline octave_value \
1297 name (const octave_value& a1, const octave_value& a2) \
1298 { \
1299 return do_binary_op (octave_value::name, a1, a2); \
1300 }
1301
1302 OV_COMP_BINOP_FN (op_trans_mul)
1303 OV_COMP_BINOP_FN (op_mul_trans)
1304 OV_COMP_BINOP_FN (op_herm_mul)
1305 OV_COMP_BINOP_FN (op_mul_herm)
1306
1307 extern OCTINTERP_API void install_types (void);
1308
1309 // This will eventually go away, but for now it can be used to
1310 // simplify the transition to the new octave_value class hierarchy,
1311 // which uses octave_base_value instead of octave_value for the type
1312 // of octave_value::rep.
1313 #define OV_REP_TYPE octave_base_value
1314
1315 // Templated value extractors.
1316 template<class Value>
1317 inline Value octave_value_extract (const octave_value&)
1318 { assert (false); }
1319
1320 #define DEF_VALUE_EXTRACTOR(VALUE,MPREFIX) \
1321 template<> \
1322 inline VALUE octave_value_extract<VALUE> (const octave_value& v) \
1323 { return v.MPREFIX ## _value (); }
1324
1325 DEF_VALUE_EXTRACTOR (double, scalar)
1326 DEF_VALUE_EXTRACTOR (float, float_scalar)
1327 DEF_VALUE_EXTRACTOR (Complex, complex)
1328 DEF_VALUE_EXTRACTOR (FloatComplex, float_complex)
1329 DEF_VALUE_EXTRACTOR (bool, bool)
1330
1331 DEF_VALUE_EXTRACTOR (octave_int8, int8_scalar)
1332 DEF_VALUE_EXTRACTOR (octave_int16, int16_scalar)
1333 DEF_VALUE_EXTRACTOR (octave_int32, int32_scalar)
1334 DEF_VALUE_EXTRACTOR (octave_int64, int64_scalar)
1335 DEF_VALUE_EXTRACTOR (octave_uint8, uint8_scalar)
1336 DEF_VALUE_EXTRACTOR (octave_uint16, uint16_scalar)
1337 DEF_VALUE_EXTRACTOR (octave_uint32, uint32_scalar)
1338 DEF_VALUE_EXTRACTOR (octave_uint64, uint64_scalar)
1339
1340
1341 DEF_VALUE_EXTRACTOR (NDArray, array)
1342 DEF_VALUE_EXTRACTOR (FloatNDArray, float_array)
1343 DEF_VALUE_EXTRACTOR (ComplexNDArray, complex_array)
1344 DEF_VALUE_EXTRACTOR (FloatComplexNDArray, float_complex_array)
1345 DEF_VALUE_EXTRACTOR (boolNDArray, bool_array)
1346
1347 DEF_VALUE_EXTRACTOR (charNDArray, char_array)
1348 DEF_VALUE_EXTRACTOR (int8NDArray, int8_array)
1349 DEF_VALUE_EXTRACTOR (int16NDArray, int16_array)
1350 DEF_VALUE_EXTRACTOR (int32NDArray, int32_array)
1351 DEF_VALUE_EXTRACTOR (int64NDArray, int64_array)
1352 DEF_VALUE_EXTRACTOR (uint8NDArray, uint8_array)
1353 DEF_VALUE_EXTRACTOR (uint16NDArray, uint16_array)
1354 DEF_VALUE_EXTRACTOR (uint32NDArray, uint32_array)
1355 DEF_VALUE_EXTRACTOR (uint64NDArray, uint64_array)
1356
1357 DEF_VALUE_EXTRACTOR (Matrix, matrix)
1358 DEF_VALUE_EXTRACTOR (FloatMatrix, float_matrix)
1359 DEF_VALUE_EXTRACTOR (ComplexMatrix, complex_matrix)
1360 DEF_VALUE_EXTRACTOR (FloatComplexMatrix, float_complex_matrix)
1361 DEF_VALUE_EXTRACTOR (boolMatrix, bool_matrix)
1362
1363 DEF_VALUE_EXTRACTOR (ColumnVector, column_vector)
1364 DEF_VALUE_EXTRACTOR (FloatColumnVector, float_column_vector)
1365 DEF_VALUE_EXTRACTOR (ComplexColumnVector, complex_column_vector)
1366 DEF_VALUE_EXTRACTOR (FloatComplexColumnVector, float_complex_column_vector)
1367
1368 DEF_VALUE_EXTRACTOR (RowVector, row_vector)
1369 DEF_VALUE_EXTRACTOR (FloatRowVector, float_row_vector)
1370 DEF_VALUE_EXTRACTOR (ComplexRowVector, complex_row_vector)
1371 DEF_VALUE_EXTRACTOR (FloatComplexRowVector, float_complex_row_vector)
1372
1373 DEF_VALUE_EXTRACTOR (DiagMatrix, diag_matrix)
1374 DEF_VALUE_EXTRACTOR (FloatDiagMatrix, float_diag_matrix)
1375 DEF_VALUE_EXTRACTOR (ComplexDiagMatrix, complex_diag_matrix)
1376 DEF_VALUE_EXTRACTOR (FloatComplexDiagMatrix, float_complex_diag_matrix)
1377 DEF_VALUE_EXTRACTOR (PermMatrix, perm_matrix)
1378
1379 DEF_VALUE_EXTRACTOR (SparseMatrix, sparse_matrix)
1380 DEF_VALUE_EXTRACTOR (SparseComplexMatrix, sparse_complex_matrix)
1381 DEF_VALUE_EXTRACTOR (SparseBoolMatrix, sparse_bool_matrix)
1382 #undef DEF_VALUE_EXTRACTOR
1383
1384 #define DEF_DUMMY_VALUE_EXTRACTOR(VALUE,DEFVAL) \
1385 template<> \
1386 inline VALUE octave_value_extract<VALUE> (const octave_value&) \
1387 { assert (false); return DEFVAL; }
1388
1389 DEF_DUMMY_VALUE_EXTRACTOR (char, 0)
1390 DEF_DUMMY_VALUE_EXTRACTOR (octave_value, octave_value ())
1391 #undef DEF_DUMMY_VALUE_EXTRACTOR
1392
1393 #endif