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