Mercurial > octave-nkf
annotate src/ov-base.h @ 8345:c777f3ce02d8
smarter conversion lookup
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 25 Nov 2008 14:04:55 +0100 |
parents | 283989f2da9b |
children | 8b1a2555c4e2 |
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_base_value_h) | |
25 #define octave_base_value_h 1 | |
26 | |
27 #include <cstdlib> | |
28 | |
3503 | 29 #include <iostream> |
5759 | 30 #include <list> |
2376 | 31 #include <string> |
32 | |
5759 | 33 #if defined (HAVE_HDF5) |
34 #include <hdf5.h> | |
35 #endif | |
36 | |
37 #include "Range.h" | |
5828 | 38 #include "data-conv.h" |
5900 | 39 #include "mxarray.h" |
2376 | 40 #include "mx-base.h" |
41 #include "str-vec.h" | |
42 | |
43 #include "error.h" | |
44 | |
3351 | 45 class Cell; |
2376 | 46 class Octave_map; |
5759 | 47 class octave_value; |
2376 | 48 class octave_value_list; |
5759 | 49 class octave_stream; |
50 class octave_function; | |
51 class octave_user_function; | |
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
|
52 class octave_user_script; |
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
|
53 class octave_user_code; |
5759 | 54 class octave_fcn_handle; |
55 class octave_fcn_inline; | |
56 class octave_value_list; | |
57 class octave_lvalue; | |
2376 | 58 |
59 class tree_walker; | |
60 | |
5759 | 61 // T_ID is the type id of struct objects, set by register_type(). |
62 // T_NAME is the type name of struct objects. | |
7067 | 63 |
5759 | 64 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA \ |
7066 | 65 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2 (OCTAVE_EMPTY_CPP_ARG) |
5759 | 66 |
67 #define DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA \ | |
68 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(virtual) | |
69 | |
70 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(VIRTUAL) \ | |
71 public: \ | |
72 VIRTUAL int type_id (void) const { return t_id; } \ | |
73 VIRTUAL std::string type_name (void) const { return t_name; } \ | |
74 VIRTUAL std::string class_name (void) const { return c_name; } \ | |
75 static int static_type_id (void) { return t_id; } \ | |
76 static std::string static_type_name (void) { return t_name; } \ | |
77 static std::string static_class_name (void) { return c_name; } \ | |
78 static void register_type (void); \ | |
79 \ | |
80 private: \ | |
81 static int t_id; \ | |
82 static const std::string t_name; \ | |
83 static const std::string c_name; | |
84 | |
85 | |
86 #define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c) \ | |
87 int t::t_id (-1); \ | |
88 const std::string t::t_name (n); \ | |
89 const std::string t::c_name (c); \ | |
90 void t::register_type (void) \ | |
91 { \ | |
92 t_id = octave_value_typeinfo::register_type (t::t_name, \ | |
93 t::c_name, \ | |
94 octave_value (new t ())); \ | |
95 } | |
96 | |
2477 | 97 // A base value type, so that derived types only have to redefine what |
98 // they need (if they are derived from octave_base_value instead of | |
99 // octave_value). | |
2376 | 100 |
101 class | |
6109 | 102 OCTINTERP_API |
5759 | 103 octave_base_value |
2376 | 104 { |
105 public: | |
106 | |
5759 | 107 typedef octave_base_value * (*type_conv_fcn) (const octave_base_value&); |
108 | |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
109 // type conversion, including result type information |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
110 class type_conv_info |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
111 { |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
112 public: |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
113 type_conv_info (type_conv_fcn f = 0, int t = -1) : _fcn (f), _type_id (t) { } |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
114 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
115 operator type_conv_fcn (void) const { return _fcn; } |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
116 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
117 octave_base_value * operator () (const octave_base_value &v) const |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
118 { return (*_fcn) (v); } |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
119 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
120 int type_id (void) const { return _type_id; } |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
121 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
122 private: |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
123 type_conv_fcn _fcn; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
124 int _type_id; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
125 }; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
126 |
5759 | 127 friend class octave_value; |
2376 | 128 |
5759 | 129 octave_base_value (void) : count (1) { } |
130 | |
131 octave_base_value (const octave_base_value&) { } | |
2376 | 132 |
5759 | 133 virtual ~octave_base_value (void) { } |
134 | |
135 virtual octave_base_value * | |
136 clone (void) const { return new octave_base_value (*this); } | |
2376 | 137 |
5759 | 138 virtual octave_base_value * |
139 empty_clone (void) const { return new octave_base_value (); } | |
2376 | 140 |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
141 virtual type_conv_info |
5759 | 142 numeric_conversion_function (void) const |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
143 { return type_conv_info (); } |
2410 | 144 |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
145 virtual type_conv_info |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
146 numeric_demotion_function (void) const |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
147 { return type_conv_info (); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
148 |
5759 | 149 virtual octave_value squeeze (void) const; |
150 | |
151 virtual octave_base_value *try_narrowing_conversion (void) { return 0; } | |
4532 | 152 |
5759 | 153 virtual octave_value |
154 subsref (const std::string& type, | |
155 const std::list<octave_value_list>& idx); | |
3933 | 156 |
5759 | 157 virtual octave_value_list |
158 subsref (const std::string& type, | |
159 const std::list<octave_value_list>& idx, | |
160 int nargout); | |
3933 | 161 |
5759 | 162 virtual octave_value |
5885 | 163 do_index_op (const octave_value_list& idx, bool resize_ok = false); |
2974 | 164 |
5759 | 165 virtual octave_value_list |
3544 | 166 do_multi_index_op (int nargout, const octave_value_list& idx); |
2376 | 167 |
5759 | 168 virtual octave_value |
169 subsasgn (const std::string& type, | |
170 const std::list<octave_value_list>& idx, | |
171 const octave_value& rhs); | |
2376 | 172 |
5759 | 173 virtual idx_vector index_vector (void) const; |
2376 | 174 |
5759 | 175 virtual dim_vector dims (void) const { return dim_vector (-1, -1); } |
4559 | 176 |
5759 | 177 octave_idx_type rows (void) const |
178 { | |
179 dim_vector dv = dims (); | |
5164 | 180 |
5759 | 181 return (dv.length () > 0) ? dv(0) : -1; |
182 } | |
4791 | 183 |
5759 | 184 octave_idx_type columns (void) const |
185 { | |
186 dim_vector dv = dims (); | |
5602 | 187 |
5759 | 188 return (dv.length () > 1) ? dv(1) : -1; |
189 } | |
5604 | 190 |
5759 | 191 virtual int ndims (void) const; |
4567 | 192 |
5759 | 193 virtual octave_idx_type numel (void) const { return dims ().numel (); } |
4593 | 194 |
5759 | 195 virtual octave_idx_type capacity (void) const { return numel (); } |
196 | |
197 virtual size_t byte_size (void) const { return 0; } | |
4915 | 198 |
5759 | 199 virtual octave_idx_type nnz (void) const; |
2376 | 200 |
5759 | 201 virtual octave_idx_type nzmax (void) const; |
202 | |
5900 | 203 virtual octave_idx_type nfields (void) const; |
204 | |
5759 | 205 virtual octave_value reshape (const dim_vector&) const; |
3351 | 206 |
5759 | 207 virtual octave_value permute (const Array<int>& vec, bool = false) const; |
2376 | 208 |
5759 | 209 virtual octave_value resize (const dim_vector&, bool fill = false) const; |
2376 | 210 |
5785 | 211 virtual MatrixType matrix_type (void) const; |
212 | |
213 virtual MatrixType matrix_type (const MatrixType& typ) const; | |
214 | |
5759 | 215 virtual bool is_defined (void) const { return false; } |
4505 | 216 |
5759 | 217 bool is_empty (void) const { return numel () == 0; } |
2376 | 218 |
5759 | 219 virtual bool is_cell (void) const { return false; } |
2376 | 220 |
6116 | 221 virtual bool is_cellstr (void) const { return false; } |
222 | |
5759 | 223 virtual bool is_real_scalar (void) const { return false; } |
4587 | 224 |
5759 | 225 virtual bool is_real_matrix (void) const { return false; } |
226 | |
227 virtual bool is_real_nd_array (void) const { return false; } | |
2376 | 228 |
5759 | 229 virtual bool is_complex_scalar (void) const { return false; } |
2376 | 230 |
5759 | 231 virtual bool is_complex_matrix (void) const { return false; } |
232 | |
5881 | 233 virtual bool is_bool_scalar (void) const { return false; } |
234 | |
5759 | 235 virtual bool is_bool_matrix (void) const { return false; } |
5279 | 236 |
5759 | 237 virtual bool is_char_matrix (void) const { return false; } |
2376 | 238 |
5759 | 239 virtual bool is_string (void) const { return false; } |
2376 | 240 |
5759 | 241 virtual bool is_sq_string (void) const { return false; } |
4643 | 242 |
5759 | 243 virtual bool is_range (void) const { return false; } |
3977 | 244 |
5759 | 245 virtual bool is_map (void) const { return false; } |
246 | |
7336 | 247 virtual bool is_object (void) const { return false; } |
248 | |
5759 | 249 virtual bool is_cs_list (void) const { return false; } |
2376 | 250 |
5759 | 251 virtual bool is_list (void) const { return false; } |
252 | |
253 virtual bool is_magic_colon (void) const { return false; } | |
2376 | 254 |
5759 | 255 virtual bool is_all_va_args (void) const { return false; } |
2376 | 256 |
5759 | 257 virtual octave_value all (int = 0) const; |
258 | |
259 virtual octave_value any (int = 0) const; | |
2376 | 260 |
5895 | 261 virtual bool is_double_type (void) const { return false; } |
262 | |
263 virtual bool is_single_type (void) const { return false; } | |
264 | |
7576 | 265 virtual bool is_float_type (void) const { return false; } |
266 | |
5895 | 267 virtual bool is_int8_type (void) const { return false; } |
268 | |
269 virtual bool is_int16_type (void) const { return false; } | |
270 | |
271 virtual bool is_int32_type (void) const { return false; } | |
272 | |
273 virtual bool is_int64_type (void) const { return false; } | |
274 | |
275 virtual bool is_uint8_type (void) const { return false; } | |
276 | |
277 virtual bool is_uint16_type (void) const { return false; } | |
278 | |
279 virtual bool is_uint32_type (void) const { return false; } | |
280 | |
281 virtual bool is_uint64_type (void) const { return false; } | |
282 | |
5759 | 283 virtual bool is_bool_type (void) const { return false; } |
3209 | 284 |
6223 | 285 virtual bool is_integer_type (void) const { return false; } |
286 | |
5759 | 287 virtual bool is_real_type (void) const { return false; } |
2376 | 288 |
5759 | 289 virtual bool is_complex_type (void) const { return false; } |
2376 | 290 |
291 // Would be nice to get rid of the next four functions: | |
292 | |
5759 | 293 virtual bool is_scalar_type (void) const { return false; } |
2376 | 294 |
5759 | 295 virtual bool is_matrix_type (void) const { return false; } |
2376 | 296 |
5759 | 297 virtual bool is_numeric_type (void) const { return false; } |
2376 | 298 |
5759 | 299 virtual bool is_sparse_type (void) const { return false; } |
5631 | 300 |
5759 | 301 virtual bool valid_as_scalar_index (void) const { return false; } |
2376 | 302 |
5759 | 303 virtual bool valid_as_zero_index (void) const { return false; } |
2376 | 304 |
5759 | 305 virtual bool is_true (void) const { return false; } |
306 | |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
307 virtual bool is_null_value (void) const { return false; } |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
308 |
5759 | 309 virtual bool is_constant (void) const { return false; } |
2376 | 310 |
5759 | 311 virtual bool is_function_handle (void) const { return false; } |
2376 | 312 |
5759 | 313 virtual bool is_inline_function (void) const { return false; } |
2974 | 314 |
5759 | 315 virtual bool is_function (void) const { return false; } |
4954 | 316 |
7336 | 317 virtual bool is_user_script (void) const { return false; } |
318 | |
319 virtual bool is_user_function (void) const { return false; } | |
320 | |
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
|
321 virtual bool is_user_code (void) const { return 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
|
322 |
5759 | 323 virtual bool is_builtin_function (void) const { return false; } |
2974 | 324 |
5759 | 325 virtual bool is_dld_function (void) const { return false; } |
3325 | 326 |
5864 | 327 virtual bool is_mex_function (void) const { return false; } |
328 | |
7876
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7789
diff
changeset
|
329 virtual void erase_subfunctions (void) { } |
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7789
diff
changeset
|
330 |
5759 | 331 virtual short int short_value (bool = false, bool = false) const; |
4254 | 332 |
5759 | 333 virtual unsigned short int ushort_value (bool = false, bool = false) const; |
4254 | 334 |
5759 | 335 virtual int int_value (bool = false, bool = false) const; |
3202 | 336 |
5759 | 337 virtual unsigned int uint_value (bool = false, bool = false) const; |
4254 | 338 |
5759 | 339 virtual int nint_value (bool = false) const; |
3202 | 340 |
5759 | 341 virtual long int long_value (bool = false, bool = false) const; |
4254 | 342 |
5759 | 343 virtual unsigned long int ulong_value (bool = false, bool = false) const; |
4254 | 344 |
5759 | 345 virtual double double_value (bool = false) const; |
2376 | 346 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
347 virtual float float_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
348 |
5759 | 349 virtual double scalar_value (bool frc_str_conv = false) const |
3145 | 350 { return double_value (frc_str_conv); } |
2376 | 351 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
352 virtual 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
|
353 { return float_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
354 |
5759 | 355 virtual Cell cell_value (void) const; |
3351 | 356 |
5759 | 357 virtual Matrix matrix_value (bool = false) const; |
3145 | 358 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
359 virtual FloatMatrix float_matrix_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
360 |
5759 | 361 virtual NDArray array_value (bool = false) const; |
4505 | 362 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
363 virtual FloatNDArray float_array_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
364 |
5759 | 365 virtual Complex complex_value (bool = false) const; |
2376 | 366 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
367 virtual FloatComplex float_complex_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
368 |
5759 | 369 virtual ComplexMatrix complex_matrix_value (bool = false) const; |
2376 | 370 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
371 virtual FloatComplexMatrix float_complex_matrix_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
372 |
5759 | 373 virtual ComplexNDArray complex_array_value (bool = false) const; |
4550 | 374 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
375 virtual FloatComplexNDArray float_complex_array_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
376 |
5943 | 377 virtual bool bool_value (bool = false) const; |
4550 | 378 |
5943 | 379 virtual boolMatrix bool_matrix_value (bool = false) const; |
4550 | 380 |
5943 | 381 virtual boolNDArray bool_array_value (bool = false) const; |
4550 | 382 |
5759 | 383 virtual charMatrix char_matrix_value (bool force = false) const; |
384 | |
385 virtual charNDArray char_array_value (bool = false) const; | |
2376 | 386 |
5759 | 387 virtual SparseMatrix sparse_matrix_value (bool = false) const; |
4550 | 388 |
5759 | 389 virtual SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; |
5164 | 390 |
5759 | 391 virtual SparseBoolMatrix sparse_bool_matrix_value (bool = false) const; |
5164 | 392 |
5759 | 393 virtual octave_int8 int8_scalar_value (void) const; |
5164 | 394 |
5759 | 395 virtual octave_int16 int16_scalar_value (void) const; |
4910 | 396 |
5759 | 397 virtual octave_int32 int32_scalar_value (void) const; |
398 | |
399 virtual octave_int64 int64_scalar_value (void) const; | |
4910 | 400 |
5759 | 401 virtual octave_uint8 uint8_scalar_value (void) const; |
4910 | 402 |
5759 | 403 virtual octave_uint16 uint16_scalar_value (void) const; |
4910 | 404 |
5759 | 405 virtual octave_uint32 uint32_scalar_value (void) const; |
4910 | 406 |
5759 | 407 virtual octave_uint64 uint64_scalar_value (void) const; |
4910 | 408 |
5759 | 409 virtual int8NDArray int8_array_value (void) const; |
4910 | 410 |
5759 | 411 virtual int16NDArray int16_array_value (void) const; |
4910 | 412 |
5759 | 413 virtual int32NDArray int32_array_value (void) const; |
4906 | 414 |
5759 | 415 virtual int64NDArray int64_array_value (void) const; |
4906 | 416 |
5759 | 417 virtual uint8NDArray uint8_array_value (void) const; |
4906 | 418 |
5759 | 419 virtual uint16NDArray uint16_array_value (void) const; |
4906 | 420 |
5759 | 421 virtual uint32NDArray uint32_array_value (void) const; |
4906 | 422 |
5759 | 423 virtual uint64NDArray uint64_array_value (void) const; |
4906 | 424 |
5759 | 425 virtual string_vector all_strings (bool pad = false) const; |
4906 | 426 |
5759 | 427 virtual std::string string_value (bool force = false) const; |
4906 | 428 |
5759 | 429 virtual Range range_value (void) const; |
2376 | 430 |
5759 | 431 virtual Octave_map map_value (void) const; |
2376 | 432 |
5759 | 433 virtual string_vector map_keys (void) const; |
2376 | 434 |
5759 | 435 virtual octave_function *function_value (bool silent = false); |
3933 | 436 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
437 virtual const octave_function *function_value (bool silent = false) const; |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
438 |
5759 | 439 virtual octave_user_function *user_function_value (bool silent = false); |
4645 | 440 |
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
|
441 virtual 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
|
442 |
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
|
443 virtual 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
|
444 |
5759 | 445 virtual octave_fcn_handle *fcn_handle_value (bool silent = false); |
4643 | 446 |
5759 | 447 virtual octave_fcn_inline *fcn_inline_value (bool silent = false); |
2974 | 448 |
5759 | 449 virtual octave_value_list list_value (void) const; |
4343 | 450 |
5759 | 451 virtual octave_value convert_to_str (bool pad = false, bool force = false, |
452 char type = '"') const; | |
453 virtual octave_value | |
454 convert_to_str_internal (bool pad, bool force, char type) const; | |
4933 | 455 |
5759 | 456 virtual void convert_to_row_or_column_vector (void); |
2882 | 457 |
5759 | 458 virtual bool print_as_scalar (void) const { return false; } |
2376 | 459 |
5759 | 460 virtual void print (std::ostream& os, bool pr_as_read_syntax = false) const; |
2376 | 461 |
5759 | 462 virtual void |
463 print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |
4604 | 464 |
5759 | 465 virtual bool |
466 print_name_tag (std::ostream& os, const std::string& name) const; | |
2901 | 467 |
5759 | 468 virtual void |
469 print_with_name (std::ostream& output_buf, const std::string& name, | |
470 bool print_padding = true) const; | |
2376 | 471 |
5759 | 472 virtual void print_info (std::ostream& os, const std::string& prefix) const; |
3933 | 473 |
6974 | 474 virtual bool save_ascii (std::ostream& os); |
4687 | 475 |
5759 | 476 virtual bool load_ascii (std::istream& is); |
4687 | 477 |
5759 | 478 virtual bool save_binary (std::ostream& os, bool& save_as_floats); |
4687 | 479 |
5759 | 480 virtual bool load_binary (std::istream& is, bool swap, |
481 oct_mach_info::float_format fmt); | |
4687 | 482 |
483 #if defined (HAVE_HDF5) | |
5759 | 484 virtual bool |
485 save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |
4687 | 486 |
5759 | 487 virtual bool |
488 load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); | |
4687 | 489 #endif |
490 | |
5759 | 491 virtual int |
492 write (octave_stream& os, int block_size, | |
493 oct_data_conv::data_type output_type, int skip, | |
494 oct_mach_info::float_format flt_fmt) const; | |
495 | |
5900 | 496 virtual void *mex_get_data (void) const { return 0; } |
497 | |
498 virtual octave_idx_type *mex_get_ir (void) const { return 0; } | |
499 | |
500 virtual octave_idx_type *mex_get_jc (void) const { return 0; } | |
501 | |
502 virtual mxArray *as_mxArray (void) const; | |
503 | |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7576
diff
changeset
|
504 virtual 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
|
505 |
7433 | 506 virtual octave_value sort (octave_idx_type dim = 0, |
7463
2467639bd8c0
eliminate UNDEFINED sort mode
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
507 sortmode mode = ASCENDING) const; |
7433 | 508 virtual octave_value sort (Array<octave_idx_type> &sidx, |
509 octave_idx_type dim = 0, | |
7463
2467639bd8c0
eliminate UNDEFINED sort mode
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
510 sortmode mode = ASCENDING) const; |
7433 | 511 |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
512 virtual void lock (void); |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
513 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
514 virtual void unlock (void); |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
515 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
516 virtual bool islocked (void) const { return false; } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
517 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
518 virtual void dump (std::ostream& os) const; |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
519 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
520 virtual octave_value abs (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
521 virtual octave_value acos (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
522 virtual octave_value acosh (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
523 virtual octave_value angle (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
524 virtual octave_value arg (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
525 virtual octave_value asin (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
526 virtual octave_value asinh (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
527 virtual octave_value atan (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
528 virtual octave_value atanh (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
529 virtual octave_value ceil (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
530 virtual octave_value conj (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
531 virtual octave_value cos (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
532 virtual octave_value cosh (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
533 virtual octave_value erf (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
534 virtual octave_value erfc (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
535 virtual octave_value exp (void) const; |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
536 virtual octave_value expm1 (void) const; |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
537 virtual octave_value finite (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
538 virtual octave_value fix (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
539 virtual octave_value floor (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
540 virtual octave_value gamma (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
541 virtual octave_value imag (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
542 virtual octave_value isinf (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
543 virtual octave_value isna (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
544 virtual octave_value isnan (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
545 virtual octave_value lgamma (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
546 virtual octave_value log (void) const; |
7740 | 547 virtual octave_value log2 (void) const; |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
548 virtual octave_value log10 (void) const; |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
549 virtual octave_value log1p (void) const; |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
550 virtual octave_value real (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
551 virtual octave_value round (void) const; |
7636
99c410f7f0b0
implement mapper function for banker's rounding
Jaroslav Hajek <highegg@gmail.com>
parents:
7620
diff
changeset
|
552 virtual octave_value roundb (void) const; |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
553 virtual octave_value signum (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
554 virtual octave_value sin (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
555 virtual octave_value sinh (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
556 virtual octave_value sqrt (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
557 virtual octave_value tan (void) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
558 virtual octave_value tanh (void) const; |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
559 |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
560 // 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
|
561 // conflicts. |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
562 |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
563 virtual octave_value xisalnum (void) const; |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
564 virtual octave_value xisalpha (void) const; |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
565 virtual octave_value xisascii (void) const; |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
566 virtual octave_value xiscntrl (void) const; |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
567 virtual octave_value xisdigit (void) const; |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
568 virtual octave_value xisgraph (void) const; |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
569 virtual octave_value xislower (void) const; |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
570 virtual octave_value xisprint (void) const; |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
571 virtual octave_value xispunct (void) const; |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
572 virtual octave_value xisspace (void) const; |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
573 virtual octave_value xisupper (void) const; |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
574 virtual octave_value xisxdigit (void) const; |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
575 virtual octave_value xtoascii (void) const; |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
576 virtual octave_value xtolower (void) const; |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
577 virtual octave_value xtoupper (void) const; |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
578 |
5759 | 579 protected: |
580 | |
581 // This should only be called for derived types. | |
582 | |
583 octave_value numeric_assign (const std::string& type, | |
584 const std::list<octave_value_list>& idx, | |
585 const octave_value& rhs); | |
586 | |
587 void reset_indent_level (void) const | |
588 { curr_print_indent_level = 0; } | |
589 | |
590 void increment_indent_level (void) const | |
591 { curr_print_indent_level += 2; } | |
592 | |
593 void decrement_indent_level (void) const | |
594 { curr_print_indent_level -= 2; } | |
595 | |
596 int current_print_indent_level (void) const | |
597 { return curr_print_indent_level; } | |
598 | |
599 void indent (std::ostream& os) const; | |
600 | |
601 void newline (std::ostream& os) const; | |
602 | |
603 void reset (void) const; | |
604 | |
605 // A reference count. | |
606 int count; | |
4944 | 607 |
2376 | 608 private: |
609 | |
5759 | 610 static int curr_print_indent_level; |
611 static bool beginning_of_line; | |
612 | |
613 DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA | |
2376 | 614 }; |
615 | |
7336 | 616 // If TRUE, turn off printing of results in functions (as if a |
617 // semicolon has been appended to each statement). | |
618 extern bool Vsilent_functions; | |
619 | |
7193 | 620 // TRUE means to perform automatic sparse to real mutation if there |
621 // is memory to be saved | |
622 extern bool Vsparse_auto_mutate; | |
623 | |
2376 | 624 #endif |
625 | |
626 /* | |
627 ;;; Local Variables: *** | |
628 ;;; mode: C++ *** | |
629 ;;; End: *** | |
630 */ |