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