annotate libinterp/octave-value/cdef-object.h @ 30075:0e0cc2760540

maint: use "m_" prefix for member variables in some classdef classes. * cdef-class.h, cdef-class.cc, cdef-method.h, cdef-method.cc, cdef-object.h, cdef-object.cc, cdef-package.h, cdef-package.cc: Use "m_" prefix for class member variables.
author John W. Eaton <jwe@octave.org>
date Mon, 30 Aug 2021 13:33:47 -0400
parents 6549fa7558ba
children 91c6288781ba 838e73617671
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27971
diff changeset
3 // Copyright (C) 2012-2021 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 #if ! defined (octave_cdef_object_h)
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #define octave_cdef_object_h 1
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 #include "octave-config.h"
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 #include <map>
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 #include <string>
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 #include "oct-refcount.h"
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35
27130
396d17dcfb9f don't include error.h in ov-base.h
John W. Eaton <jwe@octave.org>
parents: 26774
diff changeset
36 #include "error.h"
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 #include "oct-map.h"
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 #include "ov.h"
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 #include "ovl.h"
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
41 namespace octave
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 {
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
43 class cdef_object;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
44 class cdef_class;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45
27971
ec769a7ab9fb fix more spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
46 // This is mainly a bootstrap class to declare the expected interface.
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
47 // The actual base class is cdef_class_base, which is declared after
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
48 // cdef_object, such that it can contain cdef_object objects.
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
50 class
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
51 OCTINTERP_API
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
52 cdef_object_rep
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 {
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
54 public:
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
55
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
56 friend class cdef_object;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
57
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
58 cdef_object_rep (void) : m_count (1) { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
60 cdef_object_rep& operator = (const cdef_object_rep&) = delete;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
61
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
62 virtual ~cdef_object_rep (void) = default;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
63
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
64 virtual cdef_class get_class (void) const;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
66 virtual void set_class (const cdef_class&)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
67 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
68 err_invalid_object ("set_class");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
69 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
71 virtual cdef_object_rep * clone (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
72 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
73 err_invalid_object ("clone");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
74 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
76 virtual cdef_object_rep * empty_clone (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
77 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
78 err_invalid_object ("empty_clone");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
79 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
81 virtual cdef_object_rep * copy (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
82 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
83 err_invalid_object ("copy");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
84 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
86 virtual cdef_object_rep * make_array (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
87 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
88 err_invalid_object ("make_array");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
89 }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
90
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
91 virtual bool is_array (void) const { return false; }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
92
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
93 virtual bool is_value_object (void) const { return false; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
94
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
95 virtual bool is_handle_object (void) const { return false; }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
96
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
97 virtual bool is_meta_object (void) const { return false; }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
98
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
99 virtual Array<cdef_object> array_value (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
100 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
101 err_invalid_object ("array_value");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
102 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
103
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
104 virtual void put (const std::string&, const octave_value&)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
105 { err_invalid_object ("put"); }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
106
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
107 virtual octave_value get (const std::string&) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
108 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
109 err_invalid_object ("get");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
110 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
111
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
112 virtual void set_property (octave_idx_type, const std::string&,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
113 const octave_value&)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
114 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
115 err_invalid_object ("set_property");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
116 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
117
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
118 virtual octave_value get_property (octave_idx_type, const std::string&) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
119 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
120 err_invalid_object ("get_property");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
121 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
122
29950
6549fa7558ba eliminate some unnecessary octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents: 29655
diff changeset
123 virtual void break_closure_cycles (const std::shared_ptr<stack_frame>&)
29476
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
124 {
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
125 err_invalid_object ("break_closure_cycles");
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
126 }
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
127
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
128 virtual octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
129 subsref (const std::string&, const std::list<octave_value_list>&,
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29476
diff changeset
130 int, std::size_t&, const cdef_class&, bool)
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
131 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
132 err_invalid_object ("subsref");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
133 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
134
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
135 virtual octave_value
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
136 subsasgn (const std::string&, const std::list<octave_value_list>&,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
137 const octave_value&)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
138 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
139 err_invalid_object ("subsasgn");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
140 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
141
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
142 virtual string_vector map_keys (void) const;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
143
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
144 virtual bool is_valid (void) const { return false; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
145
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
146 OCTINTERP_API std::string class_name (void) const;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
147
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
148 virtual void mark_for_construction (const cdef_class&)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
149 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
150 err_invalid_object ("mark_for_construction");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
151 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
152
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
153 virtual bool is_constructed_for (const cdef_class&) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
154 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
155 err_invalid_object ("is_constructed_for");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
156 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
157
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
158 virtual bool is_partially_constructed_for (const cdef_class&) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
159 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
160 err_invalid_object ("is_partially_constructed_for");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
161 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
162
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
163 virtual void mark_as_constructed (void)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
164 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
165 err_invalid_object ("mark_as_constructed");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
166 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
167
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
168 virtual void mark_as_constructed (const cdef_class&)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
169 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
170 err_invalid_object ("mark_as_constructed");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
171 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
172
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
173 virtual bool is_constructed (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
174 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
175 err_invalid_object ("is_constructed");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
176 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
177
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
178 virtual octave_idx_type static_count (void) const { return 0; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
179
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
180 virtual void destroy (void) { delete this; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
181
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
182 OCTINTERP_API void release (const cdef_object& obj);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
183
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
184 virtual dim_vector dims (void) const { return dim_vector (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
185
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
186 protected:
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
187
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
188 // Reference count
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
189 refcount<octave_idx_type> m_count;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
190
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
191 // Restricted copying.
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
192
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
193 cdef_object_rep (const cdef_object_rep&) : m_count (1) { }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
194
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
195 private:
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
196
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
197 OCTAVE_NORETURN void err_invalid_object (const char *who) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
198 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
199 error ("%s: invalid object", who);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
200 }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
201 };
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
202
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
203 class
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
204 cdef_object
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
205 {
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
206 public:
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
207
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
208 // FIXME: use a null object?
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
209 cdef_object (void) : m_rep (new cdef_object_rep ()) { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
210
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
211 cdef_object (const cdef_object& obj) : m_rep (obj.m_rep) { m_rep->m_count++; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
212
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
213 cdef_object (cdef_object_rep *r) : m_rep (r) { }
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
214
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
215 virtual ~cdef_object (void) { m_rep->release (*this); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
216
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
217 cdef_object& operator = (const cdef_object& obj)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
218 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
219 if (m_rep != obj.m_rep)
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
220 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
221 m_rep->release (*this);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
222
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
223 m_rep = obj.m_rep;
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
224 m_rep->m_count++;
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
225 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
226
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
227 return *this;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
228 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
229
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
230 OCTINTERP_API cdef_class get_class (void) const;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
231
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
232 void set_class (const cdef_class& cls) { m_rep->set_class (cls); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
233
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
234 std::string class_name (void) const { return m_rep->class_name (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
235
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
236 cdef_object clone (void) const { return cdef_object (m_rep->clone ()); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
237
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
238 cdef_object empty_clone (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
239 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
240 return cdef_object (m_rep->empty_clone ());
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
241 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
242
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
243 dim_vector dims (void) const { return m_rep->dims (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
244
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
245 cdef_object make_array (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
246 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
247 return cdef_object (m_rep->make_array ());
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
248 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
249
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
250 cdef_object copy (void) const { return cdef_object (m_rep->copy ()); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
251
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
252 bool is_array (void) const { return m_rep->is_array (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
253
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
254 bool is_value_object (void) const { return m_rep->is_value_object (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
255
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
256 bool is_handle_object (void) const { return m_rep->is_handle_object (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
257
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
258 bool is_meta_object (void) const { return m_rep->is_meta_object (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
259
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
260 Array<cdef_object> array_value (void) const { return m_rep->array_value (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
261
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
262 void put (const std::string& pname, const octave_value& val)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
263 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
264 m_rep->put (pname, val);
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
265 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
266
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
267 octave_value get (const std::string& pname) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
268 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
269 return m_rep->get (pname);
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
270 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
271
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
272 void set_property (octave_idx_type idx, const std::string& pname,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
273 const octave_value& pval)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
274 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
275 return m_rep->set_property (idx, pname, pval);
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
276 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
277
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
278 octave_value
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
279 get_property (octave_idx_type idx, const std::string& pname) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
280 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
281 return m_rep->get_property (idx, pname);
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
282 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
283
29950
6549fa7558ba eliminate some unnecessary octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents: 29655
diff changeset
284 void break_closure_cycles (const std::shared_ptr<stack_frame>& frame)
29476
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
285 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
286 m_rep->break_closure_cycles (frame);
29476
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
287 }
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
288
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
289 octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
290 subsref (const std::string& type, const std::list<octave_value_list>& idx,
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29476
diff changeset
291 int nargout, std::size_t& skip, const cdef_class& context,
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
292 bool auto_add = false)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
293 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
294 return m_rep->subsref (type, idx, nargout, skip, context, auto_add);
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
295 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
296
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
297 octave_value
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
298 subsasgn (const std::string& type, const std::list<octave_value_list>& idx,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
299 const octave_value& rhs, int ignore_copies = 0)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
300 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
301 make_unique (ignore_copies);
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
302 return m_rep->subsasgn (type, idx, rhs);
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
303 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
304
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
305 string_vector map_keys (void) const { return m_rep->map_keys (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
306
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
307 OCTINTERP_API octave_map map_value (void) const;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
308
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
309 const cdef_object_rep * get_rep (void) const { return m_rep; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
310
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
311 bool ok (void) const { return m_rep->is_valid (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
312
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
313 void mark_for_construction (const cdef_class& cls)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
314 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
315 m_rep->mark_for_construction (cls);
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
316 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
317
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
318 bool is_constructed (void) const { return m_rep->is_constructed (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
319
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
320 bool is_constructed_for (const cdef_class& cls) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
321 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
322 return m_rep->is_constructed_for (cls);
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
323 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
324
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
325 bool is_partially_constructed_for (const cdef_class& cls) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
326 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
327 return m_rep->is_partially_constructed_for (cls);
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
328 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
329
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
330 void mark_as_constructed (void) { m_rep->mark_as_constructed (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
331
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
332 void mark_as_constructed (const cdef_class& cls)
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
333 { m_rep->mark_as_constructed (cls); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
334
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
335 bool is (const cdef_object& obj) const { return m_rep == obj.m_rep; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
336
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
337 protected:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
338
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
339 cdef_object_rep * get_rep (void) { return m_rep; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
340
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
341 void make_unique (int ignore_copies)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
342 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
343 if (m_rep->m_count > ignore_copies + 1)
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
344 *this = clone ();
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
345 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
346
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
347 private:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
348
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
349 cdef_object_rep *m_rep;
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
350 };
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
351
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
352 class
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
353 cdef_object_base : public cdef_object_rep
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
354 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
355 public:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
356
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
357 cdef_object_base (void)
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
358 : cdef_object_rep (), m_klass ()
27445
c98953e85220 eliminate unused object_count variable in cdef_class_rep
John W. Eaton <jwe@octave.org>
parents: 27130
diff changeset
359 { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
360
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
361 cdef_object_base& operator = (const cdef_object_base&) = delete;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
362
27445
c98953e85220 eliminate unused object_count variable in cdef_class_rep
John W. Eaton <jwe@octave.org>
parents: 27130
diff changeset
363 ~cdef_object_base (void) { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
364
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
365 OCTINTERP_API cdef_class get_class (void) const;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
366
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
367 OCTINTERP_API void set_class (const cdef_class& cls);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
368
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
369 cdef_object_rep * empty_clone (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
370 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
371 return new cdef_object_base (*this);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
372 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
373
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
374 OCTINTERP_API cdef_object_rep * make_array (void) const;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
375
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
376 protected:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
377
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
378 // Restricted copying!
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
379 cdef_object_base (const cdef_object_base& obj)
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
380 : cdef_object_rep (obj), m_klass (obj.m_klass)
27445
c98953e85220 eliminate unused object_count variable in cdef_class_rep
John W. Eaton <jwe@octave.org>
parents: 27130
diff changeset
381 { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
382
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
383 private:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
384
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
385 // The class of the object
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
386 cdef_object m_klass;
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
387 };
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
388
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
389 class
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
390 cdef_object_array : public cdef_object_base
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
391 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
392 public:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
393
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
394 cdef_object_array (void) : cdef_object_base () { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
395
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
396 cdef_object_array (const Array<cdef_object>& a)
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
397 : cdef_object_base (), m_array (a)
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
398 { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
399
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
400 cdef_object_array& operator = (const cdef_object_array&) = delete;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
401
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
402 ~cdef_object_array (void) = default;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
403
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
404 cdef_object_rep * clone (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
405 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
406 return new cdef_object_array (*this);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
407 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
408
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
409 dim_vector dims (void) const { return m_array.dims (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
410
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
411 bool is_valid (void) const { return true; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
412
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
413 bool is_array (void) const { return true; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
414
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
415 Array<cdef_object> array_value (void) const { return m_array; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
416
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
417 OCTINTERP_API octave_value_list
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
418 subsref (const std::string& type, const std::list<octave_value_list>& idx,
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29476
diff changeset
419 int nargout, std::size_t& skip, const cdef_class& context,
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
420 bool auto_add);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
421
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
422 OCTINTERP_API octave_value
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
423 subsasgn (const std::string& type, const std::list<octave_value_list>& idx,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
424 const octave_value& rhs);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
425
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
426 void set_property (octave_idx_type idx, const std::string& pname,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
427 const octave_value& pval)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
428 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
429 cdef_object& tmp = m_array.elem (idx);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
430
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
431 return tmp.put (pname, pval);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
432 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
433
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
434 octave_value
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
435 get_property (octave_idx_type idx, const std::string& pname) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
436 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
437 cdef_object tmp = m_array.elem (idx);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
438
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
439 return tmp.get (pname);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
440 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
441
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
442 private:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
443
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
444 Array<cdef_object> m_array;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
445
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
446 void fill_empty_values (void) { fill_empty_values (m_array); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
447
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
448 OCTINTERP_API void fill_empty_values (Array<cdef_object>& arr);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
449
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
450 // Private copying!
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
451 cdef_object_array (const cdef_object_array& obj)
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
452 : cdef_object_base (obj), m_array (obj.m_array)
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
453 { }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
454 };
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
455
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
456 class
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
457 cdef_object_scalar : public cdef_object_base
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
458 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
459 public:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
460
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
461 cdef_object_scalar (void) : cdef_object_base () { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
462
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
463 cdef_object_scalar& operator = (const cdef_object_scalar&) = delete;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
464
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
465 ~cdef_object_scalar (void) = default;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
466
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
467 dim_vector dims (void) const { return dim_vector (1, 1); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
468
29950
6549fa7558ba eliminate some unnecessary octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents: 29655
diff changeset
469 void break_closure_cycles (const std::shared_ptr<stack_frame>& frame);
29476
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
470
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
471 void put (const std::string& pname, const octave_value& val)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
472 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
473 m_map.assign (pname, val);
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
474 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
475
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
476 octave_value get (const std::string& pname) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
477 {
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
478 Cell val = m_map.contents (pname);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
479
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
480 if (val.numel () < 1)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
481 error ("get: unknown slot: %s", pname.c_str ());
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
482
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
483 return val(0, 0);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
484 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
485
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
486 void set_property (octave_idx_type idx, const std::string& pname,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
487 const octave_value& pval)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
488 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
489 if (idx != 0)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
490 error ("invalid index"); // FIXME
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
491
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
492 put (pname, pval);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
493 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
494
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
495 octave_value
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
496 get_property (octave_idx_type idx, const std::string& pname) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
497 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
498 if (idx != 0)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
499 error ("invalid index"); // FIXME
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
500
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
501 return get (pname);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
502 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
503
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
504 OCTINTERP_API octave_value_list
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
505 subsref (const std::string& type, const std::list<octave_value_list>& idx,
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29476
diff changeset
506 int nargout, std::size_t& skip, const cdef_class& context,
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
507 bool auto_add);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
508
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
509 OCTINTERP_API octave_value
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
510 subsasgn (const std::string& type, const std::list<octave_value_list>& idx,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
511 const octave_value& rhs);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
512
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
513 OCTINTERP_API void mark_for_construction (const cdef_class&);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
514
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
515 OCTINTERP_API bool is_constructed_for (const cdef_class& cls) const;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
516
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
517 OCTINTERP_API bool
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
518 is_partially_constructed_for (const cdef_class& cls) const;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
519
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
520 void mark_as_constructed (void) { m_ctor_list.clear (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
521
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
522 OCTINTERP_API void mark_as_constructed (const cdef_class& cls);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
523
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
524 bool is_constructed (void) const { return m_ctor_list.empty (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
525
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
526 protected:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
527
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
528 // Object property values
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
529 octave_scalar_map m_map;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
530
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
531 // Internal/temporary structure used during object construction
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
532 std::map< cdef_class, std::list<cdef_class>> m_ctor_list;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
533
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
534 protected:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
535
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
536 // Restricted object copying!
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
537 cdef_object_scalar (const cdef_object_scalar& obj)
30075
0e0cc2760540 maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents: 29950
diff changeset
538 : cdef_object_base (obj), m_map (obj.m_map), m_ctor_list (obj.m_ctor_list)
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
539 { }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
540 };
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
541
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
542 class
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
543 handle_cdef_object : public cdef_object_scalar
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
544 {
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
545 public:
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
546
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
547 handle_cdef_object (void) : cdef_object_scalar () { }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
548
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
549 handle_cdef_object& operator = (const handle_cdef_object&) = delete;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
550
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
551 OCTINTERP_API ~handle_cdef_object (void);
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
552
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
553 cdef_object_rep * clone (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
554 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
555 handle_cdef_object *obj = const_cast<handle_cdef_object *> (this);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
556 obj->m_count++;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
557 return obj;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
558 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
559
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
560 cdef_object_rep * copy (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
561 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
562 return new handle_cdef_object (*this);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
563 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
564
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
565 bool is_valid (void) const { return true; }
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
566
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
567 bool is_handle_object (void) const { return true; }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
568
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
569 protected:
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
570
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
571 // Restricted copying!
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
572 handle_cdef_object (const handle_cdef_object& obj)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
573 : cdef_object_scalar (obj)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
574 { }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
575 };
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
576
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
577 class
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
578 value_cdef_object : public cdef_object_scalar
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
579 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
580 public:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
581
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
582 value_cdef_object (void) : cdef_object_scalar () { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
583
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
584 value_cdef_object& operator = (const value_cdef_object&) = delete;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
585
29234
853e60367cb6 Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27971
diff changeset
586 OCTINTERP_API ~value_cdef_object (void);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
587
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
588 cdef_object_rep * clone (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
589 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
590 return new value_cdef_object (*this);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
591 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
592
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
593 cdef_object_rep * copy (void) const { return clone (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
594
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
595 bool is_valid (void) const { return true; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
596
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
597 bool is_value_object (void) const { return true; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
598
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
599 private:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
600
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
601 // Private copying!
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
602 value_cdef_object (const value_cdef_object& obj)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
603 : cdef_object_scalar (obj)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
604 { }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
605 };
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
606
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
607 class
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
608 cdef_meta_object_rep : public handle_cdef_object
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
609 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
610 public:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
611
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
612 cdef_meta_object_rep (void) : handle_cdef_object () { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
613
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
614 cdef_meta_object_rep& operator = (const cdef_meta_object_rep&) = delete;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
615
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
616 ~cdef_meta_object_rep (void) = default;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
617
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
618 cdef_object_rep * copy (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
619 { return new cdef_meta_object_rep (*this); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
620
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
621 bool is_meta_object (void) const { return true; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
622
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
623 virtual bool is_class (void) const { return false; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
624
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
625 virtual bool is_property (void) const { return false; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
626
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
627 virtual bool is_method (void) const { return false; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
628
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
629 virtual bool is_package (void) const { return false; }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
630
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
631 virtual octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
632 meta_subsref (const std::string& /* type */,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
633 const std::list<octave_value_list>& /* idx */,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
634 int /* nargout */)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
635 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
636 error ("subsref: invalid meta object");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
637 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
638
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
639 virtual void meta_release (void) { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
640
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
641 virtual bool meta_accepts_postfix_index (char /* type */) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
642 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
643 return false;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
644 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
645
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
646 protected:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
647
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
648 // Restricted copying!
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
649 cdef_meta_object_rep (const cdef_meta_object_rep& obj)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
650 : handle_cdef_object (obj)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
651 { }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
652 };
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
653
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
654 class
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
655 cdef_meta_object : public cdef_object
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
656 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
657 public:
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
658
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
659 cdef_meta_object (void) : cdef_object () { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
660
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
661 // Object consistency is checked in sub-classes.
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
662 cdef_meta_object (const cdef_meta_object& obj) : cdef_object (obj) { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
663
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
664 cdef_meta_object (cdef_meta_object_rep *r) : cdef_object (r) { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
665
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
666 cdef_meta_object (const cdef_object& obj) : cdef_object (obj) { }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
667
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
668 cdef_meta_object& operator = (const cdef_object&) = delete;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
669
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
670 ~cdef_meta_object (void) = default;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
671
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
672 bool is_class (void) const { return get_rep ()->is_class (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
673
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
674 bool is_property (void) const { return get_rep ()->is_property (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
675
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
676 bool is_method (void) const { return get_rep ()->is_method (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
677
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
678 bool is_package (void) const { return get_rep ()->is_package (); }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
679
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
680 octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
681 meta_subsref (const std::string& type,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
682 const std::list<octave_value_list>& idx, int nargout)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
683 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
684 return get_rep ()->meta_subsref (type, idx, nargout);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
685 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
686
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
687 void meta_release (void) { get_rep ()->meta_release (); }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
688
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
689 bool meta_accepts_postfix_index (char type) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
690 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
691 return get_rep ()->meta_accepts_postfix_index (type);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
692 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
693
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
694 private:
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
695
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
696 cdef_meta_object_rep * get_rep (void)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
697 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
698 return dynamic_cast<cdef_meta_object_rep *> (cdef_object::get_rep ());
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
699 }
26771
b55f4781fc6e * cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
700
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
701 const cdef_meta_object_rep * get_rep (void) const
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
702 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
703 return dynamic_cast<const cdef_meta_object_rep *> (cdef_object::get_rep ());
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
704 }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
705 };
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26771
diff changeset
706 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
707
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
708 #endif