annotate libinterp/corefcn/mxarray.in.h @ 23795:980f39c3ab90

Use C++11 nullptr rather than 0 in code (bug #51565). * Backend.cc, BaseControl.h, ButtonGroup.cc, CheckBoxControl.cc, Container.cc, ContextMenu.cc, ContextMenu.h, EditControl.cc, Figure.cc, FigureWindow.cc, ListBoxControl.cc, Menu.cc, Menu.h, MouseModeActionGroup.cc, Object.cc, ObjectProxy.cc, Panel.cc, PopupMenuControl.cc, PushButtonControl.cc, PushTool.cc, RadioButtonControl.cc, SliderControl.cc, TextControl.cc, ToggleButtonControl.cc, ToggleTool.cc, ToolBar.cc, ToolBar.h, ToolBarButton.cc, ToolBarButton.h, QTerminal.h, BlockArray.cpp, Emulation.cpp, Filter.cpp, Filter.h, History.cpp, KeyboardTranslator.cpp, QUnixTerminalImpl.h, Screen.cpp, ScreenWindow.cpp, ScreenWindow.h, SelfListener.h, TerminalCharacterDecoder.cpp, TerminalModel.cpp, TerminalView.cpp, TerminalView.h, kpty.cpp, dialog.cc, dialog.h, files-dock-widget.cc, find-files-model.h, file-editor-tab.cc, file-editor.cc, main-window.cc, octave-dock-widget.cc, octave-gui.cc, parser.cc, resource-manager.cc, resource-manager.h, shortcut-manager.cc, shortcut-manager.h, workspace-model.cc, workspace-view.cc, __magick_read__.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, daspk.cc, dasrt.cc, dassl.cc, det.cc, display.h, error.cc, ft-text-renderer.cc, gl-render.cc, gl2ps-print.cc, graphics.in.h, help.cc, input.cc, interpreter.cc, load-path.cc, load-save.cc, ls-hdf5.cc, ls-hdf5.h, ls-mat5.cc, lsode.cc, mex.cc, mxarray.in.h, oct-errno.h, oct-hist.cc, oct-iostrm.h, oct-procbuf.cc, oct-procbuf.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.h, oct-tex-parser.in.yy, octave-link.h, pager.cc, pager.h, pr-output.cc, procstream.h, qz.cc, sighandlers.cc, svd.cc, symtab.cc, symtab.h, text-renderer.cc, txt-eng.h, utils.cc, variables.cc, zfstream.cc, zfstream.h, __glpk__.cc, __init_fltk__.cc, __ode15__.cc, audiodevinfo.cc, ccolamd.cc, colamd.cc, dmperm.cc, gzip.cc, symbfact.cc, ov-base-int.cc, ov-base-int.h, ov-base-mat.h, ov-base.cc, ov-base.h, ov-bool-mat.cc, ov-bool-sparse.cc, ov-bool.cc, ov-builtin.h, ov-cell.cc, ov-class.cc, ov-complex.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-fcn-handle.cc, ov-fcn-inline.cc, ov-fcn.cc, ov-fcn.h, ov-float.cc, ov-flt-complex.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-java.cc, ov-java.h, ov-mex-fcn.cc, ov-oncleanup.cc, ov-range.cc, ov-range.h, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, ov-str-mat.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, octave.cc, bp-table.cc, bp-table.h, jit-ir.h, jit-typeinfo.cc, lex.h, profiler.cc, pt-arg-list.cc, pt-array-list.cc, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-cell.cc, pt-classdef.cc, pt-classdef.h, pt-colon.cc, pt-colon.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-idx.cc, pt-jit.cc, pt-loop.h, pt-mat.cc, pt-select.h, pt-stmt.h, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt.cc, Array-C.cc, Array-d.cc, Array-f.cc, Array-fC.cc, Array-util.cc, Array.cc, Array.h, CMatrix.cc, CSparse.cc, DiagArray2.h, MArray.h, MDiagArray2.h, MatrixType.cc, Sparse.cc, Sparse.h, dMatrix.cc, dSparse.cc, fMatrix.cc, idx-vector.cc, idx-vector.h, DAEFunc.h, DAERTFunc.h, ODEFunc.h, ODESFunc.h, eigs-base.cc, oct-fftw.cc, oct-fftw.h, oct-rand.h, oct-spparms.h, schur.cc, sparse-chol.cc, sparse-dmsolve.cc, sparse-lu.cc, sparse-qr.cc, child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, lo-sysdep.cc, oct-env.h, oct-time.cc, cmd-edit.cc, cmd-edit.h, cmd-hist.h, lo-regexp.cc, lo-regexp.h, lo-utils.cc, oct-shlib.cc, oct-shlib.h, oct-sort.cc, oct-sort.h, quit.cc, singleton-cleanup.h, str-vec.cc: Use C++11 nullptr rather than 0 in code (bug #51565).
author Rik <rik@octave.org>
date Tue, 25 Jul 2017 14:54:10 -0700
parents c68c98d0b09f
children bd9e719f04cc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
2 /*
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
3
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
4 Copyright (C) 2001-2017 Paul Kienzle
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
5
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
6 This file is part of Octave.
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
7
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22471
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: 22471
diff changeset
10 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22471
diff changeset
11 (at your option) any later version.
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
12
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22471
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: 22471
diff changeset
14 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22471
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22471
diff changeset
16 GNU General Public License for more details.
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
17
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6806
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6806
diff changeset
20 <http://www.gnu.org/licenses/>.
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
21
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
22 */
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
23
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
24 /*
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
25
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
26 Part of this code was originally distributed as part of Octave Forge under
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
27 the following terms:
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
28
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
29 Author: Paul Kienzle
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
30 I grant this code to the public domain.
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
31 2001-03-22
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
32
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
33 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
34 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
35 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
36 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
37 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
38 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
39 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
40 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
41 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
42 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
43 SUCH DAMAGE.
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
44
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
45 */
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
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
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
49
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21241
diff changeset
50 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21241
diff changeset
51
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
52 typedef enum
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
53 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
54 mxUNKNOWN_CLASS = 0,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
55 mxCELL_CLASS,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
56 mxSTRUCT_CLASS,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
57 mxLOGICAL_CLASS,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
58 mxCHAR_CLASS,
22453
ca01dc025e2c Rename mxUNUSED_CLASS to mxVOID_CLASS for Matlab compatibility.
Rik <rik@octave.org>
parents: 22449
diff changeset
59 mxVOID_CLASS,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
60 mxDOUBLE_CLASS,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
61 mxSINGLE_CLASS,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
62 mxINT8_CLASS,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
63 mxUINT8_CLASS,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
64 mxINT16_CLASS,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
65 mxUINT16_CLASS,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
66 mxINT32_CLASS,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
67 mxUINT32_CLASS,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
68 mxINT64_CLASS,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
69 mxUINT64_CLASS,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
70 mxFUNCTION_CLASS
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
71 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
72 mxClassID;
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
73
22471
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
74 typedef enum
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
75 {
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
76 mxREAL = 0,
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
77 mxCOMPLEX = 1
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
78 }
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
79 mxComplexity;
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
80
22449
e337b8e3592c Fix double free causing segfault in mxSetDimensions (bug #49010).
Rik <rik@octave.org>
parents: 22407
diff changeset
81 /* Matlab uses a wide char (uint16) internally, but Octave uses plain char. */
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
82 /* typedef Uint16 mxChar; */
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
83 typedef char mxChar;
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
84
22471
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
85 typedef unsigned char mxLogical;
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
86
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
87 /*
22471
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
88 * FIXME: Mathworks says mwSize, mwIndex should be int generally.
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
89 * But on 64-bit systems, or when mex -largeArrayDims is used, it is size_t.
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
90 * mwSignedIndex is supposed to be ptrdiff_t. All of this is confusing.
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
91 * Its better to conform to the same indexing as the rest of Octave.
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
92 */
9906
8d20fb66a0dc more automake fixes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
93 typedef %OCTAVE_IDX_TYPE% mwSize;
8d20fb66a0dc more automake fixes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
94 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
95 typedef %OCTAVE_IDX_TYPE% mwSignedIndex;
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
96
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
97 #if ! defined (MXARRAY_TYPEDEFS_ONLY)
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
98
7417
33577b0d4df2 [project @ 2008-01-25 01:21:35 by jwe]
jwe
parents: 7056
diff changeset
99 #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
100 #include "error.h"
7417
33577b0d4df2 [project @ 2008-01-25 01:21:35 by jwe]
jwe
parents: 7056
diff changeset
101
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
102 class octave_value;
23442
53f5f8231c37 allow most header files to be compiled separately
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
103 class dim_vector;
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
104
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
105 #define DO_MUTABLE_METHOD(RET_T, METHOD_CALL) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
106 RET_T retval = rep->METHOD_CALL; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
107 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
108 if (rep->mutation_needed ()) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
109 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
110 maybe_mutate (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
111 retval = rep->METHOD_CALL; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
112 } \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
113 \
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
114 return retval
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
115
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
116 #define DO_VOID_MUTABLE_METHOD(METHOD_CALL) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
117 rep->METHOD_CALL; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
118 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
119 if (rep->mutation_needed ()) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
120 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
121 maybe_mutate (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21568
diff changeset
122 rep->METHOD_CALL; \
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
123 }
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
124
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
125 class mxArray;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
126
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
127 // 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
128 // virtual functions declared in the mxArray class.
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
129
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
130 class mxArray_base
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
131 {
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
132 protected:
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
133
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
134 mxArray_base (void) { }
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
135
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
136 public:
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
137
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
138 virtual mxArray_base * dup (void) const = 0;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
139
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23697
diff changeset
140 virtual mxArray * as_mxArray (void) const { return nullptr; }
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
141
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
142 virtual ~mxArray_base (void) = default;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
143
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
144 virtual bool is_octave_value (void) const { return false; }
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
145
23576
00e518162fda maint: Deprecate is_cell and replace with iscell.
Rik <rik@octave.org>
parents: 23457
diff changeset
146 virtual int iscell (void) const = 0;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
147
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
148 virtual int is_char (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
149
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
150 virtual int is_class (const char *name_arg) const
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
151 {
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
152 int retval = 0;
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 const char *cname = get_class_name ();
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 if (cname && name_arg)
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
157 retval = ! strcmp (cname, name_arg);
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 return retval;
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
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
162 virtual int is_complex (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
163
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
164 virtual int is_double (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
165
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
166 virtual int is_function_handle (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
167
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
168 virtual int is_int16 (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
169
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
170 virtual int is_int32 (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
171
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
172 virtual int is_int64 (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
173
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
174 virtual int is_int8 (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
175
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
176 virtual int is_logical (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
177
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
178 virtual int is_numeric (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
179
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
180 virtual int is_single (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
181
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
182 virtual int is_sparse (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
183
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
184 virtual int is_struct (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
185
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
186 virtual int is_uint16 (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
187
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
188 virtual int is_uint32 (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
189
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
190 virtual int is_uint64 (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
191
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
192 virtual int is_uint8 (void) const = 0;
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 (void) const
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 return is_logical () && get_number_of_elements () == 1;
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
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
199 virtual int is_logical_scalar_true (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
200
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
201 virtual mwSize get_m (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
202
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
203 virtual mwSize get_n (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
204
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
205 virtual mwSize * get_dimensions (void) const = 0;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
206
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
207 virtual mwSize get_number_of_dimensions (void) const = 0;
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
208
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
209 virtual void set_m (mwSize m) = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
210
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
211 virtual void set_n (mwSize n) = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
212
22471
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
213 virtual int set_dimensions (mwSize *dims_arg, mwSize ndims_arg) = 0;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
214
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
215 virtual mwSize get_number_of_elements (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
216
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
217 virtual int isempty (void) const = 0;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
218
22462
6cb7813e5b2f Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents: 22453
diff changeset
219 virtual bool is_scalar (void) const = 0;
6cb7813e5b2f Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents: 22453
diff changeset
220
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
221 virtual mxClassID get_class_id (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
222
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
223 virtual const char * get_class_name (void) const = 0;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
224
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
225 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
226
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
227 // 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
228 // Could then eliminate err_invalid_type function and #include "error.h".
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
229 virtual mxArray * get_cell (mwIndex /*idx*/) const
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
230 {
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
231 err_invalid_type ();
15351
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
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
234 virtual void set_cell (mwIndex idx, mxArray *val) = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
235
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
236 virtual double get_scalar (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
237
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
238 virtual void * get_data (void) const = 0;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
239
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
240 virtual void * get_imag_data (void) const = 0;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
241
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
242 virtual void set_data (void *pr) = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
243
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
244 virtual void set_imag_data (void *pi) = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
245
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
246 virtual mwIndex * get_ir (void) const = 0;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
247
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
248 virtual mwIndex * get_jc (void) const = 0;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
249
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
250 virtual mwSize get_nzmax (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
251
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
252 virtual void set_ir (mwIndex *ir) = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
253
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
254 virtual void set_jc (mwIndex *jc) = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
255
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
256 virtual void set_nzmax (mwSize nzmax) = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
257
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
258 virtual int add_field (const char *key) = 0;
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 void remove_field (int key_num) = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
261
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
262 virtual mxArray * get_field_by_number (mwIndex index, int key_num) const = 0;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
263
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
264 virtual void
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
265 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
266
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
267 virtual int get_number_of_fields (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
268
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
269 virtual const char * get_field_name_by_number (int key_num) const = 0;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
270
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
271 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
272
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
273 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
274
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
275 virtual char * array_to_string (void) const = 0;
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
276
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
277 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
278
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
279 virtual size_t get_element_size (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
280
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
281 virtual bool mutation_needed (void) const { return false; }
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
282
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23697
diff changeset
283 virtual mxArray * mutate (void) const { return nullptr; }
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
284
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
285 virtual octave_value as_octave_value (void) const = 0;
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
286
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
287 protected:
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
288
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
289 mxArray_base (const mxArray_base&) { }
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
290
23697
c68c98d0b09f * mxarray.in.h: Update version for deprecated function.
John W. Eaton <jwe@octave.org>
parents: 23615
diff changeset
291 OCTAVE_DEPRECATED (4.2, "use 'err_invalid_type' instead")
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
292 void invalid_type_error (void) const
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
293 {
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
294 error ("invalid type for operation");
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
295 }
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
296
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
297 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
298 {
bfd5e48c41a1 Rename local error in mex I/F from invalid_type_error to err_invalid_type.
Rik <rik@octave.org>
parents: 21066
diff changeset
299 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
300 }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
301 };
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
302
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
303 // The main interface class. The representation can be based on an
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
304 // octave_value object or a separate object that tries to reproduce
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
305 // the semantics of mxArray objects in Matlab more directly.
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
306
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
307 class mxArray
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
308 {
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
309 public:
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
310
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
311 mxArray (const octave_value& ov);
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
312
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
313 mxArray (mxClassID id, mwSize ndims, const mwSize *dims,
22464
1d2960b5efe6 Add new MEX fcns mxCreateUninitNumericArray, mxCreateUninitNumericMatrix.
Rik <rik@octave.org>
parents: 22462
diff changeset
314 mxComplexity flag = mxREAL, bool init = true);
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
315
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
316 mxArray (mxClassID id, const dim_vector& dv, mxComplexity flag = mxREAL);
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
317
22464
1d2960b5efe6 Add new MEX fcns mxCreateUninitNumericArray, mxCreateUninitNumericMatrix.
Rik <rik@octave.org>
parents: 22462
diff changeset
318 mxArray (mxClassID id, mwSize m, mwSize n,
1d2960b5efe6 Add new MEX fcns mxCreateUninitNumericArray, mxCreateUninitNumericMatrix.
Rik <rik@octave.org>
parents: 22462
diff changeset
319 mxComplexity flag = mxREAL, bool init = true);
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
320
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
321 mxArray (mxClassID id, double val);
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
322
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
323 mxArray (mxClassID id, mxLogical val);
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
324
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
325 mxArray (const char *str);
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
326
6806
afa9123c5faa [project @ 2007-07-30 18:36:01 by jwe]
jwe
parents: 6686
diff changeset
327 mxArray (mwSize m, const char **str);
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
328
6806
afa9123c5faa [project @ 2007-07-30 18:36:01 by jwe]
jwe
parents: 6686
diff changeset
329 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
330 mxComplexity flag = mxREAL);
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
331
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
332 mxArray (mwSize ndims, const mwSize *dims, int num_keys, const char **keys);
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
333
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
334 mxArray (const dim_vector& dv, int num_keys, const char **keys);
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
335
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
336 mxArray (mwSize m, mwSize n, int num_keys, const char **keys);
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
337
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
338 mxArray (mwSize ndims, const mwSize *dims);
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
339
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
340 mxArray (const dim_vector& dv);
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
341
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
342 mxArray (mwSize m, mwSize n);
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
343
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
344 mxArray * dup (void) const
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
345 {
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
346 mxArray *retval = rep->as_mxArray ();
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
347
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
348 if (retval)
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
349 retval->set_name (name);
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
350 else
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
351 {
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
352 mxArray_base *new_rep = rep->dup ();
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
353
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
354 retval = new mxArray (new_rep, name);
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
355 }
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
356
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
357 return retval;
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
358 }
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
359
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
360 // No copying!
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
361
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
362 mxArray (const mxArray&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
363
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
364 mxArray& operator = (const mxArray&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
365
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
366 ~mxArray (void);
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
367
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
368 bool is_octave_value (void) const { return rep->is_octave_value (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
369
23576
00e518162fda maint: Deprecate is_cell and replace with iscell.
Rik <rik@octave.org>
parents: 23457
diff changeset
370 int iscell (void) const { return rep->iscell (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
371
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
372 int is_char (void) const { return rep->is_char (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
373
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
374 int is_class (const char *name_arg) const { return rep->is_class (name_arg); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
375
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
376 int is_complex (void) const { return rep->is_complex (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
377
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
378 int is_double (void) const { return rep->is_double (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
379
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
380 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
381
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
382 int is_int16 (void) const { return rep->is_int16 (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
383
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
384 int is_int32 (void) const { return rep->is_int32 (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
385
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
386 int is_int64 (void) const { return rep->is_int64 (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
387
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
388 int is_int8 (void) const { return rep->is_int8 (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
389
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
390 int is_logical (void) const { return rep->is_logical (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
391
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
392 int is_numeric (void) const { return rep->is_numeric (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
393
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
394 int is_single (void) const { return rep->is_single (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
395
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
396 int is_sparse (void) const { return rep->is_sparse (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
397
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
398 int is_struct (void) const { return rep->is_struct (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
399
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
400 int is_uint16 (void) const { return rep->is_uint16 (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
401
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
402 int is_uint32 (void) const { return rep->is_uint32 (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
403
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
404 int is_uint64 (void) const { return rep->is_uint64 (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
405
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
406 int is_uint8 (void) const { return rep->is_uint8 (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
407
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
408 int is_logical_scalar (void) const { return rep->is_logical_scalar (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
409
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
410 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
411 { return rep->is_logical_scalar_true (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
412
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
413 mwSize get_m (void) const { return rep->get_m (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
414
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
415 mwSize get_n (void) const { return rep->get_n (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
416
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
417 mwSize * get_dimensions (void) const { return rep->get_dimensions (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
418
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
419 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
420 { return rep->get_number_of_dimensions (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
421
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
422 void set_m (mwSize m) { DO_VOID_MUTABLE_METHOD (set_m (m)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
423
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
424 void set_n (mwSize n) { DO_VOID_MUTABLE_METHOD (set_n (n)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
425
22471
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
426 int set_dimensions (mwSize *dims_arg, mwSize ndims_arg)
667d353d1ab8 Clean up MEX API prototypes to match Matlab.
Rik <rik@octave.org>
parents: 22464
diff changeset
427 { DO_MUTABLE_METHOD (int, set_dimensions (dims_arg, ndims_arg)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
428
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
429 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
430 { return rep->get_number_of_elements (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
431
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
432 int isempty (void) const { return get_number_of_elements () == 0; }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
433
22462
6cb7813e5b2f Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents: 22453
diff changeset
434 bool is_scalar (void) const { return rep->is_scalar (); }
6cb7813e5b2f Add new mxIsScalar function for MEX API.
Rik <rik@octave.org>
parents: 22453
diff changeset
435
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
436 const char * get_name (void) const { return name; }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
437
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
438 void set_name (const char *name_arg);
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
439
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
440 mxClassID get_class_id (void) const { return rep->get_class_id (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
441
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
442 const char * get_class_name (void) const { return rep->get_class_name (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
443
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
444 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
445 { DO_VOID_MUTABLE_METHOD (set_class_name (name_arg)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
446
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
447 mxArray * get_cell (mwIndex idx) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
448 { DO_MUTABLE_METHOD (mxArray *, get_cell (idx)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
449
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
450 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
451 { DO_VOID_MUTABLE_METHOD (set_cell (idx, val)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
452
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
453 double get_scalar (void) const { return rep->get_scalar (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
454
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
455 void * get_data (void) const { DO_MUTABLE_METHOD (void *, get_data ()); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
456
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
457 void * get_imag_data (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
458 { DO_MUTABLE_METHOD (void *, get_imag_data ()); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
459
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
460 void set_data (void *pr) { DO_VOID_MUTABLE_METHOD (set_data (pr)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
461
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
462 void set_imag_data (void *pi) { DO_VOID_MUTABLE_METHOD (set_imag_data (pi)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
463
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
464 mwIndex * get_ir (void) const { DO_MUTABLE_METHOD (mwIndex *, get_ir ()); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
465
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
466 mwIndex * get_jc (void) const { DO_MUTABLE_METHOD (mwIndex *, get_jc ()); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
467
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
468 mwSize get_nzmax (void) const { return rep->get_nzmax (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
469
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
470 void set_ir (mwIndex *ir) { DO_VOID_MUTABLE_METHOD (set_ir (ir)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
471
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
472 void set_jc (mwIndex *jc) { DO_VOID_MUTABLE_METHOD (set_jc (jc)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
473
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
474 void set_nzmax (mwSize nzmax) { DO_VOID_MUTABLE_METHOD (set_nzmax (nzmax)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
475
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
476 int add_field (const char *key) { DO_MUTABLE_METHOD (int, add_field (key)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
477
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
478 void remove_field (int key_num)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
479 { DO_VOID_MUTABLE_METHOD (remove_field (key_num)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
480
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
481 mxArray * get_field_by_number (mwIndex index, int key_num) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
482 { DO_MUTABLE_METHOD (mxArray *, get_field_by_number (index, key_num)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
483
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
484 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
485 { DO_VOID_MUTABLE_METHOD (set_field_by_number (index, key_num, val)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
486
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
487 int get_number_of_fields (void) const { return rep->get_number_of_fields (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
488
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
489 const char * get_field_name_by_number (int key_num) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
490 { DO_MUTABLE_METHOD (const char*, get_field_name_by_number (key_num)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
491
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
492 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
493 { DO_MUTABLE_METHOD (int, get_field_number (key)); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
494
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
495 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
496 { return rep->get_string (buf, buflen); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
497
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
498 char * array_to_string (void) const { return rep->array_to_string (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
499
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
500 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
501 { return rep->calc_single_subscript (nsubs, subs); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
502
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
503 size_t get_element_size (void) const { return rep->get_element_size (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
504
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
505 bool mutation_needed (void) const { return rep->mutation_needed (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
506
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
507 mxArray * mutate (void) const { return rep->mutate (); }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
508
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
509 static void * malloc (size_t n);
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
510
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
511 static void * calloc (size_t n, size_t t);
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
512
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23442
diff changeset
513 static char * strsave (const char *str)
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
514 {
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23446
diff changeset
515 char *retval = nullptr;
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
516
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
517 if (str)
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
518 {
21568
3d60ed163b70 maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents: 21244
diff changeset
519 mwSize sz = sizeof (mxChar) * (strlen (str) + 1);
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9906
diff changeset
520 retval = static_cast<char *> (mxArray::malloc (sz));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9906
diff changeset
521 strcpy (retval, str);
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
522 }
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
523
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
524 return retval;
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
525 }
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
526
15353
5f3a69a309a7 fix decl of mexPutVariable
John W. Eaton <jwe@octave.org>
parents: 15351
diff changeset
527 static octave_value as_octave_value (const mxArray *ptr);
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
528
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
529 protected:
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
530
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
531 octave_value as_octave_value (void) const;
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
532
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
533 private:
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
534
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
535 mutable mxArray_base *rep;
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
536
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
537 char *name;
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
538
15351
a291f850743c modernize mxArray class hierarchy
John W. Eaton <jwe@octave.org>
parents: 15240
diff changeset
539 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
540 : rep (r), name (mxArray::strsave (n)) { }
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
541
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
542 void maybe_mutate (void) const;
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
543 };
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
544
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
545 #undef DO_MUTABLE_METHOD
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
546 #undef DO_VOID_MUTABLE_METHOD
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
547
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
548 #endif
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents:
diff changeset
549 #endif