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