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