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