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