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