Mercurial > hg > octave-nkf
annotate libinterp/octave-value/ov-base.h @ 20794:e5986cba4ca8
new octave_value::cell_value method with optional error message
* ov.h, ov.cc (octave_value::cell_value): New method.
* ov-base.h, ov-base.cc (octave_base_value::cell_value):
New default method.
* ov-cell.h, ov-cell.cc (octave_cell::cell_value): New method.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 09 Oct 2015 14:41:49 -0400 |
parents | 40ed9b46a800 |
children |
rev | line source |
---|---|
2376 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19302
diff
changeset
|
3 Copyright (C) 1996-2015 John W. Eaton |
11523 | 4 Copyright (C) 2009-2010 VZLU Prague |
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 | |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
24 #if !defined (octave_ov_base_h) |
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
25 #define octave_ov_base_h 1 |
2376 | 26 |
27 #include <cstdlib> | |
28 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
29 #include <iosfwd> |
5759 | 30 #include <list> |
2376 | 31 #include <string> |
32 | |
5759 | 33 #include "Range.h" |
5828 | 34 #include "data-conv.h" |
2376 | 35 #include "mx-base.h" |
36 #include "str-vec.h" | |
37 | |
38 #include "error.h" | |
20474
bfe66db8addb
don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents:
20439
diff
changeset
|
39 #include "oct-hdf5-types.h" |
2376 | 40 |
3351 | 41 class Cell; |
15149
62a35ae7d6a2
use forward decls for mxArray in ov.h and ov-base.h
John W. Eaton <jwe@octave.org>
parents:
15057
diff
changeset
|
42 class mxArray; |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
43 class octave_map; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
44 class octave_scalar_map; |
5759 | 45 class octave_value; |
2376 | 46 class octave_value_list; |
5759 | 47 class octave_stream; |
48 class octave_function; | |
49 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
|
50 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
|
51 class octave_user_code; |
5759 | 52 class octave_fcn_handle; |
53 class octave_fcn_inline; | |
54 class octave_value_list; | |
55 class octave_lvalue; | |
2376 | 56 |
57 class tree_walker; | |
58 | |
9685 | 59 enum builtin_type_t |
60 { | |
61 btyp_double, | |
62 btyp_float, | |
63 btyp_complex, | |
64 btyp_float_complex, | |
65 btyp_int8, | |
66 btyp_int16, | |
67 btyp_int32, | |
68 btyp_int64, | |
69 btyp_uint8, | |
70 btyp_uint16, | |
71 btyp_uint32, | |
72 btyp_uint64, | |
9790
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
73 btyp_bool, |
9685 | 74 btyp_char, |
10087
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
75 btyp_struct, |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
76 btyp_cell, |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
77 btyp_func_handle, |
9743
26abff55f6fe
optimize bsxfun for common built-in operations
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
78 btyp_unknown, |
26abff55f6fe
optimize bsxfun for common built-in operations
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
79 btyp_num_types = btyp_unknown |
9685 | 80 }; |
81 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
82 extern OCTINTERP_API std::string |
10087
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
83 btyp_class_name [btyp_num_types]; |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
84 |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
85 extern OCTINTERP_API string_vector |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
86 get_builtin_classes (void); |
10087
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
87 |
9790
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
88 inline bool btyp_isnumeric (builtin_type_t btyp) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
89 { return btyp <= btyp_uint64; } |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
90 |
10087
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
91 inline bool btyp_isinteger (builtin_type_t btyp) |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
92 { return btyp >= btyp_int8 && btyp <= btyp_uint64; } |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
93 |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
94 inline bool btyp_isfloat (builtin_type_t btyp) |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
95 { return btyp <= btyp_float_complex; } |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
96 |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
97 inline bool btyp_isarray (builtin_type_t btyp) |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
98 { return btyp <= btyp_char; } |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
99 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
100 // Compute numeric type for a possible mixed-type operation, using these rules: |
9790
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
101 // bool -> double |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
102 // single + double -> single |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
103 // real + complex -> complex |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
104 // integer + real -> integer |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
105 // uint + uint -> uint (the bigger one) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
106 // sint + sint -> sint (the bigger one) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
107 // |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
108 // failing otherwise. |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
109 |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
110 extern OCTINTERP_API |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
111 builtin_type_t btyp_mixed_numeric (builtin_type_t x, builtin_type_t y); |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
112 |
9685 | 113 template <class T> |
114 struct class_to_btyp | |
115 { | |
116 static const builtin_type_t btyp = btyp_unknown; | |
117 }; | |
118 | |
119 #define DEF_CLASS_TO_BTYP(CLASS,BTYP) \ | |
120 template <> \ | |
121 struct class_to_btyp<CLASS> \ | |
122 { static const builtin_type_t btyp = BTYP; } | |
123 | |
124 DEF_CLASS_TO_BTYP (double, btyp_double); | |
125 DEF_CLASS_TO_BTYP (float, btyp_float); | |
126 DEF_CLASS_TO_BTYP (Complex, btyp_complex); | |
127 DEF_CLASS_TO_BTYP (FloatComplex, btyp_float_complex); | |
128 DEF_CLASS_TO_BTYP (octave_int8, btyp_int8); | |
129 DEF_CLASS_TO_BTYP (octave_int16, btyp_int16); | |
130 DEF_CLASS_TO_BTYP (octave_int32, btyp_int32); | |
131 DEF_CLASS_TO_BTYP (octave_int64, btyp_int64); | |
132 DEF_CLASS_TO_BTYP (octave_uint8, btyp_uint8); | |
133 DEF_CLASS_TO_BTYP (octave_uint16, btyp_uint16); | |
134 DEF_CLASS_TO_BTYP (octave_uint32, btyp_uint32); | |
135 DEF_CLASS_TO_BTYP (octave_uint64, btyp_uint64); | |
136 DEF_CLASS_TO_BTYP (bool, btyp_bool); | |
137 DEF_CLASS_TO_BTYP (char, btyp_char); | |
138 | |
5759 | 139 // T_ID is the type id of struct objects, set by register_type(). |
140 // T_NAME is the type name of struct objects. | |
7067 | 141 |
5759 | 142 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA \ |
7066 | 143 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2 (OCTAVE_EMPTY_CPP_ARG) |
5759 | 144 |
145 #define DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA \ | |
146 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(virtual) | |
147 | |
148 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(VIRTUAL) \ | |
149 public: \ | |
150 VIRTUAL int type_id (void) const { return t_id; } \ | |
151 VIRTUAL std::string type_name (void) const { return t_name; } \ | |
152 VIRTUAL std::string class_name (void) const { return c_name; } \ | |
153 static int static_type_id (void) { return t_id; } \ | |
154 static std::string static_type_name (void) { return t_name; } \ | |
155 static std::string static_class_name (void) { return c_name; } \ | |
156 static void register_type (void); \ | |
157 \ | |
158 private: \ | |
159 static int t_id; \ | |
160 static const std::string t_name; \ | |
161 static const std::string c_name; | |
162 | |
163 | |
164 #define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c) \ | |
165 int t::t_id (-1); \ | |
166 const std::string t::t_name (n); \ | |
167 const std::string t::c_name (c); \ | |
168 void t::register_type (void) \ | |
169 { \ | |
14013
1734ebe27134
move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
13241
diff
changeset
|
170 static t exemplar; \ |
1734ebe27134
move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
13241
diff
changeset
|
171 octave_value v (&exemplar, true); \ |
1734ebe27134
move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents:
13241
diff
changeset
|
172 t_id = octave_value_typeinfo::register_type (t::t_name, t::c_name, v); \ |
5759 | 173 } |
174 | |
2477 | 175 // A base value type, so that derived types only have to redefine what |
176 // they need (if they are derived from octave_base_value instead of | |
177 // octave_value). | |
2376 | 178 |
179 class | |
6109 | 180 OCTINTERP_API |
5759 | 181 octave_base_value |
2376 | 182 { |
183 public: | |
184 | |
5759 | 185 typedef octave_base_value * (*type_conv_fcn) (const octave_base_value&); |
186 | |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
187 // type conversion, including result type information |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
188 class type_conv_info |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
189 { |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
190 public: |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
191 type_conv_info (type_conv_fcn f = 0, int t = -1) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
192 : _fcn (f), _type_id (t) { } |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
193 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
194 operator type_conv_fcn (void) const { return _fcn; } |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
195 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
196 octave_base_value * operator () (const octave_base_value &v) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
197 { return (*_fcn) (v); } |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
198 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
199 int type_id (void) const { return _type_id; } |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
200 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
201 private: |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
202 type_conv_fcn _fcn; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
203 int _type_id; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
204 }; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
205 |
5759 | 206 friend class octave_value; |
2376 | 207 |
5759 | 208 octave_base_value (void) : count (1) { } |
209 | |
9521 | 210 octave_base_value (const octave_base_value&) : count (1) { } |
2376 | 211 |
5759 | 212 virtual ~octave_base_value (void) { } |
213 | |
9521 | 214 // Unconditional clone. Always clones. |
5759 | 215 virtual octave_base_value * |
216 clone (void) const { return new octave_base_value (*this); } | |
2376 | 217 |
9521 | 218 // Empty clone. |
5759 | 219 virtual octave_base_value * |
10544
9961fc022d9d
fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
220 empty_clone (void) const; |
2376 | 221 |
20307
1f9ed81bd173
maint: Fix spelling and grammar mistakes in docs and comments (bug #44878)
Rafael Laboissiere <rafael@laboissiere.net>
parents:
20070
diff
changeset
|
222 // Unique clone. Usually clones, but may be overridden to fake the |
9521 | 223 // cloning when sharing copies is to be controlled from within an |
224 // instance (see octave_class). | |
225 virtual octave_base_value * | |
226 unique_clone (void) { return clone (); } | |
227 | |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
228 virtual type_conv_info |
5759 | 229 numeric_conversion_function (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
230 { return type_conv_info (); } |
2410 | 231 |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
232 virtual type_conv_info |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
233 numeric_demotion_function (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
234 { return type_conv_info (); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
235 |
5759 | 236 virtual octave_value squeeze (void) const; |
237 | |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
238 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
|
239 |
5759 | 240 virtual octave_base_value *try_narrowing_conversion (void) { return 0; } |
4532 | 241 |
8523
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
242 virtual void maybe_economize (void) { } |
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
243 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
244 virtual Matrix size (void); |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9182
diff
changeset
|
245 |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9182
diff
changeset
|
246 virtual octave_idx_type numel (const octave_value_list&); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9182
diff
changeset
|
247 |
5759 | 248 virtual octave_value |
249 subsref (const std::string& type, | |
10313 | 250 const std::list<octave_value_list>& idx); |
3933 | 251 |
5759 | 252 virtual octave_value_list |
253 subsref (const std::string& type, | |
10313 | 254 const std::list<octave_value_list>& idx, |
255 int nargout); | |
3933 | 256 |
5759 | 257 virtual octave_value |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
258 subsref (const std::string& type, |
10313 | 259 const std::list<octave_value_list>& idx, |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
260 bool auto_add); |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
261 |
10832
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
262 virtual octave_value_list |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
263 subsref (const std::string& type, |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
264 const std::list<octave_value_list>& idx, |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
265 int nargout, |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
266 const std::list<octave_lvalue> *lvalue_list); |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
267 |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
268 virtual octave_value |
5885 | 269 do_index_op (const octave_value_list& idx, bool resize_ok = false); |
2974 | 270 |
5759 | 271 virtual octave_value_list |
3544 | 272 do_multi_index_op (int nargout, const octave_value_list& idx); |
2376 | 273 |
10832
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
274 virtual octave_value_list |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
275 do_multi_index_op (int nargout, const octave_value_list& idx, |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
276 const std::list<octave_lvalue> *lvalue_list); |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
277 |
9147
5579998f8acf
Update to OOP facilities.
rtshort@bristlecone.phaselocked.com
parents:
9010
diff
changeset
|
278 virtual void assign (const std::string&, const octave_value&) { } |
5579998f8acf
Update to OOP facilities.
rtshort@bristlecone.phaselocked.com
parents:
9010
diff
changeset
|
279 |
5759 | 280 virtual octave_value |
281 subsasgn (const std::string& type, | |
10313 | 282 const std::list<octave_value_list>& idx, |
283 const octave_value& rhs); | |
2376 | 284 |
12171
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
12125
diff
changeset
|
285 virtual octave_value |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
12125
diff
changeset
|
286 undef_subsasgn (const std::string& type, |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
12125
diff
changeset
|
287 const std::list<octave_value_list>& idx, |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
12125
diff
changeset
|
288 const octave_value& rhs); |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
12125
diff
changeset
|
289 |
18129
e473c4853afc
enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents:
17870
diff
changeset
|
290 virtual idx_vector index_vector (bool require_integers = false) const; |
2376 | 291 |
10181
a668fbd32e34
improve cellfun & avoid undefined values from builtins
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
292 virtual dim_vector dims (void) const { return dim_vector (); } |
4559 | 293 |
5759 | 294 octave_idx_type rows (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
295 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
296 const dim_vector dv = dims (); |
5164 | 297 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
298 return dv(0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
299 } |
4791 | 300 |
5759 | 301 octave_idx_type columns (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
302 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
303 const dim_vector dv = dims (); |
5602 | 304 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
305 return dv(1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
306 } |
5604 | 307 |
10652
2f0fbfa4dd23
simplify octave_base_value::ndims
Jaroslav Hajek <highegg@gmail.com>
parents:
10651
diff
changeset
|
308 virtual int ndims (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
309 { return dims ().length (); } |
4567 | 310 |
5759 | 311 virtual octave_idx_type numel (void) const { return dims ().numel (); } |
4593 | 312 |
20439
5dfaaaae784f
Deprecate Array::capacity() and Sparse::capacity() for numel() and nzmax().
Carnë Draug <carandraug@octave.org>
parents:
20307
diff
changeset
|
313 GCC_ATTR_DEPRECATED virtual octave_idx_type capacity (void) const |
5dfaaaae784f
Deprecate Array::capacity() and Sparse::capacity() for numel() and nzmax().
Carnë Draug <carandraug@octave.org>
parents:
20307
diff
changeset
|
314 { return numel (); } |
5759 | 315 |
316 virtual size_t byte_size (void) const { return 0; } | |
4915 | 317 |
5759 | 318 virtual octave_idx_type nnz (void) const; |
2376 | 319 |
5759 | 320 virtual octave_idx_type nzmax (void) const; |
321 | |
5900 | 322 virtual octave_idx_type nfields (void) const; |
323 | |
5759 | 324 virtual octave_value reshape (const dim_vector&) const; |
3351 | 325 |
5759 | 326 virtual octave_value permute (const Array<int>& vec, bool = false) const; |
2376 | 327 |
5759 | 328 virtual octave_value resize (const dim_vector&, bool fill = false) const; |
2376 | 329 |
5785 | 330 virtual MatrixType matrix_type (void) const; |
331 | |
332 virtual MatrixType matrix_type (const MatrixType& typ) const; | |
333 | |
5759 | 334 virtual bool is_defined (void) const { return false; } |
4505 | 335 |
16804
617a6e5a974a
Partially undo the changeset 8fce0ed4894a as sparse specialized version of is_empty can be used in all cases.
David Bateman <dbateman@free.fr>
parents:
16779
diff
changeset
|
336 bool is_empty (void) const { return (dims ().any_zero ()); } |
2376 | 337 |
5759 | 338 virtual bool is_cell (void) const { return false; } |
2376 | 339 |
6116 | 340 virtual bool is_cellstr (void) const { return false; } |
341 | |
5759 | 342 virtual bool is_real_scalar (void) const { return false; } |
4587 | 343 |
5759 | 344 virtual bool is_real_matrix (void) const { return false; } |
345 | |
346 virtual bool is_complex_scalar (void) const { return false; } | |
2376 | 347 |
5759 | 348 virtual bool is_complex_matrix (void) const { return false; } |
349 | |
5881 | 350 virtual bool is_bool_scalar (void) const { return false; } |
351 | |
5759 | 352 virtual bool is_bool_matrix (void) const { return false; } |
5279 | 353 |
5759 | 354 virtual bool is_char_matrix (void) const { return false; } |
2376 | 355 |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
356 virtual bool is_diag_matrix (void) const { return false; } |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
357 |
8371
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
358 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
|
359 |
5759 | 360 virtual bool is_string (void) const { return false; } |
2376 | 361 |
5759 | 362 virtual bool is_sq_string (void) const { return false; } |
4643 | 363 |
5759 | 364 virtual bool is_range (void) const { return false; } |
3977 | 365 |
5759 | 366 virtual bool is_map (void) const { return false; } |
367 | |
7336 | 368 virtual bool is_object (void) const { return false; } |
369 | |
19302
fa48651fbb8a
isstruct for classdef objects should not return true.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19295
diff
changeset
|
370 virtual bool is_classdef_object (void) const { return false; } |
fa48651fbb8a
isstruct for classdef objects should not return true.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19295
diff
changeset
|
371 |
15770 | 372 virtual bool is_java (void) const { return false; } |
373 | |
5759 | 374 virtual bool is_cs_list (void) const { return false; } |
2376 | 375 |
5759 | 376 virtual bool is_magic_colon (void) const { return false; } |
2376 | 377 |
5759 | 378 virtual bool is_all_va_args (void) const { return false; } |
2376 | 379 |
5759 | 380 virtual octave_value all (int = 0) const; |
381 | |
382 virtual octave_value any (int = 0) const; | |
2376 | 383 |
9685 | 384 virtual builtin_type_t builtin_type (void) const { return btyp_unknown; } |
385 | |
5895 | 386 virtual bool is_double_type (void) const { return false; } |
387 | |
388 virtual bool is_single_type (void) const { return false; } | |
389 | |
7576 | 390 virtual bool is_float_type (void) const { return false; } |
391 | |
5895 | 392 virtual bool is_int8_type (void) const { return false; } |
393 | |
394 virtual bool is_int16_type (void) const { return false; } | |
395 | |
396 virtual bool is_int32_type (void) const { return false; } | |
397 | |
398 virtual bool is_int64_type (void) const { return false; } | |
399 | |
400 virtual bool is_uint8_type (void) const { return false; } | |
401 | |
402 virtual bool is_uint16_type (void) const { return false; } | |
403 | |
404 virtual bool is_uint32_type (void) const { return false; } | |
405 | |
406 virtual bool is_uint64_type (void) const { return false; } | |
407 | |
5759 | 408 virtual bool is_bool_type (void) const { return false; } |
3209 | 409 |
6223 | 410 virtual bool is_integer_type (void) const { return false; } |
411 | |
5759 | 412 virtual bool is_real_type (void) const { return false; } |
2376 | 413 |
5759 | 414 virtual bool is_complex_type (void) const { return false; } |
2376 | 415 |
416 // Would be nice to get rid of the next four functions: | |
417 | |
5759 | 418 virtual bool is_scalar_type (void) const { return false; } |
2376 | 419 |
5759 | 420 virtual bool is_matrix_type (void) const { return false; } |
2376 | 421 |
5759 | 422 virtual bool is_numeric_type (void) const { return false; } |
2376 | 423 |
5759 | 424 virtual bool is_sparse_type (void) const { return false; } |
5631 | 425 |
5759 | 426 virtual bool is_true (void) const { return false; } |
427 | |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
428 virtual bool is_null_value (void) const { return false; } |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
429 |
5759 | 430 virtual bool is_constant (void) const { return false; } |
2376 | 431 |
5759 | 432 virtual bool is_function_handle (void) const { return false; } |
2376 | 433 |
13241
2a8dcb5b3a00
improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents:
12171
diff
changeset
|
434 virtual bool is_anonymous_function (void) const { return false; } |
2a8dcb5b3a00
improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents:
12171
diff
changeset
|
435 |
5759 | 436 virtual bool is_inline_function (void) const { return false; } |
2974 | 437 |
5759 | 438 virtual bool is_function (void) const { return false; } |
4954 | 439 |
7336 | 440 virtual bool is_user_script (void) const { return false; } |
441 | |
442 virtual bool is_user_function (void) const { return false; } | |
443 | |
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
|
444 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
|
445 |
5759 | 446 virtual bool is_builtin_function (void) const { return false; } |
2974 | 447 |
5759 | 448 virtual bool is_dld_function (void) const { return false; } |
3325 | 449 |
5864 | 450 virtual bool is_mex_function (void) const { return false; } |
451 | |
7876
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7789
diff
changeset
|
452 virtual void erase_subfunctions (void) { } |
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7789
diff
changeset
|
453 |
5759 | 454 virtual short int short_value (bool = false, bool = false) const; |
4254 | 455 |
5759 | 456 virtual unsigned short int ushort_value (bool = false, bool = false) const; |
4254 | 457 |
5759 | 458 virtual int int_value (bool = false, bool = false) const; |
3202 | 459 |
5759 | 460 virtual unsigned int uint_value (bool = false, bool = false) const; |
4254 | 461 |
5759 | 462 virtual int nint_value (bool = false) const; |
3202 | 463 |
5759 | 464 virtual long int long_value (bool = false, bool = false) const; |
4254 | 465 |
5759 | 466 virtual unsigned long int ulong_value (bool = false, bool = false) const; |
4254 | 467 |
16323
e769440b39db
provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents:
15770
diff
changeset
|
468 virtual int64_t int64_value (bool = false, bool = false) const; |
e769440b39db
provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents:
15770
diff
changeset
|
469 |
e769440b39db
provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents:
15770
diff
changeset
|
470 virtual uint64_t uint64_value (bool = false, bool = false) const; |
e769440b39db
provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents:
15770
diff
changeset
|
471 |
5759 | 472 virtual double double_value (bool = false) const; |
2376 | 473 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
474 virtual float float_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
475 |
5759 | 476 virtual double scalar_value (bool frc_str_conv = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
477 { return double_value (frc_str_conv); } |
2376 | 478 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
479 virtual float float_scalar_value (bool frc_str_conv = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
480 { return float_value (frc_str_conv); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
481 |
5759 | 482 virtual Cell cell_value (void) const; |
3351 | 483 |
20794
e5986cba4ca8
new octave_value::cell_value method with optional error message
John W. Eaton <jwe@octave.org>
parents:
20787
diff
changeset
|
484 virtual Cell cell_value (const char *fmt, va_list args) const; |
e5986cba4ca8
new octave_value::cell_value method with optional error message
John W. Eaton <jwe@octave.org>
parents:
20787
diff
changeset
|
485 |
5759 | 486 virtual Matrix matrix_value (bool = false) const; |
3145 | 487 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
488 virtual FloatMatrix float_matrix_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
489 |
5759 | 490 virtual NDArray array_value (bool = false) const; |
4505 | 491 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
492 virtual FloatNDArray float_array_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
493 |
5759 | 494 virtual Complex complex_value (bool = false) const; |
2376 | 495 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
496 virtual FloatComplex float_complex_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
497 |
5759 | 498 virtual ComplexMatrix complex_matrix_value (bool = false) const; |
2376 | 499 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
500 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
|
501 |
5759 | 502 virtual ComplexNDArray complex_array_value (bool = false) const; |
4550 | 503 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
504 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
|
505 |
5943 | 506 virtual bool bool_value (bool = false) const; |
4550 | 507 |
5943 | 508 virtual boolMatrix bool_matrix_value (bool = false) const; |
4550 | 509 |
5943 | 510 virtual boolNDArray bool_array_value (bool = false) const; |
4550 | 511 |
5759 | 512 virtual charMatrix char_matrix_value (bool force = false) const; |
513 | |
514 virtual charNDArray char_array_value (bool = false) const; | |
2376 | 515 |
5759 | 516 virtual SparseMatrix sparse_matrix_value (bool = false) const; |
4550 | 517 |
5759 | 518 virtual SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; |
5164 | 519 |
5759 | 520 virtual SparseBoolMatrix sparse_bool_matrix_value (bool = false) const; |
5164 | 521 |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
522 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
|
523 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
524 virtual FloatDiagMatrix float_diag_matrix_value (bool = false) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
525 |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
526 virtual ComplexDiagMatrix complex_diag_matrix_value (bool = false) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
527 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
528 virtual FloatComplexDiagMatrix |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
529 float_complex_diag_matrix_value (bool = false) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
530 |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
531 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
|
532 |
5759 | 533 virtual octave_int8 int8_scalar_value (void) const; |
5164 | 534 |
5759 | 535 virtual octave_int16 int16_scalar_value (void) const; |
4910 | 536 |
5759 | 537 virtual octave_int32 int32_scalar_value (void) const; |
538 | |
539 virtual octave_int64 int64_scalar_value (void) const; | |
4910 | 540 |
5759 | 541 virtual octave_uint8 uint8_scalar_value (void) const; |
4910 | 542 |
5759 | 543 virtual octave_uint16 uint16_scalar_value (void) const; |
4910 | 544 |
5759 | 545 virtual octave_uint32 uint32_scalar_value (void) const; |
4910 | 546 |
5759 | 547 virtual octave_uint64 uint64_scalar_value (void) const; |
4910 | 548 |
5759 | 549 virtual int8NDArray int8_array_value (void) const; |
4910 | 550 |
5759 | 551 virtual int16NDArray int16_array_value (void) const; |
4910 | 552 |
5759 | 553 virtual int32NDArray int32_array_value (void) const; |
4906 | 554 |
5759 | 555 virtual int64NDArray int64_array_value (void) const; |
4906 | 556 |
5759 | 557 virtual uint8NDArray uint8_array_value (void) const; |
4906 | 558 |
5759 | 559 virtual uint16NDArray uint16_array_value (void) const; |
4906 | 560 |
5759 | 561 virtual uint32NDArray uint32_array_value (void) const; |
4906 | 562 |
5759 | 563 virtual uint64NDArray uint64_array_value (void) const; |
4906 | 564 |
5759 | 565 virtual string_vector all_strings (bool pad = false) const; |
4906 | 566 |
5759 | 567 virtual std::string string_value (bool force = false) const; |
4906 | 568 |
20787
40ed9b46a800
new octave_value::string_value method with optional error message
John W. Eaton <jwe@octave.org>
parents:
20474
diff
changeset
|
569 virtual std::string string_value (const char *fmt, va_list args) const; |
40ed9b46a800
new octave_value::string_value method with optional error message
John W. Eaton <jwe@octave.org>
parents:
20474
diff
changeset
|
570 |
8732 | 571 virtual Array<std::string> cellstr_value (void) const; |
572 | |
5759 | 573 virtual Range range_value (void) const; |
2376 | 574 |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
575 virtual octave_map map_value (void) const; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
576 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
577 virtual octave_scalar_map scalar_map_value (void) const; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
578 |
5759 | 579 virtual string_vector map_keys (void) const; |
2376 | 580 |
9151 | 581 virtual size_t nparents (void) const; |
582 | |
583 virtual std::list<std::string> parent_class_name_list (void) const; | |
584 | |
585 virtual string_vector parent_class_names (void) const; | |
9010
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8950
diff
changeset
|
586 |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8950
diff
changeset
|
587 virtual octave_base_value *find_parent_class (const std::string&) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
588 { return 0; } |
9010
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8950
diff
changeset
|
589 |
9767
0df32e0b2074
fix base class field assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
9743
diff
changeset
|
590 virtual octave_base_value *unique_parent_class (const std::string&) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
591 { return 0; } |
9767
0df32e0b2074
fix base class field assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
9743
diff
changeset
|
592 |
19295
56bc1464ec59
Implement "isa" for classdef objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18484
diff
changeset
|
593 virtual bool is_instance_of (const std::string&) const |
56bc1464ec59
Implement "isa" for classdef objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18484
diff
changeset
|
594 { return false; } |
56bc1464ec59
Implement "isa" for classdef objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18484
diff
changeset
|
595 |
5759 | 596 virtual octave_function *function_value (bool silent = false); |
3933 | 597 |
5759 | 598 virtual octave_user_function *user_function_value (bool silent = false); |
4645 | 599 |
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
|
600 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
|
601 |
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
|
602 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
|
603 |
5759 | 604 virtual octave_fcn_handle *fcn_handle_value (bool silent = false); |
4643 | 605 |
5759 | 606 virtual octave_fcn_inline *fcn_inline_value (bool silent = false); |
2974 | 607 |
5759 | 608 virtual octave_value_list list_value (void) const; |
4343 | 609 |
5759 | 610 virtual octave_value convert_to_str (bool pad = false, bool force = false, |
10313 | 611 char type = '\'') const; |
5759 | 612 virtual octave_value |
613 convert_to_str_internal (bool pad, bool force, char type) const; | |
4933 | 614 |
5759 | 615 virtual void convert_to_row_or_column_vector (void); |
2882 | 616 |
5759 | 617 virtual bool print_as_scalar (void) const { return false; } |
2376 | 618 |
18484
bcd71a2531d3
Support disp/display overloading in classdef
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18358
diff
changeset
|
619 virtual void print (std::ostream& os, bool pr_as_read_syntax = false); |
2376 | 620 |
5759 | 621 virtual void |
622 print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |
4604 | 623 |
5759 | 624 virtual bool |
625 print_name_tag (std::ostream& os, const std::string& name) const; | |
2901 | 626 |
5759 | 627 virtual void |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
628 print_with_name (std::ostream& output_buf, const std::string& name, |
10313 | 629 bool print_padding = true); |
2376 | 630 |
17870 | 631 virtual void short_disp (std::ostream& os) const { os << "..."; } |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16323
diff
changeset
|
632 |
5759 | 633 virtual void print_info (std::ostream& os, const std::string& prefix) const; |
3933 | 634 |
6974 | 635 virtual bool save_ascii (std::ostream& os); |
4687 | 636 |
5759 | 637 virtual bool load_ascii (std::istream& is); |
4687 | 638 |
5759 | 639 virtual bool save_binary (std::ostream& os, bool& save_as_floats); |
4687 | 640 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
641 virtual bool load_binary (std::istream& is, bool swap, |
10313 | 642 oct_mach_info::float_format fmt); |
4687 | 643 |
5759 | 644 virtual bool |
20070
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19898
diff
changeset
|
645 save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats); |
4687 | 646 |
5759 | 647 virtual bool |
20070
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19898
diff
changeset
|
648 load_hdf5 (octave_hdf5_id loc_id, const char *name); |
4687 | 649 |
5759 | 650 virtual int |
651 write (octave_stream& os, int block_size, | |
10313 | 652 oct_data_conv::data_type output_type, int skip, |
653 oct_mach_info::float_format flt_fmt) const; | |
5759 | 654 |
5900 | 655 virtual void *mex_get_data (void) const { return 0; } |
656 | |
657 virtual octave_idx_type *mex_get_ir (void) const { return 0; } | |
658 | |
659 virtual octave_idx_type *mex_get_jc (void) const { return 0; } | |
660 | |
661 virtual mxArray *as_mxArray (void) const; | |
662 | |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7576
diff
changeset
|
663 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
|
664 |
14557
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
665 virtual octave_value diag (octave_idx_type m, octave_idx_type n) const; |
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
666 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
667 virtual octave_value sort (octave_idx_type dim = 0, |
10313 | 668 sortmode mode = ASCENDING) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
669 virtual octave_value sort (Array<octave_idx_type> &sidx, |
10313 | 670 octave_idx_type dim = 0, |
671 sortmode mode = ASCENDING) const; | |
7433 | 672 |
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
|
673 virtual sortmode is_sorted (sortmode mode = UNSORTED) const; |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
674 |
8733
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8732
diff
changeset
|
675 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
|
676 sort_rows_idx (sortmode mode = ASCENDING) const; |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
677 |
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
|
678 virtual sortmode is_sorted_rows (sortmode mode = UNSORTED) const; |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
679 |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
680 virtual void lock (void); |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
681 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
682 virtual void unlock (void); |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
683 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
684 virtual bool islocked (void) const { return false; } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
685 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
686 virtual void dump (std::ostream& os) const; |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
687 |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
688 // Standard mappers. Register new ones here. |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
689 enum unary_mapper_t |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
690 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
691 umap_abs, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
692 umap_acos, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
693 umap_acosh, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
694 umap_angle, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
695 umap_arg, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
696 umap_asin, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
697 umap_asinh, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
698 umap_atan, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
699 umap_atanh, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
700 umap_cbrt, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
701 umap_ceil, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
702 umap_conj, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
703 umap_cos, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
704 umap_cosh, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
705 umap_erf, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
706 umap_erfinv, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
707 umap_erfcinv, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
708 umap_erfc, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
709 umap_erfcx, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
710 umap_erfi, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
711 umap_dawson, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
712 umap_exp, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
713 umap_expm1, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
714 umap_finite, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
715 umap_fix, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
716 umap_floor, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
717 umap_gamma, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
718 umap_imag, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
719 umap_isinf, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
720 umap_isna, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
721 umap_isnan, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
722 umap_lgamma, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
723 umap_log, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
724 umap_log2, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
725 umap_log10, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
726 umap_log1p, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
727 umap_real, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
728 umap_round, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
729 umap_roundb, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
730 umap_signum, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
731 umap_sin, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
732 umap_sinh, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
733 umap_sqrt, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
734 umap_tan, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
735 umap_tanh, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
736 umap_xisalnum, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
737 umap_xisalpha, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
738 umap_xisascii, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
739 umap_xiscntrl, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
740 umap_xisdigit, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
741 umap_xisgraph, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
742 umap_xislower, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
743 umap_xisprint, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
744 umap_xispunct, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
745 umap_xisspace, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
746 umap_xisupper, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
747 umap_xisxdigit, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
748 umap_xsignbit, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
749 umap_xtoascii, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
750 umap_xtolower, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
751 umap_xtoupper, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
752 umap_unknown, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
753 num_unary_mappers = umap_unknown |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
754 }; |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
755 |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
756 virtual octave_value map (unary_mapper_t) const; |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
757 |
10670
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
758 // These are fast indexing & assignment shortcuts for extracting |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
759 // or inserting a single scalar from/to an array. |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
760 |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
761 // Extract the n-th element, aka val(n). Result is undefined if val is not an |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
762 // array type or n is out of range. Never error. |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
763 virtual octave_value |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
764 fast_elem_extract (octave_idx_type n) const; |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
765 |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
766 // Assign the n-th element, aka val(n) = x. Returns false if val is not an |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
767 // array type, x is not a matching scalar type, or n is out of range. |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
768 // Never error. |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
769 virtual bool |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
770 fast_elem_insert (octave_idx_type n, const octave_value& x); |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
771 |
20307
1f9ed81bd173
maint: Fix spelling and grammar mistakes in docs and comments (bug #44878)
Rafael Laboissiere <rafael@laboissiere.net>
parents:
20070
diff
changeset
|
772 // This is a helper for the above, to be overridden in scalar types. The |
10670
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
773 // whole point is to handle the insertion efficiently with just *two* VM |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
774 // calls, which is basically the theoretical minimum. |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
775 virtual bool |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
776 fast_elem_insert_self (void *where, builtin_type_t btyp) const; |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
777 |
14903 | 778 // Grab the reference count. For use by jit. |
779 void | |
780 grab (void) | |
781 { | |
782 ++count; | |
783 } | |
784 | |
785 // Release the reference count. For use by jit. | |
786 void | |
787 release (void) | |
788 { | |
789 if (--count == 0) | |
790 delete this; | |
791 } | |
792 | |
5759 | 793 protected: |
794 | |
795 // This should only be called for derived types. | |
796 | |
797 octave_value numeric_assign (const std::string& type, | |
10313 | 798 const std::list<octave_value_list>& idx, |
799 const octave_value& rhs); | |
5759 | 800 |
801 void reset_indent_level (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
802 { curr_print_indent_level = 0; } |
5759 | 803 |
804 void increment_indent_level (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
805 { curr_print_indent_level += 2; } |
5759 | 806 |
807 void decrement_indent_level (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
808 { curr_print_indent_level -= 2; } |
5759 | 809 |
810 int current_print_indent_level (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
811 { return curr_print_indent_level; } |
5759 | 812 |
813 void indent (std::ostream& os) const; | |
814 | |
815 void newline (std::ostream& os) const; | |
816 | |
817 void reset (void) const; | |
818 | |
819 // A reference count. | |
9521 | 820 // NOTE: the declaration is octave_idx_type because with 64-bit indexing, |
821 // it is well possible to have more than MAX_INT copies of a single value | |
822 // (think of an empty cell array with >2G elements). | |
12125
a21a3875ca83
implement a common class for reference counts
Jaroslav Hajek <highegg@gmail.com>
parents:
11586
diff
changeset
|
823 octave_refcount<octave_idx_type> count; |
4944 | 824 |
15501
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15487
diff
changeset
|
825 static const char *get_umap_name (unary_mapper_t); |
2376 | 826 |
20070
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19898
diff
changeset
|
827 void gripe_load (const char *type) const; |
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19898
diff
changeset
|
828 void gripe_save (const char *type) const; |
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19898
diff
changeset
|
829 |
15501
814c4b0d5c49
make numeric mapper functions throw error for char args (bug #37535)
John W. Eaton <jwe@octave.org>
parents:
15487
diff
changeset
|
830 private: |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
831 |
5759 | 832 static int curr_print_indent_level; |
833 static bool beginning_of_line; | |
834 | |
835 DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA | |
2376 | 836 }; |
837 | |
7193 | 838 // TRUE means to perform automatic sparse to real mutation if there |
839 // is memory to be saved | |
10612
09e244649f50
Export symbol Vsparse_auto_mutate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10544
diff
changeset
|
840 extern OCTINTERP_API bool Vsparse_auto_mutate; |
7193 | 841 |
18356
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18129
diff
changeset
|
842 // Utility function to convert C++ arguments used in subsref/subsasgn into an |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18129
diff
changeset
|
843 // octave_value_list object that can be used to call a function/method in the |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18129
diff
changeset
|
844 // interpreter. |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18129
diff
changeset
|
845 extern OCTINTERP_API octave_value |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18129
diff
changeset
|
846 make_idx_args (const std::string& type, |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18129
diff
changeset
|
847 const std::list<octave_value_list>& idx, |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18129
diff
changeset
|
848 const std::string& who); |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18129
diff
changeset
|
849 |
18358
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18356
diff
changeset
|
850 // Tells whether some regular octave_value_base methods are being called from |
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18356
diff
changeset
|
851 // within the "builtin" function. |
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18356
diff
changeset
|
852 extern OCTINTERP_API bool called_from_builtin (void); |
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18356
diff
changeset
|
853 |
2376 | 854 #endif |