Mercurial > octave
annotate libinterp/corefcn/mxarray.in.h @ 21241:bae38398f5f1
use consistent style for all liboctave and libinterp include guards
* mex.h, mexproto.h, mxarray.in.h, oct-obj.h, octave-default-image.h:
Use include guard style that is consistent with other files in Octave.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 10 Feb 2016 12:21:36 -0500 |
parents | bfd5e48c41a1 |
children | 1473547f50f5 |
rev | line source |
---|---|
15100
8523df595d42
maint: Add DO NOT EDIT messages to build system for src/*.in.h.
Rik <rik@octave.org>
parents:
15096
diff
changeset
|
1 // %NO_EDIT_WARNING% |
6686 | 2 /* |
3 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
4 Copyright (C) 2001-2015 Paul Kienzle |
6686 | 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. | |
6686 | 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/>. | |
6686 | 21 |
22 */ | |
23 | |
24 /* | |
25 | |
26 Part of this code was originally distributed as part of Octave Forge under | |
27 the following terms: | |
28 | |
29 Author: Paul Kienzle | |
30 I grant this code to the public domain. | |
31 2001-03-22 | |
32 | |
33 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
34 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
35 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
36 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
37 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
38 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
39 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
40 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
41 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
42 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
43 SUCH DAMAGE. | |
44 | |
45 */ | |
46 | |
21241
bae38398f5f1
use consistent style for all liboctave and libinterp include guards
John W. Eaton <jwe@octave.org>
parents:
21151
diff
changeset
|
47 #if ! defined (octave_mxarray_h) |
bae38398f5f1
use consistent style for all liboctave and libinterp include guards
John W. Eaton <jwe@octave.org>
parents:
21151
diff
changeset
|
48 #define octave_mxarray_h 1 |
6686 | 49 |
50 typedef enum | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
51 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
52 mxREAL = 0, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
53 mxCOMPLEX = 1 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
54 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
55 mxComplexity; |
6686 | 56 |
57 typedef enum | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
58 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
59 mxUNKNOWN_CLASS = 0, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
60 mxCELL_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
61 mxSTRUCT_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
62 mxLOGICAL_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
63 mxCHAR_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
64 mxUNUSED_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 mxDOUBLE_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
66 mxSINGLE_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
67 mxINT8_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
68 mxUINT8_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
69 mxINT16_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
70 mxUINT16_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
71 mxINT32_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
72 mxUINT32_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
73 mxINT64_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
74 mxUINT64_CLASS, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
75 mxFUNCTION_CLASS |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
76 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
77 mxClassID; |
6686 | 78 |
7574
9669b69e34ef
define mxLogical as unsigned char instead of int
John W. Eaton <jwe@octave.org>
parents:
7417
diff
changeset
|
79 typedef unsigned char mxLogical; |
6686 | 80 |
81 /* typedef Uint16 mxChar; */ | |
82 typedef char mxChar; | |
83 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
84 /* |
21066
258c787cd9ce
maint: Use "FIXME:" consistently in code base.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
85 * FIXME: Mathworks says these should be size_t on 64-bit system and when |
258c787cd9ce
maint: Use "FIXME:" consistently in code base.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
86 * mex is used with the -largearraydims flag, but why do that? Its better |
258c787cd9ce
maint: Use "FIXME:" consistently in code base.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
87 * to conform to the same indexing as the rest of Octave. |
6686 | 88 */ |
9906 | 89 typedef %OCTAVE_IDX_TYPE% mwSize; |
90 typedef %OCTAVE_IDX_TYPE% mwIndex; | |
15240
a23693fa5ba9
Add mwSignedIndex type for better mex compatibility with Matlab (bug #37133)
Rik <rik@octave.org>
parents:
15195
diff
changeset
|
91 typedef %OCTAVE_IDX_TYPE% mwSignedIndex; |
6686 | 92 |
93 #if ! defined (MXARRAY_TYPEDEFS_ONLY) | |
94 | |
7417 | 95 #include <cstring> |
21151
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
21066
diff
changeset
|
96 #include "error.h" |
7417 | 97 |
6686 | 98 class octave_value; |
99 | |
100 #define DO_MUTABLE_METHOD(RET_T, METHOD_CALL) \ | |
101 RET_T retval = rep->METHOD_CALL; \ | |
102 \ | |
103 if (rep->mutation_needed ()) \ | |
104 { \ | |
105 maybe_mutate (); \ | |
106 retval = rep->METHOD_CALL; \ | |
107 } \ | |
108 \ | |
109 return retval | |
110 | |
111 #define DO_VOID_MUTABLE_METHOD(METHOD_CALL) \ | |
112 rep->METHOD_CALL; \ | |
113 \ | |
114 if (rep->mutation_needed ()) \ | |
115 { \ | |
116 maybe_mutate (); \ | |
117 rep->METHOD_CALL; \ | |
118 } | |
119 | |
21151
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
21066
diff
changeset
|
120 class mxArray; |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
121 |
21151
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
21066
diff
changeset
|
122 // A class to provide the default implementation of some of the |
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
21066
diff
changeset
|
123 // virtual functions declared in the mxArray class. |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
124 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
125 class mxArray_base |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
126 { |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
127 protected: |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
128 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
129 mxArray_base (void) { } |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
130 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
131 public: |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
132 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
133 virtual mxArray_base *dup (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
134 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
135 virtual mxArray *as_mxArray (void) const { return 0; } |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
136 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
137 virtual ~mxArray_base (void) { } |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
138 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
139 virtual bool is_octave_value (void) const { return false; } |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
140 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
141 virtual int is_cell (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
142 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
143 virtual int is_char (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
144 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
145 virtual int is_class (const char *name_arg) const |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
146 { |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
147 int retval = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
148 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
149 const char *cname = get_class_name (); |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
150 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
151 if (cname && name_arg) |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
152 retval = ! strcmp (cname, name_arg); |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
153 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
154 return retval; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
155 } |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
156 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
157 virtual int is_complex (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
158 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
159 virtual int is_double (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
160 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
161 virtual int is_function_handle (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
162 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
163 virtual int is_int16 (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
164 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
165 virtual int is_int32 (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
166 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
167 virtual int is_int64 (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
168 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
169 virtual int is_int8 (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
170 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
171 virtual int is_logical (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
172 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
173 virtual int is_numeric (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
174 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
175 virtual int is_single (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
176 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
177 virtual int is_sparse (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
178 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
179 virtual int is_struct (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
180 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
181 virtual int is_uint16 (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
182 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
183 virtual int is_uint32 (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
184 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
185 virtual int is_uint64 (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
186 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
187 virtual int is_uint8 (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
188 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
189 virtual int is_logical_scalar (void) const |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
190 { |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
191 return is_logical () && get_number_of_elements () == 1; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
192 } |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
193 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
194 virtual int is_logical_scalar_true (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
195 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
196 virtual mwSize get_m (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
197 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
198 virtual mwSize get_n (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
199 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
200 virtual mwSize *get_dimensions (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
201 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
202 virtual mwSize get_number_of_dimensions (void) const = 0; |
6686 | 203 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
204 virtual void set_m (mwSize m) = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
205 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
206 virtual void set_n (mwSize n) = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
207 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
208 virtual void set_dimensions (mwSize *dims_arg, mwSize ndims_arg) = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
209 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
210 virtual mwSize get_number_of_elements (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
211 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
212 virtual int is_empty (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
213 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
214 virtual mxClassID get_class_id (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
215 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
216 virtual const char *get_class_name (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
217 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
218 virtual void set_class_name (const char *name_arg) = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
219 |
21151
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
21066
diff
changeset
|
220 // FIXME: Why not just have this '= 0' as the others? |
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
21066
diff
changeset
|
221 // Could then eliminate err_invalid_type function and #include "error.h". |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
222 virtual mxArray *get_cell (mwIndex /*idx*/) const |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
223 { |
21151
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
21066
diff
changeset
|
224 err_invalid_type (); |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
225 } |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
226 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
227 virtual void set_cell (mwIndex idx, mxArray *val) = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
228 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
229 virtual double get_scalar (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
230 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
231 virtual void *get_data (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
232 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
233 virtual void *get_imag_data (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
234 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
235 virtual void set_data (void *pr) = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
236 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
237 virtual void set_imag_data (void *pi) = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
238 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
239 virtual mwIndex *get_ir (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
240 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
241 virtual mwIndex *get_jc (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
242 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
243 virtual mwSize get_nzmax (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
244 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
245 virtual void set_ir (mwIndex *ir) = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
246 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
247 virtual void set_jc (mwIndex *jc) = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
248 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
249 virtual void set_nzmax (mwSize nzmax) = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
250 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
251 virtual int add_field (const char *key) = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
252 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
253 virtual void remove_field (int key_num) = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
254 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
255 virtual mxArray *get_field_by_number (mwIndex index, int key_num) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
256 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
257 virtual void |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
258 set_field_by_number (mwIndex index, int key_num, mxArray *val) = 0; |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
259 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
260 virtual int get_number_of_fields (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
261 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
262 virtual const char *get_field_name_by_number (int key_num) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
263 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
264 virtual int get_field_number (const char *key) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
265 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
266 virtual int get_string (char *buf, mwSize buflen) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
267 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
268 virtual char *array_to_string (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
269 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
270 virtual mwIndex calc_single_subscript (mwSize nsubs, mwIndex *subs) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
271 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
272 virtual size_t get_element_size (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
273 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
274 virtual bool mutation_needed (void) const { return false; } |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
275 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
276 virtual mxArray *mutate (void) const { return 0; } |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
277 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
278 virtual octave_value as_octave_value (void) const = 0; |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
279 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
280 protected: |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
281 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
282 mxArray_base (const mxArray_base&) { } |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
283 |
21151
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
21066
diff
changeset
|
284 // FIXME: Deprecated in 4.2, remove in 4.6 |
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
21066
diff
changeset
|
285 OCTAVE_DEPRECATED ("use 'err_invalid_type' instead") |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
286 void invalid_type_error (void) const |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
287 { |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
288 error ("invalid type for operation"); |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
289 } |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
290 |
21151
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
21066
diff
changeset
|
291 OCTAVE_NORETURN void err_invalid_type (void) const |
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
21066
diff
changeset
|
292 { |
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
21066
diff
changeset
|
293 error ("invalid type for operation"); |
bfd5e48c41a1
Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents:
21066
diff
changeset
|
294 } |
6686 | 295 }; |
296 | |
297 // The main interface class. The representation can be based on an | |
298 // octave_value object or a separate object that tries to reproduce | |
299 // the semantics of mxArray objects in Matlab more directly. | |
300 | |
301 class mxArray | |
302 { | |
303 public: | |
304 | |
305 mxArray (const octave_value& ov); | |
306 | |
307 mxArray (mxClassID id, mwSize ndims, const mwSize *dims, | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9906
diff
changeset
|
308 mxComplexity flag = mxREAL); |
6686 | 309 |
310 mxArray (mxClassID id, const dim_vector& dv, mxComplexity flag = mxREAL); | |
311 | |
312 mxArray (mxClassID id, mwSize m, mwSize n, mxComplexity flag = mxREAL); | |
313 | |
314 mxArray (mxClassID id, double val); | |
315 | |
316 mxArray (mxClassID id, mxLogical val); | |
317 | |
318 mxArray (const char *str); | |
319 | |
6806 | 320 mxArray (mwSize m, const char **str); |
6686 | 321 |
6806 | 322 mxArray (mxClassID id, mwSize m, mwSize n, mwSize nzmax, |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9906
diff
changeset
|
323 mxComplexity flag = mxREAL); |
6686 | 324 |
325 mxArray (mwSize ndims, const mwSize *dims, int num_keys, const char **keys); | |
326 | |
327 mxArray (const dim_vector& dv, int num_keys, const char **keys); | |
328 | |
329 mxArray (mwSize m, mwSize n, int num_keys, const char **keys); | |
330 | |
331 mxArray (mwSize ndims, const mwSize *dims); | |
332 | |
333 mxArray (const dim_vector& dv); | |
334 | |
335 mxArray (mwSize m, mwSize n); | |
336 | |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
337 mxArray *dup (void) const |
6686 | 338 { |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
339 mxArray *retval = rep->as_mxArray (); |
6686 | 340 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
341 if (retval) |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
342 retval->set_name (name); |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
343 else |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
344 { |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
345 mxArray_base *new_rep = rep->dup (); |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
346 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
347 retval = new mxArray (new_rep, name); |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
348 } |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
349 |
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
350 return retval; |
6686 | 351 } |
352 | |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
353 ~mxArray (void); |
6686 | 354 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
355 bool is_octave_value (void) const { return rep->is_octave_value (); } |
6686 | 356 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
357 int is_cell (void) const { return rep->is_cell (); } |
6686 | 358 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
359 int is_char (void) const { return rep->is_char (); } |
6686 | 360 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
361 int is_class (const char *name_arg) const { return rep->is_class (name_arg); } |
6686 | 362 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
363 int is_complex (void) const { return rep->is_complex (); } |
6686 | 364 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
365 int is_double (void) const { return rep->is_double (); } |
6686 | 366 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
367 int is_function_handle (void) const { return rep->is_function_handle (); } |
11100
cdf940db26a0
provide mxIsFunctionHandle MEX interface function
John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
368 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
369 int is_int16 (void) const { return rep->is_int16 (); } |
6686 | 370 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
371 int is_int32 (void) const { return rep->is_int32 (); } |
6686 | 372 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
373 int is_int64 (void) const { return rep->is_int64 (); } |
6686 | 374 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
375 int is_int8 (void) const { return rep->is_int8 (); } |
6686 | 376 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
377 int is_logical (void) const { return rep->is_logical (); } |
6686 | 378 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
379 int is_numeric (void) const { return rep->is_numeric (); } |
6686 | 380 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
381 int is_single (void) const { return rep->is_single (); } |
6686 | 382 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
383 int is_sparse (void) const { return rep->is_sparse (); } |
6686 | 384 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
385 int is_struct (void) const { return rep->is_struct (); } |
6686 | 386 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
387 int is_uint16 (void) const { return rep->is_uint16 (); } |
6686 | 388 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
389 int is_uint32 (void) const { return rep->is_uint32 (); } |
6686 | 390 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
391 int is_uint64 (void) const { return rep->is_uint64 (); } |
6686 | 392 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
393 int is_uint8 (void) const { return rep->is_uint8 (); } |
6686 | 394 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
395 int is_logical_scalar (void) const { return rep->is_logical_scalar (); } |
6686 | 396 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
397 int is_logical_scalar_true (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
398 { return rep->is_logical_scalar_true (); } |
6686 | 399 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
400 mwSize get_m (void) const { return rep->get_m (); } |
6686 | 401 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
402 mwSize get_n (void) const { return rep->get_n (); } |
6686 | 403 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
404 mwSize *get_dimensions (void) const { return rep->get_dimensions (); } |
6686 | 405 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
406 mwSize get_number_of_dimensions (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
407 { return rep->get_number_of_dimensions (); } |
6686 | 408 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
409 void set_m (mwSize m) { DO_VOID_MUTABLE_METHOD (set_m (m)); } |
6686 | 410 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
411 void set_n (mwSize n) { DO_VOID_MUTABLE_METHOD (set_n (n)); } |
6686 | 412 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
413 void set_dimensions (mwSize *dims_arg, mwSize ndims_arg) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
414 { DO_VOID_MUTABLE_METHOD (set_dimensions (dims_arg, ndims_arg)); } |
6686 | 415 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
416 mwSize get_number_of_elements (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
417 { return rep->get_number_of_elements (); } |
6686 | 418 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
419 int is_empty (void) const { return get_number_of_elements () == 0; } |
6686 | 420 |
421 const char *get_name (void) const { return name; } | |
422 | |
423 void set_name (const char *name_arg); | |
424 | |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
425 mxClassID get_class_id (void) const { return rep->get_class_id (); } |
6686 | 426 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
427 const char *get_class_name (void) const { return rep->get_class_name (); } |
6686 | 428 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
429 void set_class_name (const char *name_arg) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
430 { DO_VOID_MUTABLE_METHOD (set_class_name (name_arg)); } |
6686 | 431 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
432 mxArray *get_cell (mwIndex idx) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
433 { DO_MUTABLE_METHOD (mxArray *, get_cell (idx)); } |
6686 | 434 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
435 void set_cell (mwIndex idx, mxArray *val) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
436 { DO_VOID_MUTABLE_METHOD (set_cell (idx, val)); } |
6686 | 437 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
438 double get_scalar (void) const { return rep->get_scalar (); } |
6686 | 439 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
440 void *get_data (void) const { DO_MUTABLE_METHOD (void *, get_data ()); } |
6686 | 441 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
442 void *get_imag_data (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
443 { DO_MUTABLE_METHOD (void *, get_imag_data ()); } |
6686 | 444 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
445 void set_data (void *pr) { DO_VOID_MUTABLE_METHOD (set_data (pr)); } |
6686 | 446 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
447 void set_imag_data (void *pi) { DO_VOID_MUTABLE_METHOD (set_imag_data (pi)); } |
6686 | 448 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
449 mwIndex *get_ir (void) const { DO_MUTABLE_METHOD (mwIndex *, get_ir ()); } |
6686 | 450 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
451 mwIndex *get_jc (void) const { DO_MUTABLE_METHOD (mwIndex *, get_jc ()); } |
6686 | 452 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
453 mwSize get_nzmax (void) const { return rep->get_nzmax (); } |
6686 | 454 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
455 void set_ir (mwIndex *ir) { DO_VOID_MUTABLE_METHOD (set_ir (ir)); } |
6686 | 456 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
457 void set_jc (mwIndex *jc) { DO_VOID_MUTABLE_METHOD (set_jc (jc)); } |
6686 | 458 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
459 void set_nzmax (mwSize nzmax) { DO_VOID_MUTABLE_METHOD (set_nzmax (nzmax)); } |
6686 | 460 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
461 int add_field (const char *key) { DO_MUTABLE_METHOD (int, add_field (key)); } |
6686 | 462 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
463 void remove_field (int key_num) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
464 { DO_VOID_MUTABLE_METHOD (remove_field (key_num)); } |
6686 | 465 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
466 mxArray *get_field_by_number (mwIndex index, int key_num) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
467 { DO_MUTABLE_METHOD (mxArray *, get_field_by_number (index, key_num)); } |
6686 | 468 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
469 void set_field_by_number (mwIndex index, int key_num, mxArray *val) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
470 { DO_VOID_MUTABLE_METHOD (set_field_by_number (index, key_num, val)); } |
6686 | 471 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
472 int get_number_of_fields (void) const { return rep->get_number_of_fields (); } |
6686 | 473 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
474 const char *get_field_name_by_number (int key_num) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
475 { DO_MUTABLE_METHOD (const char*, get_field_name_by_number (key_num)); } |
6686 | 476 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
477 int get_field_number (const char *key) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
478 { DO_MUTABLE_METHOD (int, get_field_number (key)); } |
6686 | 479 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
480 int get_string (char *buf, mwSize buflen) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
481 { return rep->get_string (buf, buflen); } |
6686 | 482 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
483 char *array_to_string (void) const { return rep->array_to_string (); } |
6686 | 484 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
485 mwIndex calc_single_subscript (mwSize nsubs, mwIndex *subs) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
486 { return rep->calc_single_subscript (nsubs, subs); } |
6686 | 487 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
488 size_t get_element_size (void) const { return rep->get_element_size (); } |
6686 | 489 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
490 bool mutation_needed (void) const { return rep->mutation_needed (); } |
6686 | 491 |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
492 mxArray *mutate (void) const { return rep->mutate (); } |
6686 | 493 |
494 static void *malloc (size_t n); | |
495 | |
496 static void *calloc (size_t n, size_t t); | |
497 | |
498 static char *strsave (const char *str) | |
499 { | |
500 char *retval = 0; | |
501 | |
502 if (str) | |
503 { | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9906
diff
changeset
|
504 mwSize sz = sizeof (mxChar) * (strlen (str) + 1); |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9906
diff
changeset
|
505 retval = static_cast<char *> (mxArray::malloc (sz)); |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9906
diff
changeset
|
506 strcpy (retval, str); |
6686 | 507 } |
508 | |
509 return retval; | |
510 } | |
511 | |
15353
5f3a69a309a7
fix decl of mexPutVariable
John W. Eaton <jwe@octave.org>
parents:
15351
diff
changeset
|
512 static octave_value as_octave_value (const mxArray *ptr); |
6686 | 513 |
514 protected: | |
515 | |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
516 octave_value as_octave_value (void) const; |
6686 | 517 |
518 private: | |
519 | |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
520 mutable mxArray_base *rep; |
6686 | 521 |
522 char *name; | |
523 | |
15351
a291f850743c
modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents:
15240
diff
changeset
|
524 mxArray (mxArray_base *r, const char *n) |
15354
93dff6435fe1
tag calls to mxArray::malloc, mxArray::calloc, and mxArray::strsave with class name
John W. Eaton <jwe@octave.org>
parents:
15353
diff
changeset
|
525 : rep (r), name (mxArray::strsave (n)) { } |
6686 | 526 |
527 void maybe_mutate (void) const; | |
528 | |
529 // No copying! | |
530 | |
531 mxArray (const mxArray&); | |
532 | |
533 mxArray& operator = (const mxArray&); | |
534 }; | |
535 | |
536 #undef DO_MUTABLE_METHOD | |
537 #undef DO_VOID_MUTABLE_METHOD | |
538 | |
539 #endif | |
540 #endif |