Mercurial > octave-nkf
annotate src/ov-base.h @ 10832:1b2fcd122c6a
allow user detect ignored outputs in m-functions
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 29 Jul 2010 12:45:23 +0200 |
parents | 8a868004a437 |
children | 44ff569a59a7 |
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 |
10521
4d1fc073fbb7
add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents:
10414
diff
changeset
|
5 Copyright (C) 2009, 2010 VZLU Prague |
2376 | 6 |
7 This file is part of Octave. | |
8 | |
9 Octave is free software; you can redistribute it and/or modify it | |
10 under the terms of the GNU General Public License as published by the | |
7016 | 11 Free Software Foundation; either version 3 of the License, or (at your |
12 option) any later version. | |
2376 | 13 |
14 Octave is distributed in the hope that it will be useful, but WITHOUT | |
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
17 for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
7016 | 20 along with Octave; see the file COPYING. If not, see |
21 <http://www.gnu.org/licenses/>. | |
2376 | 22 |
23 */ | |
24 | |
25 #if !defined (octave_base_value_h) | |
26 #define octave_base_value_h 1 | |
27 | |
28 #include <cstdlib> | |
29 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
30 #include <iosfwd> |
5759 | 31 #include <list> |
2376 | 32 #include <string> |
33 | |
5759 | 34 #include "Range.h" |
5828 | 35 #include "data-conv.h" |
5900 | 36 #include "mxarray.h" |
2376 | 37 #include "mx-base.h" |
38 #include "str-vec.h" | |
39 | |
40 #include "error.h" | |
8676 | 41 #include "oct-hdf5.h" |
2376 | 42 |
3351 | 43 class Cell; |
2376 | 44 class Octave_map; |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
45 class octave_map; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
46 class octave_scalar_map; |
5759 | 47 class octave_value; |
2376 | 48 class octave_value_list; |
5759 | 49 class octave_stream; |
50 class octave_function; | |
51 class octave_user_function; | |
7719
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
52 class octave_user_script; |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
53 class octave_user_code; |
5759 | 54 class octave_fcn_handle; |
55 class octave_fcn_inline; | |
56 class octave_value_list; | |
57 class octave_lvalue; | |
2376 | 58 |
59 class tree_walker; | |
60 | |
9685 | 61 enum builtin_type_t |
62 { | |
63 btyp_double, | |
64 btyp_float, | |
65 btyp_complex, | |
66 btyp_float_complex, | |
67 btyp_int8, | |
68 btyp_int16, | |
69 btyp_int32, | |
70 btyp_int64, | |
71 btyp_uint8, | |
72 btyp_uint16, | |
73 btyp_uint32, | |
74 btyp_uint64, | |
9790
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
75 btyp_bool, |
9685 | 76 btyp_char, |
10087
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
77 btyp_struct, |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
78 btyp_cell, |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
79 btyp_func_handle, |
9743
26abff55f6fe
optimize bsxfun for common built-in operations
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
80 btyp_unknown, |
26abff55f6fe
optimize bsxfun for common built-in operations
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
81 btyp_num_types = btyp_unknown |
9685 | 82 }; |
83 | |
10087
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
84 extern OCTINTERP_API std::string |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
85 btyp_class_name [btyp_num_types]; |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
86 |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
87 extern OCTINTERP_API string_vector |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
88 get_builtin_classes (void); |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
89 |
9790
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
90 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
|
91 { return btyp <= btyp_uint64; } |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
92 |
10087
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
93 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
|
94 { return btyp >= btyp_int8 && btyp <= btyp_uint64; } |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
95 |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
96 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
|
97 { return btyp <= btyp_float_complex; } |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
98 |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
99 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
|
100 { return btyp <= btyp_char; } |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
101 |
9790
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
102 // Compute a numeric type for a possibly mixed-type operation, using these rules: |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
103 // bool -> double |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
104 // single + double -> single |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
105 // real + complex -> complex |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
106 // integer + real -> integer |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
107 // 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
|
108 // 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
|
109 // |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
110 // failing otherwise. |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
111 |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
112 extern OCTINTERP_API |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
113 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
|
114 |
9685 | 115 template <class T> |
116 struct class_to_btyp | |
117 { | |
118 static const builtin_type_t btyp = btyp_unknown; | |
119 }; | |
120 | |
121 #define DEF_CLASS_TO_BTYP(CLASS,BTYP) \ | |
122 template <> \ | |
123 struct class_to_btyp<CLASS> \ | |
124 { static const builtin_type_t btyp = BTYP; } | |
125 | |
126 DEF_CLASS_TO_BTYP (double, btyp_double); | |
127 DEF_CLASS_TO_BTYP (float, btyp_float); | |
128 DEF_CLASS_TO_BTYP (Complex, btyp_complex); | |
129 DEF_CLASS_TO_BTYP (FloatComplex, btyp_float_complex); | |
130 DEF_CLASS_TO_BTYP (octave_int8, btyp_int8); | |
131 DEF_CLASS_TO_BTYP (octave_int16, btyp_int16); | |
132 DEF_CLASS_TO_BTYP (octave_int32, btyp_int32); | |
133 DEF_CLASS_TO_BTYP (octave_int64, btyp_int64); | |
134 DEF_CLASS_TO_BTYP (octave_uint8, btyp_uint8); | |
135 DEF_CLASS_TO_BTYP (octave_uint16, btyp_uint16); | |
136 DEF_CLASS_TO_BTYP (octave_uint32, btyp_uint32); | |
137 DEF_CLASS_TO_BTYP (octave_uint64, btyp_uint64); | |
138 DEF_CLASS_TO_BTYP (bool, btyp_bool); | |
139 DEF_CLASS_TO_BTYP (char, btyp_char); | |
140 | |
5759 | 141 // T_ID is the type id of struct objects, set by register_type(). |
142 // T_NAME is the type name of struct objects. | |
7067 | 143 |
5759 | 144 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA \ |
7066 | 145 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2 (OCTAVE_EMPTY_CPP_ARG) |
5759 | 146 |
147 #define DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA \ | |
148 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(virtual) | |
149 | |
150 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(VIRTUAL) \ | |
151 public: \ | |
152 VIRTUAL int type_id (void) const { return t_id; } \ | |
153 VIRTUAL std::string type_name (void) const { return t_name; } \ | |
154 VIRTUAL std::string class_name (void) const { return c_name; } \ | |
155 static int static_type_id (void) { return t_id; } \ | |
156 static std::string static_type_name (void) { return t_name; } \ | |
157 static std::string static_class_name (void) { return c_name; } \ | |
158 static void register_type (void); \ | |
159 \ | |
160 private: \ | |
161 static int t_id; \ | |
162 static const std::string t_name; \ | |
163 static const std::string c_name; | |
164 | |
165 | |
166 #define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c) \ | |
167 int t::t_id (-1); \ | |
168 const std::string t::t_name (n); \ | |
169 const std::string t::c_name (c); \ | |
170 void t::register_type (void) \ | |
171 { \ | |
172 t_id = octave_value_typeinfo::register_type (t::t_name, \ | |
10313 | 173 t::c_name, \ |
174 octave_value (new t ())); \ | |
5759 | 175 } |
176 | |
2477 | 177 // A base value type, so that derived types only have to redefine what |
178 // they need (if they are derived from octave_base_value instead of | |
179 // octave_value). | |
2376 | 180 |
181 class | |
6109 | 182 OCTINTERP_API |
5759 | 183 octave_base_value |
2376 | 184 { |
185 public: | |
186 | |
5759 | 187 typedef octave_base_value * (*type_conv_fcn) (const octave_base_value&); |
188 | |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
189 // type conversion, including result type information |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
190 class type_conv_info |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
191 { |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
192 public: |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
193 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
|
194 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
195 operator type_conv_fcn (void) const { return _fcn; } |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
196 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
197 octave_base_value * operator () (const octave_base_value &v) const |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
198 { return (*_fcn) (v); } |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
199 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
200 int type_id (void) const { return _type_id; } |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
201 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
202 private: |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
203 type_conv_fcn _fcn; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
204 int _type_id; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
205 }; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
206 |
5759 | 207 friend class octave_value; |
2376 | 208 |
5759 | 209 octave_base_value (void) : count (1) { } |
210 | |
9521 | 211 octave_base_value (const octave_base_value&) : count (1) { } |
2376 | 212 |
5759 | 213 virtual ~octave_base_value (void) { } |
214 | |
9521 | 215 // Unconditional clone. Always clones. |
5759 | 216 virtual octave_base_value * |
217 clone (void) const { return new octave_base_value (*this); } | |
2376 | 218 |
9521 | 219 // Empty clone. |
5759 | 220 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
|
221 empty_clone (void) const; |
2376 | 222 |
9521 | 223 // Unique clone. Usually clones, but may be overriden to fake the |
224 // cloning when sharing copies is to be controlled from within an | |
225 // instance (see octave_class). | |
226 virtual octave_base_value * | |
227 unique_clone (void) { return clone (); } | |
228 | |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
229 virtual type_conv_info |
5759 | 230 numeric_conversion_function (void) const |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
231 { return type_conv_info (); } |
2410 | 232 |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
233 virtual type_conv_info |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
234 numeric_demotion_function (void) const |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
235 { return type_conv_info (); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
236 |
5759 | 237 virtual octave_value squeeze (void) const; |
238 | |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
239 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
|
240 |
5759 | 241 virtual octave_base_value *try_narrowing_conversion (void) { return 0; } |
4532 | 242 |
8523
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
243 virtual void maybe_economize (void) { } |
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
244 |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9182
diff
changeset
|
245 virtual Matrix size (void); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9182
diff
changeset
|
246 |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9182
diff
changeset
|
247 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
|
248 |
5759 | 249 virtual octave_value |
250 subsref (const std::string& type, | |
10313 | 251 const std::list<octave_value_list>& idx); |
3933 | 252 |
5759 | 253 virtual octave_value_list |
254 subsref (const std::string& type, | |
10313 | 255 const std::list<octave_value_list>& idx, |
256 int nargout); | |
3933 | 257 |
5759 | 258 virtual octave_value |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
259 subsref (const std::string& type, |
10313 | 260 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
|
261 bool auto_add); |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
262 |
10832
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
263 virtual octave_value_list |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
264 subsref (const std::string& type, |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
265 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
|
266 int nargout, |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
267 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
|
268 |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
269 virtual octave_value |
5885 | 270 do_index_op (const octave_value_list& idx, bool resize_ok = false); |
2974 | 271 |
5759 | 272 virtual octave_value_list |
3544 | 273 do_multi_index_op (int nargout, const octave_value_list& idx); |
2376 | 274 |
10832
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
275 virtual octave_value_list |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
276 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
|
277 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
|
278 |
9147
5579998f8acf
Update to OOP facilities.
rtshort@bristlecone.phaselocked.com
parents:
9010
diff
changeset
|
279 virtual void assign (const std::string&, const octave_value&) { } |
5579998f8acf
Update to OOP facilities.
rtshort@bristlecone.phaselocked.com
parents:
9010
diff
changeset
|
280 |
5759 | 281 virtual octave_value |
282 subsasgn (const std::string& type, | |
10313 | 283 const std::list<octave_value_list>& idx, |
284 const octave_value& rhs); | |
2376 | 285 |
5759 | 286 virtual idx_vector index_vector (void) const; |
2376 | 287 |
10181
a668fbd32e34
improve cellfun & avoid undefined values from builtins
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
288 virtual dim_vector dims (void) const { return dim_vector (); } |
4559 | 289 |
5759 | 290 octave_idx_type rows (void) const |
291 { | |
10651
944b78191f03
simplify octave_base_value::rows and columns
Jaroslav Hajek <highegg@gmail.com>
parents:
10612
diff
changeset
|
292 const dim_vector dv = dims (); |
5164 | 293 |
10651
944b78191f03
simplify octave_base_value::rows and columns
Jaroslav Hajek <highegg@gmail.com>
parents:
10612
diff
changeset
|
294 return dv(0); |
5759 | 295 } |
4791 | 296 |
5759 | 297 octave_idx_type columns (void) const |
298 { | |
10651
944b78191f03
simplify octave_base_value::rows and columns
Jaroslav Hajek <highegg@gmail.com>
parents:
10612
diff
changeset
|
299 const dim_vector dv = dims (); |
5602 | 300 |
10651
944b78191f03
simplify octave_base_value::rows and columns
Jaroslav Hajek <highegg@gmail.com>
parents:
10612
diff
changeset
|
301 return dv(1); |
5759 | 302 } |
5604 | 303 |
10652
2f0fbfa4dd23
simplify octave_base_value::ndims
Jaroslav Hajek <highegg@gmail.com>
parents:
10651
diff
changeset
|
304 virtual int ndims (void) const |
2f0fbfa4dd23
simplify octave_base_value::ndims
Jaroslav Hajek <highegg@gmail.com>
parents:
10651
diff
changeset
|
305 { return dims ().length (); } |
4567 | 306 |
5759 | 307 virtual octave_idx_type numel (void) const { return dims ().numel (); } |
4593 | 308 |
5759 | 309 virtual octave_idx_type capacity (void) const { return numel (); } |
310 | |
311 virtual size_t byte_size (void) const { return 0; } | |
4915 | 312 |
5759 | 313 virtual octave_idx_type nnz (void) const; |
2376 | 314 |
5759 | 315 virtual octave_idx_type nzmax (void) const; |
316 | |
5900 | 317 virtual octave_idx_type nfields (void) const; |
318 | |
5759 | 319 virtual octave_value reshape (const dim_vector&) const; |
3351 | 320 |
5759 | 321 virtual octave_value permute (const Array<int>& vec, bool = false) const; |
2376 | 322 |
5759 | 323 virtual octave_value resize (const dim_vector&, bool fill = false) const; |
2376 | 324 |
5785 | 325 virtual MatrixType matrix_type (void) const; |
326 | |
327 virtual MatrixType matrix_type (const MatrixType& typ) const; | |
328 | |
5759 | 329 virtual bool is_defined (void) const { return false; } |
4505 | 330 |
5759 | 331 bool is_empty (void) const { return numel () == 0; } |
2376 | 332 |
5759 | 333 virtual bool is_cell (void) const { return false; } |
2376 | 334 |
6116 | 335 virtual bool is_cellstr (void) const { return false; } |
336 | |
5759 | 337 virtual bool is_real_scalar (void) const { return false; } |
4587 | 338 |
5759 | 339 virtual bool is_real_matrix (void) const { return false; } |
340 | |
341 virtual bool is_real_nd_array (void) const { return false; } | |
2376 | 342 |
5759 | 343 virtual bool is_complex_scalar (void) const { return false; } |
2376 | 344 |
5759 | 345 virtual bool is_complex_matrix (void) const { return false; } |
346 | |
5881 | 347 virtual bool is_bool_scalar (void) const { return false; } |
348 | |
5759 | 349 virtual bool is_bool_matrix (void) const { return false; } |
5279 | 350 |
5759 | 351 virtual bool is_char_matrix (void) const { return false; } |
2376 | 352 |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
353 virtual bool is_diag_matrix (void) const { return false; } |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
354 |
8371
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
355 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
|
356 |
5759 | 357 virtual bool is_string (void) const { return false; } |
2376 | 358 |
5759 | 359 virtual bool is_sq_string (void) const { return false; } |
4643 | 360 |
5759 | 361 virtual bool is_range (void) const { return false; } |
3977 | 362 |
5759 | 363 virtual bool is_map (void) const { return false; } |
364 | |
7336 | 365 virtual bool is_object (void) const { return false; } |
366 | |
5759 | 367 virtual bool is_cs_list (void) const { return false; } |
2376 | 368 |
5759 | 369 virtual bool is_magic_colon (void) const { return false; } |
2376 | 370 |
5759 | 371 virtual bool is_all_va_args (void) const { return false; } |
2376 | 372 |
5759 | 373 virtual octave_value all (int = 0) const; |
374 | |
375 virtual octave_value any (int = 0) const; | |
2376 | 376 |
9685 | 377 virtual builtin_type_t builtin_type (void) const { return btyp_unknown; } |
378 | |
5895 | 379 virtual bool is_double_type (void) const { return false; } |
380 | |
381 virtual bool is_single_type (void) const { return false; } | |
382 | |
7576 | 383 virtual bool is_float_type (void) const { return false; } |
384 | |
5895 | 385 virtual bool is_int8_type (void) const { return false; } |
386 | |
387 virtual bool is_int16_type (void) const { return false; } | |
388 | |
389 virtual bool is_int32_type (void) const { return false; } | |
390 | |
391 virtual bool is_int64_type (void) const { return false; } | |
392 | |
393 virtual bool is_uint8_type (void) const { return false; } | |
394 | |
395 virtual bool is_uint16_type (void) const { return false; } | |
396 | |
397 virtual bool is_uint32_type (void) const { return false; } | |
398 | |
399 virtual bool is_uint64_type (void) const { return false; } | |
400 | |
5759 | 401 virtual bool is_bool_type (void) const { return false; } |
3209 | 402 |
6223 | 403 virtual bool is_integer_type (void) const { return false; } |
404 | |
5759 | 405 virtual bool is_real_type (void) const { return false; } |
2376 | 406 |
5759 | 407 virtual bool is_complex_type (void) const { return false; } |
2376 | 408 |
409 // Would be nice to get rid of the next four functions: | |
410 | |
5759 | 411 virtual bool is_scalar_type (void) const { return false; } |
2376 | 412 |
5759 | 413 virtual bool is_matrix_type (void) const { return false; } |
2376 | 414 |
5759 | 415 virtual bool is_numeric_type (void) const { return false; } |
2376 | 416 |
5759 | 417 virtual bool is_sparse_type (void) const { return false; } |
5631 | 418 |
5759 | 419 virtual bool is_true (void) const { return false; } |
420 | |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
421 virtual bool is_null_value (void) const { return false; } |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
422 |
5759 | 423 virtual bool is_constant (void) const { return false; } |
2376 | 424 |
5759 | 425 virtual bool is_function_handle (void) const { return false; } |
2376 | 426 |
5759 | 427 virtual bool is_inline_function (void) const { return false; } |
2974 | 428 |
5759 | 429 virtual bool is_function (void) const { return false; } |
4954 | 430 |
7336 | 431 virtual bool is_user_script (void) const { return false; } |
432 | |
433 virtual bool is_user_function (void) const { return false; } | |
434 | |
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
|
435 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
|
436 |
5759 | 437 virtual bool is_builtin_function (void) const { return false; } |
2974 | 438 |
5759 | 439 virtual bool is_dld_function (void) const { return false; } |
3325 | 440 |
5864 | 441 virtual bool is_mex_function (void) const { return false; } |
442 | |
7876
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7789
diff
changeset
|
443 virtual void erase_subfunctions (void) { } |
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7789
diff
changeset
|
444 |
5759 | 445 virtual short int short_value (bool = false, bool = false) const; |
4254 | 446 |
5759 | 447 virtual unsigned short int ushort_value (bool = false, bool = false) const; |
4254 | 448 |
5759 | 449 virtual int int_value (bool = false, bool = false) const; |
3202 | 450 |
5759 | 451 virtual unsigned int uint_value (bool = false, bool = false) const; |
4254 | 452 |
5759 | 453 virtual int nint_value (bool = false) const; |
3202 | 454 |
5759 | 455 virtual long int long_value (bool = false, bool = false) const; |
4254 | 456 |
5759 | 457 virtual unsigned long int ulong_value (bool = false, bool = false) const; |
4254 | 458 |
5759 | 459 virtual double double_value (bool = false) const; |
2376 | 460 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
461 virtual float float_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
462 |
5759 | 463 virtual double scalar_value (bool frc_str_conv = false) const |
3145 | 464 { return double_value (frc_str_conv); } |
2376 | 465 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
466 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
|
467 { return float_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
468 |
5759 | 469 virtual Cell cell_value (void) const; |
3351 | 470 |
5759 | 471 virtual Matrix matrix_value (bool = false) const; |
3145 | 472 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
473 virtual FloatMatrix float_matrix_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
474 |
5759 | 475 virtual NDArray array_value (bool = false) const; |
4505 | 476 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
477 virtual FloatNDArray float_array_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
478 |
5759 | 479 virtual Complex complex_value (bool = false) const; |
2376 | 480 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
481 virtual FloatComplex float_complex_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
482 |
5759 | 483 virtual ComplexMatrix complex_matrix_value (bool = false) const; |
2376 | 484 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
485 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
|
486 |
5759 | 487 virtual ComplexNDArray complex_array_value (bool = false) const; |
4550 | 488 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
489 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
|
490 |
5943 | 491 virtual bool bool_value (bool = false) const; |
4550 | 492 |
5943 | 493 virtual boolMatrix bool_matrix_value (bool = false) const; |
4550 | 494 |
5943 | 495 virtual boolNDArray bool_array_value (bool = false) const; |
4550 | 496 |
5759 | 497 virtual charMatrix char_matrix_value (bool force = false) const; |
498 | |
499 virtual charNDArray char_array_value (bool = false) const; | |
2376 | 500 |
5759 | 501 virtual SparseMatrix sparse_matrix_value (bool = false) const; |
4550 | 502 |
5759 | 503 virtual SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; |
5164 | 504 |
5759 | 505 virtual SparseBoolMatrix sparse_bool_matrix_value (bool = false) const; |
5164 | 506 |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
507 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
|
508 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
509 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
|
510 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
511 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
|
512 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
513 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
|
514 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
515 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
|
516 |
5759 | 517 virtual octave_int8 int8_scalar_value (void) const; |
5164 | 518 |
5759 | 519 virtual octave_int16 int16_scalar_value (void) const; |
4910 | 520 |
5759 | 521 virtual octave_int32 int32_scalar_value (void) const; |
522 | |
523 virtual octave_int64 int64_scalar_value (void) const; | |
4910 | 524 |
5759 | 525 virtual octave_uint8 uint8_scalar_value (void) const; |
4910 | 526 |
5759 | 527 virtual octave_uint16 uint16_scalar_value (void) const; |
4910 | 528 |
5759 | 529 virtual octave_uint32 uint32_scalar_value (void) const; |
4910 | 530 |
5759 | 531 virtual octave_uint64 uint64_scalar_value (void) const; |
4910 | 532 |
5759 | 533 virtual int8NDArray int8_array_value (void) const; |
4910 | 534 |
5759 | 535 virtual int16NDArray int16_array_value (void) const; |
4910 | 536 |
5759 | 537 virtual int32NDArray int32_array_value (void) const; |
4906 | 538 |
5759 | 539 virtual int64NDArray int64_array_value (void) const; |
4906 | 540 |
5759 | 541 virtual uint8NDArray uint8_array_value (void) const; |
4906 | 542 |
5759 | 543 virtual uint16NDArray uint16_array_value (void) const; |
4906 | 544 |
5759 | 545 virtual uint32NDArray uint32_array_value (void) const; |
4906 | 546 |
5759 | 547 virtual uint64NDArray uint64_array_value (void) const; |
4906 | 548 |
5759 | 549 virtual string_vector all_strings (bool pad = false) const; |
4906 | 550 |
5759 | 551 virtual std::string string_value (bool force = false) const; |
4906 | 552 |
8732 | 553 virtual Array<std::string> cellstr_value (void) const; |
554 | |
5759 | 555 virtual Range range_value (void) const; |
2376 | 556 |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
557 virtual octave_map map_value (void) const; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
558 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
559 virtual octave_scalar_map scalar_map_value (void) const; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
560 |
5759 | 561 virtual string_vector map_keys (void) const; |
2376 | 562 |
9151 | 563 virtual size_t nparents (void) const; |
564 | |
565 virtual std::list<std::string> parent_class_name_list (void) const; | |
566 | |
567 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
|
568 |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8950
diff
changeset
|
569 virtual octave_base_value *find_parent_class (const std::string&) |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8950
diff
changeset
|
570 { return 0; } |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8950
diff
changeset
|
571 |
9767
0df32e0b2074
fix base class field assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
9743
diff
changeset
|
572 virtual octave_base_value *unique_parent_class (const std::string&) |
0df32e0b2074
fix base class field assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
9743
diff
changeset
|
573 { return 0; } |
0df32e0b2074
fix base class field assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
9743
diff
changeset
|
574 |
5759 | 575 virtual octave_function *function_value (bool silent = false); |
3933 | 576 |
5759 | 577 virtual octave_user_function *user_function_value (bool silent = false); |
4645 | 578 |
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
|
579 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
|
580 |
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
|
581 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
|
582 |
5759 | 583 virtual octave_fcn_handle *fcn_handle_value (bool silent = false); |
4643 | 584 |
5759 | 585 virtual octave_fcn_inline *fcn_inline_value (bool silent = false); |
2974 | 586 |
5759 | 587 virtual octave_value_list list_value (void) const; |
4343 | 588 |
5759 | 589 virtual octave_value convert_to_str (bool pad = false, bool force = false, |
10313 | 590 char type = '\'') const; |
5759 | 591 virtual octave_value |
592 convert_to_str_internal (bool pad, bool force, char type) const; | |
4933 | 593 |
5759 | 594 virtual void convert_to_row_or_column_vector (void); |
2882 | 595 |
5759 | 596 virtual bool print_as_scalar (void) const { return false; } |
2376 | 597 |
5759 | 598 virtual void print (std::ostream& os, bool pr_as_read_syntax = false) const; |
2376 | 599 |
5759 | 600 virtual void |
601 print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |
4604 | 602 |
5759 | 603 virtual bool |
604 print_name_tag (std::ostream& os, const std::string& name) const; | |
2901 | 605 |
5759 | 606 virtual void |
607 print_with_name (std::ostream& output_buf, const std::string& name, | |
10313 | 608 bool print_padding = true); |
2376 | 609 |
5759 | 610 virtual void print_info (std::ostream& os, const std::string& prefix) const; |
3933 | 611 |
6974 | 612 virtual bool save_ascii (std::ostream& os); |
4687 | 613 |
5759 | 614 virtual bool load_ascii (std::istream& is); |
4687 | 615 |
5759 | 616 virtual bool save_binary (std::ostream& os, bool& save_as_floats); |
4687 | 617 |
5759 | 618 virtual bool load_binary (std::istream& is, bool swap, |
10313 | 619 oct_mach_info::float_format fmt); |
4687 | 620 |
621 #if defined (HAVE_HDF5) | |
5759 | 622 virtual bool |
623 save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |
4687 | 624 |
5759 | 625 virtual bool |
9881
b3089dba88bf
Remove HDF5 cruft for older versions of HDF5
Kacper Kowalik
parents:
9835
diff
changeset
|
626 load_hdf5 (hid_t loc_id, const char *name); |
4687 | 627 #endif |
628 | |
5759 | 629 virtual int |
630 write (octave_stream& os, int block_size, | |
10313 | 631 oct_data_conv::data_type output_type, int skip, |
632 oct_mach_info::float_format flt_fmt) const; | |
5759 | 633 |
5900 | 634 virtual void *mex_get_data (void) const { return 0; } |
635 | |
636 virtual octave_idx_type *mex_get_ir (void) const { return 0; } | |
637 | |
638 virtual octave_idx_type *mex_get_jc (void) const { return 0; } | |
639 | |
640 virtual mxArray *as_mxArray (void) const; | |
641 | |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7576
diff
changeset
|
642 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
|
643 |
7433 | 644 virtual octave_value sort (octave_idx_type dim = 0, |
10313 | 645 sortmode mode = ASCENDING) const; |
7433 | 646 virtual octave_value sort (Array<octave_idx_type> &sidx, |
10313 | 647 octave_idx_type dim = 0, |
648 sortmode mode = ASCENDING) const; | |
7433 | 649 |
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
|
650 virtual sortmode is_sorted (sortmode mode = UNSORTED) const; |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
651 |
8733
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8732
diff
changeset
|
652 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
|
653 sort_rows_idx (sortmode mode = ASCENDING) const; |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
654 |
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
|
655 virtual sortmode is_sorted_rows (sortmode mode = UNSORTED) const; |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
656 |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
657 virtual void lock (void); |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
658 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
659 virtual void unlock (void); |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
660 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
661 virtual bool islocked (void) const { return false; } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
662 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
663 virtual void dump (std::ostream& os) const; |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
664 |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
665 // Standard mappers. Register new ones here. |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
666 enum unary_mapper_t |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
667 { |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
668 umap_abs, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
669 umap_acos, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
670 umap_acosh, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
671 umap_angle, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
672 umap_arg, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
673 umap_asin, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
674 umap_asinh, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
675 umap_atan, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
676 umap_atanh, |
10414
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
677 umap_cbrt, |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
678 umap_ceil, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
679 umap_conj, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
680 umap_cos, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
681 umap_cosh, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
682 umap_erf, |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
683 umap_erfinv, |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
684 umap_erfc, |
10391
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
685 umap_erfcx, |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
686 umap_exp, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
687 umap_expm1, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
688 umap_finite, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
689 umap_fix, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
690 umap_floor, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
691 umap_gamma, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
692 umap_imag, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
693 umap_isinf, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
694 umap_isna, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
695 umap_isnan, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
696 umap_lgamma, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
697 umap_log, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
698 umap_log2, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
699 umap_log10, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
700 umap_log1p, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
701 umap_real, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
702 umap_round, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
703 umap_roundb, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
704 umap_signum, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
705 umap_sin, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
706 umap_sinh, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
707 umap_sqrt, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
708 umap_tan, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
709 umap_tanh, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
710 umap_xisalnum, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
711 umap_xisalpha, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
712 umap_xisascii, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
713 umap_xiscntrl, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
714 umap_xisdigit, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
715 umap_xisgraph, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
716 umap_xislower, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
717 umap_xisprint, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
718 umap_xispunct, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
719 umap_xisspace, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
720 umap_xisupper, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
721 umap_xisxdigit, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
722 umap_xtoascii, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
723 umap_xtolower, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
724 umap_xtoupper, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
725 umap_unknown, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
726 num_unary_mappers = umap_unknown |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
727 }; |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
728 |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
729 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
|
730 |
10670
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
731 // 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
|
732 // 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
|
733 |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
734 // 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
|
735 // 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
|
736 virtual octave_value |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
737 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
|
738 |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
739 // 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
|
740 // 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
|
741 // Never error. |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
742 virtual bool |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
743 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
|
744 |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
745 // This is a helper for the above, to be overriden in scalar types. The |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
746 // 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
|
747 // 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
|
748 virtual bool |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
749 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
|
750 |
5759 | 751 protected: |
752 | |
753 // This should only be called for derived types. | |
754 | |
755 octave_value numeric_assign (const std::string& type, | |
10313 | 756 const std::list<octave_value_list>& idx, |
757 const octave_value& rhs); | |
5759 | 758 |
759 void reset_indent_level (void) const | |
760 { curr_print_indent_level = 0; } | |
761 | |
762 void increment_indent_level (void) const | |
763 { curr_print_indent_level += 2; } | |
764 | |
765 void decrement_indent_level (void) const | |
766 { curr_print_indent_level -= 2; } | |
767 | |
768 int current_print_indent_level (void) const | |
769 { return curr_print_indent_level; } | |
770 | |
771 void indent (std::ostream& os) const; | |
772 | |
773 void newline (std::ostream& os) const; | |
774 | |
775 void reset (void) const; | |
776 | |
777 // A reference count. | |
9521 | 778 // NOTE: the declaration is octave_idx_type because with 64-bit indexing, |
779 // it is well possible to have more than MAX_INT copies of a single value | |
780 // (think of an empty cell array with >2G elements). | |
781 octave_idx_type count; | |
4944 | 782 |
2376 | 783 private: |
784 | |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
785 static const char *get_umap_name (unary_mapper_t); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
786 |
5759 | 787 static int curr_print_indent_level; |
788 static bool beginning_of_line; | |
789 | |
790 DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA | |
2376 | 791 }; |
792 | |
7193 | 793 // TRUE means to perform automatic sparse to real mutation if there |
794 // is memory to be saved | |
10612
09e244649f50
Export symbol Vsparse_auto_mutate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10544
diff
changeset
|
795 extern OCTINTERP_API bool Vsparse_auto_mutate; |
7193 | 796 |
2376 | 797 #endif |