GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
mxarray.in.h
Go to the documentation of this file.
1 // %NO_EDIT_WARNING%
2 
3 ////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (C) 2001-2021 The Octave Project Developers
6 //
7 // See the file COPYRIGHT.md in the top-level directory of this
8 // distribution or <https://octave.org/copyright/>.
9 //
10 // This file is part of Octave.
11 //
12 // Octave is free software: you can redistribute it and/or modify it
13 // under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // Octave is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with Octave; see the file COPYING. If not, see
24 // <https://www.gnu.org/licenses/>.
25 //
26 ////////////////////////////////////////////////////////////////////////
27 
28 /*
29 
30 Part of this code was originally distributed as part of Octave Forge under
31 the following terms:
32 
33 Author: Paul Kienzle
34 I grant this code to the public domain.
35 2001-03-22
36 
37 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
38 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
40 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
41 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
42 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
43 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
45 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
46 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 SUCH DAMAGE.
48 
49 */
50 
51 #if ! defined (octave_mxarray_h)
52 #define octave_mxarray_h 1
53 
54 #include "octave-config.h"
55 
56 typedef enum
57 {
75 }
76 mxClassID;
77 
78 typedef enum
79 {
80  mxREAL = 0,
81  mxCOMPLEX = 1
82 }
84 
85 /* Matlab uses a wide char (uint16) internally, but Octave uses plain char. */
86 /* typedef Uint16 mxChar; */
87 typedef char mxChar;
88 
89 typedef unsigned char mxLogical;
90 
91 /*
92  * FIXME: Mathworks says mwSize, mwIndex should be int generally.
93  * But on 64-bit systems, or when mex -largeArrayDims is used, it is size_t.
94  * mwSignedIndex is supposed to be ptrdiff_t. All of this is confusing.
95  * Its better to conform to the same indexing as the rest of Octave.
96  */
97 typedef %OCTAVE_IDX_TYPE% mwSize;
98 typedef %OCTAVE_IDX_TYPE% mwIndex;
99 typedef %OCTAVE_IDX_TYPE% mwSignedIndex;
100 
101 #if ! defined (MXARRAY_TYPEDEFS_ONLY)
102 
103 #include <cstring>
104 #include "error.h"
105 
106 class octave_value;
107 class dim_vector;
108 
109 #define DO_MUTABLE_METHOD(RET_T, METHOD_CALL) \
110  RET_T retval = rep->METHOD_CALL; \
111  \
112  if (rep->mutation_needed ()) \
113  { \
114  maybe_mutate (); \
115  retval = rep->METHOD_CALL; \
116  } \
117  \
118  return retval
119 
120 #define DO_VOID_MUTABLE_METHOD(METHOD_CALL) \
121  rep->METHOD_CALL; \
122  \
123  if (rep->mutation_needed ()) \
124  { \
125  maybe_mutate (); \
126  rep->METHOD_CALL; \
127  }
128 
129 class mxArray;
130 
131 // A class to provide the default implementation of some of the
132 // virtual functions declared in the mxArray class.
133 
135 {
136 protected:
137 
138  mxArray_base (void) { }
139 
140 public:
141 
142  virtual mxArray_base * dup (void) const = 0;
143 
144  virtual mxArray * as_mxArray (void) const { return nullptr; }
145 
146  virtual ~mxArray_base (void) = default;
147 
148  virtual bool is_octave_value (void) const { return false; }
149 
150  virtual int iscell (void) const = 0;
151 
152  virtual int is_char (void) const = 0;
153 
154  virtual int is_class (const char *name_arg) const
155  {
156  int retval = 0;
157 
158  const char *cname = get_class_name ();
159 
160  if (cname && name_arg)
161  retval = ! strcmp (cname, name_arg);
162 
163  return retval;
164  }
165 
166  virtual int is_complex (void) const = 0;
167 
168  virtual int is_double (void) const = 0;
169 
170  virtual int is_function_handle (void) const = 0;
171 
172  virtual int is_int16 (void) const = 0;
173 
174  virtual int is_int32 (void) const = 0;
175 
176  virtual int is_int64 (void) const = 0;
177 
178  virtual int is_int8 (void) const = 0;
179 
180  virtual int is_logical (void) const = 0;
181 
182  virtual int is_numeric (void) const = 0;
183 
184  virtual int is_single (void) const = 0;
185 
186  virtual int is_sparse (void) const = 0;
187 
188  virtual int is_struct (void) const = 0;
189 
190  virtual int is_uint16 (void) const = 0;
191 
192  virtual int is_uint32 (void) const = 0;
193 
194  virtual int is_uint64 (void) const = 0;
195 
196  virtual int is_uint8 (void) const = 0;
197 
198  virtual int is_logical_scalar (void) const
199  {
200  return is_logical () && get_number_of_elements () == 1;
201  }
202 
203  virtual int is_logical_scalar_true (void) const = 0;
204 
205  virtual mwSize get_m (void) const = 0;
206 
207  virtual mwSize get_n (void) const = 0;
208 
209  virtual mwSize * get_dimensions (void) const = 0;
210 
211  virtual mwSize get_number_of_dimensions (void) const = 0;
212 
213  virtual void set_m (mwSize m) = 0;
214 
215  virtual void set_n (mwSize n) = 0;
216 
217  virtual int set_dimensions (mwSize *dims_arg, mwSize ndims_arg) = 0;
218 
219  virtual mwSize get_number_of_elements (void) const = 0;
220 
221  virtual int isempty (void) const = 0;
222 
223  virtual bool is_scalar (void) const = 0;
224 
225  virtual mxClassID get_class_id (void) const = 0;
226 
227  virtual const char * get_class_name (void) const = 0;
228 
229  virtual void set_class_name (const char *name_arg) = 0;
230 
231  // The following functions aren't pure virtual because they are only
232  // valid for one type. Making them pure virtual would mean that they
233  // have to be implemented for all derived types, and all of those
234  // would need to throw errors instead of just doing it once here.
235 
236  virtual mxArray *
237  get_property (mwIndex /*idx*/, const char * /*pname*/) const
238  {
239  return nullptr;
240  }
241 
242  virtual void set_property (mwIndex /*idx*/, const char * /*pname*/,
243  const mxArray * /*pval*/)
244  {
245  err_invalid_type ();
246  }
247 
248  virtual mxArray * get_cell (mwIndex /*idx*/) const
249  {
250  err_invalid_type ();
251  }
252 
253  virtual void set_cell (mwIndex idx, mxArray *val) = 0;
254 
255  virtual double get_scalar (void) const = 0;
256 
257  virtual void * get_data (void) const = 0;
258 
259  virtual void * get_imag_data (void) const = 0;
260 
261  virtual void set_data (void *pr) = 0;
262 
263  virtual void set_imag_data (void *pi) = 0;
264 
265  virtual mwIndex * get_ir (void) const = 0;
266 
267  virtual mwIndex * get_jc (void) const = 0;
268 
269  virtual mwSize get_nzmax (void) const = 0;
270 
271  virtual void set_ir (mwIndex *ir) = 0;
272 
273  virtual void set_jc (mwIndex *jc) = 0;
274 
275  virtual void set_nzmax (mwSize nzmax) = 0;
276 
277  virtual int add_field (const char *key) = 0;
278 
279  virtual void remove_field (int key_num) = 0;
280 
281  virtual mxArray * get_field_by_number (mwIndex index, int key_num) const = 0;
282 
283  virtual void
284  set_field_by_number (mwIndex index, int key_num, mxArray *val) = 0;
285 
286  virtual int get_number_of_fields (void) const = 0;
287 
288  virtual const char * get_field_name_by_number (int key_num) const = 0;
289 
290  virtual int get_field_number (const char *key) const = 0;
291 
292  virtual int get_string (char *buf, mwSize buflen) const = 0;
293 
294  virtual char * array_to_string (void) const = 0;
295 
296  virtual mwIndex calc_single_subscript (mwSize nsubs, mwIndex *subs) const = 0;
297 
298  virtual size_t get_element_size (void) const = 0;
299 
300  virtual bool mutation_needed (void) const { return false; }
301 
302  virtual mxArray * mutate (void) const { return nullptr; }
303 
304  virtual octave_value as_octave_value (void) const = 0;
305 
306 protected:
307 
309 
310  OCTAVE_NORETURN void err_invalid_type (void) const
311  {
312  error ("invalid type for operation");
313  }
314 };
315 
316 // The main interface class. The representation can be based on an
317 // octave_value object or a separate object that tries to reproduce
318 // the semantics of mxArray objects in Matlab more directly.
319 
320 class mxArray
321 {
322 public:
323 
324  mxArray (const octave_value& ov);
325 
326  mxArray (mxClassID id, mwSize ndims, const mwSize *dims,
327  mxComplexity flag = mxREAL, bool init = true);
328 
329  mxArray (mxClassID id, const dim_vector& dv, mxComplexity flag = mxREAL);
330 
332  mxComplexity flag = mxREAL, bool init = true);
333 
334  mxArray (mxClassID id, double val);
335 
336  mxArray (mxClassID id, mxLogical val);
337 
338  mxArray (const char *str);
339 
340  mxArray (mwSize m, const char **str);
341 
342  mxArray (mxClassID id, mwSize m, mwSize n, mwSize nzmax,
343  mxComplexity flag = mxREAL);
344 
345  mxArray (mwSize ndims, const mwSize *dims, int num_keys, const char **keys);
346 
347  mxArray (const dim_vector& dv, int num_keys, const char **keys);
348 
349  mxArray (mwSize m, mwSize n, int num_keys, const char **keys);
350 
351  mxArray (mwSize ndims, const mwSize *dims);
352 
353  mxArray (const dim_vector& dv);
354 
355  mxArray (mwSize m, mwSize n);
356 
357  mxArray * dup (void) const
358  {
359  mxArray *retval = rep->as_mxArray ();
360 
361  if (retval)
362  retval->set_name (name);
363  else
364  {
365  mxArray_base *new_rep = rep->dup ();
366 
367  retval = new mxArray (new_rep, name);
368  }
369 
370  return retval;
371  }
372 
373  // No copying!
374 
375  mxArray (const mxArray&) = delete;
376 
377  mxArray& operator = (const mxArray&) = delete;
378 
379  ~mxArray (void);
380 
381  bool is_octave_value (void) const { return rep->is_octave_value (); }
382 
383  int iscell (void) const { return rep->iscell (); }
384 
385  int is_char (void) const { return rep->is_char (); }
386 
387  int is_class (const char *name_arg) const { return rep->is_class (name_arg); }
388 
389  int is_complex (void) const { return rep->is_complex (); }
390 
391  int is_double (void) const { return rep->is_double (); }
392 
393  int is_function_handle (void) const { return rep->is_function_handle (); }
394 
395  int is_int16 (void) const { return rep->is_int16 (); }
396 
397  int is_int32 (void) const { return rep->is_int32 (); }
398 
399  int is_int64 (void) const { return rep->is_int64 (); }
400 
401  int is_int8 (void) const { return rep->is_int8 (); }
402 
403  int is_logical (void) const { return rep->is_logical (); }
404 
405  int is_numeric (void) const { return rep->is_numeric (); }
406 
407  int is_single (void) const { return rep->is_single (); }
408 
409  int is_sparse (void) const { return rep->is_sparse (); }
410 
411  int is_struct (void) const { return rep->is_struct (); }
412 
413  int is_uint16 (void) const { return rep->is_uint16 (); }
414 
415  int is_uint32 (void) const { return rep->is_uint32 (); }
416 
417  int is_uint64 (void) const { return rep->is_uint64 (); }
418 
419  int is_uint8 (void) const { return rep->is_uint8 (); }
420 
421  int is_logical_scalar (void) const { return rep->is_logical_scalar (); }
422 
423  int is_logical_scalar_true (void) const
424  { return rep->is_logical_scalar_true (); }
425 
426  mwSize get_m (void) const { return rep->get_m (); }
427 
428  mwSize get_n (void) const { return rep->get_n (); }
429 
430  mwSize * get_dimensions (void) const { return rep->get_dimensions (); }
431 
433  { return rep->get_number_of_dimensions (); }
434 
436 
438 
439  int set_dimensions (mwSize *dims_arg, mwSize ndims_arg)
440  { DO_MUTABLE_METHOD (int, set_dimensions (dims_arg, ndims_arg)); }
441 
443  { return rep->get_number_of_elements (); }
444 
445  int isempty (void) const { return get_number_of_elements () == 0; }
446 
447  bool is_scalar (void) const { return rep->is_scalar (); }
448 
449  const char * get_name (void) const { return name; }
450 
451  void set_name (const char *name_arg);
452 
453  mxClassID get_class_id (void) const { return rep->get_class_id (); }
454 
455  const char * get_class_name (void) const { return rep->get_class_name (); }
456 
457  mxArray * get_property (mwIndex idx, const char *pname) const
458  { return rep->get_property (idx, pname); }
459 
460  void set_property (mwIndex idx, const char *pname, const mxArray *pval)
461  { rep->set_property (idx, pname, pval); }
462 
463  void set_class_name (const char *name_arg)
464  { DO_VOID_MUTABLE_METHOD (set_class_name (name_arg)); }
465 
466  mxArray * get_cell (mwIndex idx) const
467  { DO_MUTABLE_METHOD (mxArray *, get_cell (idx)); }
468 
469  void set_cell (mwIndex idx, mxArray *val)
470  { DO_VOID_MUTABLE_METHOD (set_cell (idx, val)); }
471 
472  double get_scalar (void) const { return rep->get_scalar (); }
473 
474  void * get_data (void) const { DO_MUTABLE_METHOD (void *, get_data ()); }
475 
476  void * get_imag_data (void) const
477  { DO_MUTABLE_METHOD (void *, get_imag_data ()); }
478 
479  void set_data (void *pr) { DO_VOID_MUTABLE_METHOD (set_data (pr)); }
480 
482 
483  mwIndex * get_ir (void) const { DO_MUTABLE_METHOD (mwIndex *, get_ir ()); }
484 
485  mwIndex * get_jc (void) const { DO_MUTABLE_METHOD (mwIndex *, get_jc ()); }
486 
487  mwSize get_nzmax (void) const { return rep->get_nzmax (); }
488 
490 
492 
493  void set_nzmax (mwSize nzmax) { DO_VOID_MUTABLE_METHOD (set_nzmax (nzmax)); }
494 
495  int add_field (const char *key) { DO_MUTABLE_METHOD (int, add_field (key)); }
496 
497  void remove_field (int key_num)
498  { DO_VOID_MUTABLE_METHOD (remove_field (key_num)); }
499 
500  mxArray * get_field_by_number (mwIndex index, int key_num) const
501  { DO_MUTABLE_METHOD (mxArray *, get_field_by_number (index, key_num)); }
502 
503  void set_field_by_number (mwIndex index, int key_num, mxArray *val)
504  { DO_VOID_MUTABLE_METHOD (set_field_by_number (index, key_num, val)); }
505 
506  int get_number_of_fields (void) const { return rep->get_number_of_fields (); }
507 
508  const char * get_field_name_by_number (int key_num) const
509  { DO_MUTABLE_METHOD (const char*, get_field_name_by_number (key_num)); }
510 
511  int get_field_number (const char *key) const
512  { DO_MUTABLE_METHOD (int, get_field_number (key)); }
513 
514  int get_string (char *buf, mwSize buflen) const
515  { return rep->get_string (buf, buflen); }
516 
517  char * array_to_string (void) const { return rep->array_to_string (); }
518 
520  { return rep->calc_single_subscript (nsubs, subs); }
521 
522  size_t get_element_size (void) const { return rep->get_element_size (); }
523 
524  bool mutation_needed (void) const { return rep->mutation_needed (); }
525 
526  mxArray * mutate (void) const { return rep->mutate (); }
527 
528  static void * malloc (size_t n);
529 
530  static void * calloc (size_t n, size_t t);
531 
532  static char * strsave (const char *str)
533  {
534  char *retval = nullptr;
535 
536  if (str)
537  {
538  mwSize sz = sizeof (mxChar) * (strlen (str) + 1);
539 
540  retval = static_cast<char *> (mxArray::malloc (sz));
541 
542  if (retval)
543  strcpy (retval, str);
544  }
545 
546  return retval;
547  }
548 
549  static octave_value
550  as_octave_value (const mxArray *ptr, bool null_is_empty = true);
551 
552  octave_value as_octave_value (void) const;
553 
554 private:
555 
556  mutable mxArray_base *rep;
557 
558  char *name;
559 
560  mxArray (mxArray_base *r, const char *n)
561  : rep (r), name (mxArray::strsave (n)) { }
562 
563  void maybe_mutate (void) const;
564 };
565 
566 #undef DO_MUTABLE_METHOD
567 #undef DO_VOID_MUTABLE_METHOD
568 
569 #endif
570 #endif
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:95
virtual int is_logical(void) const =0
virtual void set_n(mwSize n)=0
virtual void set_cell(mwIndex idx, mxArray *val)=0
virtual int is_int32(void) const =0
virtual int add_field(const char *key)=0
virtual void set_nzmax(mwSize nzmax)=0
virtual int is_logical_scalar_true(void) const =0
virtual int is_uint16(void) const =0
virtual int get_string(char *buf, mwSize buflen) const =0
virtual int is_double(void) const =0
virtual mwIndex calc_single_subscript(mwSize nsubs, mwIndex *subs) const =0
mxArray_base(const mxArray_base &)
Definition: mxarray.in.h:308
virtual mxArray * get_cell(mwIndex) const
Definition: mxarray.in.h:248
virtual mxArray * as_mxArray(void) const
Definition: mxarray.in.h:144
virtual mxArray * mutate(void) const
Definition: mxarray.in.h:302
virtual int is_numeric(void) const =0
virtual int is_function_handle(void) const =0
virtual mwSize * get_dimensions(void) const =0
virtual void * get_imag_data(void) const =0
virtual void set_imag_data(void *pi)=0
virtual mxArray * get_field_by_number(mwIndex index, int key_num) const =0
virtual void set_m(mwSize m)=0
virtual void set_data(void *pr)=0
virtual mwSize get_number_of_elements(void) const =0
virtual int is_logical_scalar(void) const
Definition: mxarray.in.h:198
virtual int is_struct(void) const =0
virtual bool is_scalar(void) const =0
virtual int is_class(const char *name_arg) const
Definition: mxarray.in.h:154
virtual int is_single(void) const =0
virtual const char * get_class_name(void) const =0
virtual int get_number_of_fields(void) const =0
virtual int is_sparse(void) const =0
virtual mwSize get_nzmax(void) const =0
virtual int is_int16(void) const =0
virtual void set_property(mwIndex, const char *, const mxArray *)
Definition: mxarray.in.h:242
virtual int is_char(void) const =0
virtual char * array_to_string(void) const =0
virtual ~mxArray_base(void)=default
virtual bool mutation_needed(void) const
Definition: mxarray.in.h:300
virtual void * get_data(void) const =0
virtual mwSize get_m(void) const =0
virtual int is_uint32(void) const =0
virtual void set_jc(mwIndex *jc)=0
virtual mwIndex * get_ir(void) const =0
virtual bool is_octave_value(void) const
Definition: mxarray.in.h:148
virtual int is_uint64(void) const =0
virtual int is_int64(void) const =0
virtual mwSize get_number_of_dimensions(void) const =0
virtual int is_int8(void) const =0
virtual int is_complex(void) const =0
virtual int set_dimensions(mwSize *dims_arg, mwSize ndims_arg)=0
OCTAVE_NORETURN void err_invalid_type(void) const
Definition: mxarray.in.h:310
virtual void set_class_name(const char *name_arg)=0
virtual mwIndex * get_jc(void) const =0
virtual size_t get_element_size(void) const =0
virtual double get_scalar(void) const =0
virtual mwSize get_n(void) const =0
virtual int is_uint8(void) const =0
virtual int isempty(void) const =0
virtual mxArray_base * dup(void) const =0
virtual void set_ir(mwIndex *ir)=0
virtual void remove_field(int key_num)=0
virtual mxArray * get_property(mwIndex, const char *) const
Definition: mxarray.in.h:237
virtual const char * get_field_name_by_number(int key_num) const =0
virtual void set_field_by_number(mwIndex index, int key_num, mxArray *val)=0
virtual octave_value as_octave_value(void) const =0
mxArray_base(void)
Definition: mxarray.in.h:138
virtual int get_field_number(const char *key) const =0
virtual int iscell(void) const =0
virtual mxClassID get_class_id(void) const =0
mxArray & operator=(const mxArray &)=delete
mxClassID get_class_id(void) const
Definition: mxarray.in.h:453
int is_int64(void) const
Definition: mxarray.in.h:399
int is_single(void) const
Definition: mxarray.in.h:407
mxArray(const octave_value &ov)
Definition: mex.cc:2024
void maybe_mutate(void) const
Definition: mex.cc:2104
void * get_imag_data(void) const
Definition: mxarray.in.h:476
size_t get_element_size(void) const
Definition: mxarray.in.h:522
mxArray_base * rep
Definition: mxarray.in.h:556
static void * malloc(size_t n)
Definition: mex.cc:2452
const char * get_class_name(void) const
Definition: mxarray.in.h:455
void set_n(mwSize n)
Definition: mxarray.in.h:437
static void * calloc(size_t n, size_t t)
Definition: mex.cc:2458
bool mutation_needed(void) const
Definition: mxarray.in.h:524
int is_logical_scalar_true(void) const
Definition: mxarray.in.h:423
int is_uint32(void) const
Definition: mxarray.in.h:415
int is_char(void) const
Definition: mxarray.in.h:385
bool is_octave_value(void) const
Definition: mxarray.in.h:381
~mxArray(void)
Definition: mex.cc:2073
void set_property(mwIndex idx, const char *pname, const mxArray *pval)
Definition: mxarray.in.h:460
void set_m(mwSize m)
Definition: mxarray.in.h:435
mxArray * get_property(mwIndex idx, const char *pname) const
Definition: mxarray.in.h:457
mxArray * dup(void) const
Definition: mxarray.in.h:357
void * get_data(void) const
Definition: mxarray.in.h:474
mwIndex * get_jc(void) const
Definition: mxarray.in.h:485
mwIndex calc_single_subscript(mwSize nsubs, mwIndex *subs) const
Definition: mxarray.in.h:519
int is_function_handle(void) const
Definition: mxarray.in.h:393
int set_dimensions(mwSize *dims_arg, mwSize ndims_arg)
Definition: mxarray.in.h:439
static char * strsave(const char *str)
Definition: mxarray.in.h:532
int isempty(void) const
Definition: mxarray.in.h:445
mwSize get_m(void) const
Definition: mxarray.in.h:426
void set_data(void *pr)
Definition: mxarray.in.h:479
int is_uint64(void) const
Definition: mxarray.in.h:417
int is_struct(void) const
Definition: mxarray.in.h:411
int get_field_number(const char *key) const
Definition: mxarray.in.h:511
mxArray(mxArray_base *r, const char *n)
Definition: mxarray.in.h:560
int iscell(void) const
Definition: mxarray.in.h:383
mxArray * mutate(void) const
Definition: mxarray.in.h:526
mxArray * get_field_by_number(mwIndex index, int key_num) const
Definition: mxarray.in.h:500
int add_field(const char *key)
Definition: mxarray.in.h:495
int is_int8(void) const
Definition: mxarray.in.h:401
int get_number_of_fields(void) const
Definition: mxarray.in.h:506
int is_sparse(void) const
Definition: mxarray.in.h:409
int is_double(void) const
Definition: mxarray.in.h:391
char * name
Definition: mxarray.in.h:558
mwSize get_nzmax(void) const
Definition: mxarray.in.h:487
int is_uint8(void) const
Definition: mxarray.in.h:419
mwIndex * get_ir(void) const
Definition: mxarray.in.h:483
bool is_scalar(void) const
Definition: mxarray.in.h:447
void set_nzmax(mwSize nzmax)
Definition: mxarray.in.h:493
int is_logical(void) const
Definition: mxarray.in.h:403
int is_int16(void) const
Definition: mxarray.in.h:395
double get_scalar(void) const
Definition: mxarray.in.h:472
void set_jc(mwIndex *jc)
Definition: mxarray.in.h:491
mwSize get_number_of_dimensions(void) const
Definition: mxarray.in.h:432
mxArray(const mxArray &)=delete
const char * get_name(void) const
Definition: mxarray.in.h:449
int is_numeric(void) const
Definition: mxarray.in.h:405
mwSize get_number_of_elements(void) const
Definition: mxarray.in.h:442
const char * get_field_name_by_number(int key_num) const
Definition: mxarray.in.h:508
int get_string(char *buf, mwSize buflen) const
Definition: mxarray.in.h:514
int is_class(const char *name_arg) const
Definition: mxarray.in.h:387
mwSize get_n(void) const
Definition: mxarray.in.h:428
void set_class_name(const char *name_arg)
Definition: mxarray.in.h:463
int is_complex(void) const
Definition: mxarray.in.h:389
void set_name(const char *name_arg)
Definition: mex.cc:2081
int is_uint16(void) const
Definition: mxarray.in.h:413
void set_field_by_number(mwIndex index, int key_num, mxArray *val)
Definition: mxarray.in.h:503
void set_cell(mwIndex idx, mxArray *val)
Definition: mxarray.in.h:469
mxArray * get_cell(mwIndex idx) const
Definition: mxarray.in.h:466
void set_ir(mwIndex *ir)
Definition: mxarray.in.h:489
char * array_to_string(void) const
Definition: mxarray.in.h:517
int is_logical_scalar(void) const
Definition: mxarray.in.h:421
octave_value as_octave_value(void) const
Definition: mex.cc:2098
mwSize * get_dimensions(void) const
Definition: mxarray.in.h:430
void set_imag_data(void *pi)
Definition: mxarray.in.h:481
void remove_field(int key_num)
Definition: mxarray.in.h:497
int is_int32(void) const
Definition: mxarray.in.h:397
void error(const char *fmt,...)
Definition: error.cc:968
T octave_idx_type m
Definition: mx-inlines.cc:773
octave_idx_type n
Definition: mx-inlines.cc:753
T * r
Definition: mx-inlines.cc:773
char mxChar
Definition: mxarray.in.h:87
OCTAVE_IDX_TYPE mwSignedIndex
Definition: mxarray.in.h:99
OCTAVE_IDX_TYPE mwSize
Definition: mxarray.in.h:97
mxClassID
Definition: mxarray.in.h:57
@ mxFUNCTION_CLASS
Definition: mxarray.in.h:74
@ mxINT8_CLASS
Definition: mxarray.in.h:66
@ mxINT64_CLASS
Definition: mxarray.in.h:72
@ mxUINT8_CLASS
Definition: mxarray.in.h:67
@ mxUNKNOWN_CLASS
Definition: mxarray.in.h:58
@ mxLOGICAL_CLASS
Definition: mxarray.in.h:61
@ mxSTRUCT_CLASS
Definition: mxarray.in.h:60
@ mxINT32_CLASS
Definition: mxarray.in.h:70
@ mxSINGLE_CLASS
Definition: mxarray.in.h:65
@ mxVOID_CLASS
Definition: mxarray.in.h:63
@ mxDOUBLE_CLASS
Definition: mxarray.in.h:64
@ mxUINT64_CLASS
Definition: mxarray.in.h:73
@ mxCHAR_CLASS
Definition: mxarray.in.h:62
@ mxUINT16_CLASS
Definition: mxarray.in.h:69
@ mxCELL_CLASS
Definition: mxarray.in.h:59
@ mxUINT32_CLASS
Definition: mxarray.in.h:71
@ mxINT16_CLASS
Definition: mxarray.in.h:68
#define DO_VOID_MUTABLE_METHOD(METHOD_CALL)
Definition: mxarray.in.h:120
OCTAVE_IDX_TYPE mwIndex
Definition: mxarray.in.h:98
mxComplexity
Definition: mxarray.in.h:79
@ mxREAL
Definition: mxarray.in.h:80
@ mxCOMPLEX
Definition: mxarray.in.h:81
#define DO_MUTABLE_METHOD(RET_T, METHOD_CALL)
Definition: mxarray.in.h:109
unsigned char mxLogical
Definition: mxarray.in.h:89
static const double pi
Definition: lo-specfun.cc:1995
bool strcmp(const T &str_a, const T &str_b)
True if strings are the same.
Definition: oct-string.cc:122
T::size_type strlen(const typename T::value_type *str)
Definition: oct-string.cc:85
octave_value::octave_value(const Array< char > &chm, char type) return retval
Definition: ov.cc:811