Mercurial > octave
annotate libinterp/octave-value/cdef-object.h @ 27971:ec769a7ab9fb
fix more spelling errors (bug #57613)
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 21 Jan 2020 09:20:15 -0600 |
parents | bd51beb6205e |
children | 853e60367cb6 0a5b15007766 |
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 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
3 // Copyright (C) 2012-2020 The Octave Project Developers |
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 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
51 cdef_object_rep |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 { |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
53 public: |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
54 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
55 friend class cdef_object; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
56 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
57 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
|
58 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
59 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
|
60 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
61 virtual ~cdef_object_rep (void) = default; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
62 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
63 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
|
64 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
65 virtual void set_class (const cdef_class&) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
66 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
67 err_invalid_object ("set_class"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
68 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
69 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
70 virtual cdef_object_rep * clone (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
71 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
72 err_invalid_object ("clone"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
73 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
74 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
75 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
|
76 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
77 err_invalid_object ("empty_clone"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
78 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
79 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
80 virtual cdef_object_rep * copy (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
81 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
82 err_invalid_object ("copy"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
83 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
84 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
85 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
|
86 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
87 err_invalid_object ("make_array"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
88 } |
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 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
|
91 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
92 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
|
93 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
94 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
|
95 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
96 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
|
97 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
98 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
|
99 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
100 err_invalid_object ("array_value"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
101 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
102 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
103 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
|
104 { err_invalid_object ("put"); } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
105 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
106 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
|
107 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
108 err_invalid_object ("get"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
109 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
110 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
111 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
|
112 const octave_value&) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
113 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
114 err_invalid_object ("set_property"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
115 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
116 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
117 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
|
118 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
119 err_invalid_object ("get_property"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
120 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
121 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
122 virtual octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
123 subsref (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
|
124 int, size_t&, const cdef_class&, bool) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
125 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
126 err_invalid_object ("subsref"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
127 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
128 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
129 virtual octave_value |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
130 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
|
131 const octave_value&) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
132 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
133 err_invalid_object ("subsasgn"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
134 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
135 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
136 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
|
137 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
138 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
|
139 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
140 std::string class_name (void) const; |
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 void mark_for_construction (const cdef_class&) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
143 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
144 err_invalid_object ("mark_for_construction"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
145 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
146 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
147 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
|
148 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
149 err_invalid_object ("is_constructed_for"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
150 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
151 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
152 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
|
153 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
154 err_invalid_object ("is_partially_constructed_for"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
155 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
156 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
157 virtual void mark_as_constructed (void) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
158 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
159 err_invalid_object ("mark_as_constructed"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
160 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
161 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
162 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
|
163 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
164 err_invalid_object ("mark_as_constructed"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
165 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
166 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
167 virtual bool is_constructed (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
168 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
169 err_invalid_object ("is_constructed"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
170 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
171 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
172 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
|
173 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
174 virtual void destroy (void) { delete this; } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
175 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
176 void release (const cdef_object& obj); |
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 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
|
179 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
180 protected: |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
181 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
182 // Reference count |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
183 refcount<octave_idx_type> m_count; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
184 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
185 // Restricted copying. |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
186 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
187 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
|
188 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
189 private: |
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 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
|
192 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
193 error ("%s: invalid object", who); |
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 }; |
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 class |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
198 cdef_object |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
199 { |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
200 public: |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
201 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
202 // FIXME: use a null object? |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
203 cdef_object (void) : rep (new cdef_object_rep ()) { } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
204 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
205 cdef_object (const cdef_object& obj) : rep (obj.rep) { rep->m_count++; } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
206 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
207 cdef_object (cdef_object_rep *r) : rep (r) { } |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
208 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
209 virtual ~cdef_object (void) { rep->release (*this); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
210 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
211 cdef_object& operator = (const cdef_object& obj) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
212 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
213 if (rep != obj.rep) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
214 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
215 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 rep = obj.rep; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
218 rep->m_count++; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
219 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
220 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
221 return *this; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
222 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
223 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
224 cdef_class get_class (void) const; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
225 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
226 void set_class (const cdef_class& cls) { rep->set_class (cls); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
227 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
228 std::string class_name (void) const { return rep->class_name (); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
229 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
230 cdef_object clone (void) const { return cdef_object (rep->clone ()); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
231 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
232 cdef_object empty_clone (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
233 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
234 return cdef_object (rep->empty_clone ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
235 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
236 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
237 dim_vector dims (void) const { return rep->dims (); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
238 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
239 cdef_object make_array (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
240 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
241 return cdef_object (rep->make_array ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
242 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
243 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
244 cdef_object copy (void) const { return cdef_object (rep->copy ()); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
245 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
246 bool is_array (void) const { return rep->is_array (); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
247 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
248 bool is_value_object (void) const { return rep->is_value_object (); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
249 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
250 bool is_handle_object (void) const { return rep->is_handle_object (); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
251 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
252 bool is_meta_object (void) const { return rep->is_meta_object (); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
253 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
254 Array<cdef_object> array_value (void) const { return rep->array_value (); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
255 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
256 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
|
257 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
258 rep->put (pname, val); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
259 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
260 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
261 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
|
262 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
263 return rep->get (pname); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
264 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
265 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
266 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
|
267 const octave_value& pval) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
268 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
269 return rep->set_property (idx, pname, pval); |
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 octave_value |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
273 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
|
274 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
275 return rep->get_property (idx, pname); |
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_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
279 subsref (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
|
280 int nargout, size_t& skip, const cdef_class& context, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
281 bool auto_add = false) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
282 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
283 return rep->subsref (type, idx, nargout, skip, context, auto_add); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
284 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
285 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
286 octave_value |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
287 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
|
288 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
|
289 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
290 make_unique (ignore_copies); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
291 return rep->subsasgn (type, idx, rhs); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
292 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
293 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
294 string_vector map_keys (void) const { return rep->map_keys (); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
295 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
296 octave_map map_value (void) const; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
297 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
298 const cdef_object_rep * get_rep (void) const { return rep; } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
299 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
300 bool ok (void) const { return rep->is_valid (); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
301 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
302 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
|
303 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
304 rep->mark_for_construction (cls); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
305 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
306 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
307 bool is_constructed (void) const { return rep->is_constructed (); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
308 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
309 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
|
310 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
311 return rep->is_constructed_for (cls); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
312 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
313 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
314 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
|
315 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
316 return rep->is_partially_constructed_for (cls); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
317 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
318 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
319 void mark_as_constructed (void) { rep->mark_as_constructed (); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
320 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
321 void mark_as_constructed (const cdef_class& cls) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
322 { rep->mark_as_constructed (cls); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
323 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
324 bool is (const cdef_object& obj) const { return rep == obj.rep; } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
325 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
326 protected: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
327 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
328 cdef_object_rep * get_rep (void) { return rep; } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
329 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
330 void make_unique (int ignore_copies) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
331 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
332 if (rep->m_count > ignore_copies + 1) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
333 *this = clone (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
334 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
335 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
336 private: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
337 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
338 cdef_object_rep *rep; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
339 }; |
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 class |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
342 cdef_object_base : public cdef_object_rep |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
343 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
344 public: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
345 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
346 cdef_object_base (void) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
347 : cdef_object_rep (), klass () |
27445
c98953e85220
eliminate unused object_count variable in cdef_class_rep
John W. Eaton <jwe@octave.org>
parents:
27130
diff
changeset
|
348 { } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
349 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
350 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
|
351 |
27445
c98953e85220
eliminate unused object_count variable in cdef_class_rep
John W. Eaton <jwe@octave.org>
parents:
27130
diff
changeset
|
352 ~cdef_object_base (void) { } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
353 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
354 cdef_class get_class (void) const; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
355 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
356 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
|
357 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
358 cdef_object_rep * empty_clone (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
359 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
360 return new cdef_object_base (*this); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
361 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
362 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
363 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
|
364 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
365 protected: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
366 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
367 // Restricted copying! |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
368 cdef_object_base (const cdef_object_base& obj) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
369 : cdef_object_rep (obj), klass (obj.klass) |
27445
c98953e85220
eliminate unused object_count variable in cdef_class_rep
John W. Eaton <jwe@octave.org>
parents:
27130
diff
changeset
|
370 { } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
371 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
372 private: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
373 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
374 // The class of the object |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
375 cdef_object klass; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
376 }; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
377 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
378 class |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
379 cdef_object_array : public cdef_object_base |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
380 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
381 public: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
382 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
383 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
|
384 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
385 cdef_object_array (const Array<cdef_object>& a) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
386 : cdef_object_base (), array (a) |
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 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
|
390 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
391 ~cdef_object_array (void) = default; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
392 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
393 cdef_object_rep * clone (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
394 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
395 return new cdef_object_array (*this); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
396 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
397 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
398 dim_vector dims (void) const { return array.dims (); } |
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 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
|
401 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
402 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
|
403 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
404 Array<cdef_object> array_value (void) const { return array; } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
405 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
406 octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
407 subsref (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
|
408 int nargout, size_t& skip, const cdef_class& context, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
409 bool auto_add); |
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 octave_value |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
412 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
|
413 const octave_value& rhs); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
414 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
415 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
|
416 const octave_value& pval) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
417 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
418 cdef_object& tmp = array.elem (idx); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
419 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
420 return tmp.put (pname, pval); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
421 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
422 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
423 octave_value |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
424 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
|
425 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
426 cdef_object tmp = array.elem (idx); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
427 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
428 return tmp.get (pname); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
429 } |
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 private: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
432 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
433 Array<cdef_object> array; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
434 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
435 void fill_empty_values (void) { fill_empty_values (array); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
436 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
437 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
|
438 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
439 // Private copying! |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
440 cdef_object_array (const cdef_object_array& obj) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
441 : cdef_object_base (obj), array (obj.array) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
442 { } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
443 }; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
444 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
445 class |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
446 cdef_object_scalar : public cdef_object_base |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
447 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
448 public: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
449 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
450 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
|
451 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
452 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
|
453 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
454 ~cdef_object_scalar (void) = default; |
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 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
|
457 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
458 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
|
459 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
460 map.assign (pname, val); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
461 } |
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 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
|
464 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
465 Cell val = map.contents (pname); |
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 if (val.numel () < 1) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
468 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
|
469 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
470 return val(0, 0); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
471 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
472 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
473 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
|
474 const octave_value& pval) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
475 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
476 if (idx != 0) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
477 error ("invalid index"); // FIXME |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
478 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
479 put (pname, pval); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
480 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
481 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
482 octave_value |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
483 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
|
484 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
485 if (idx != 0) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
486 error ("invalid index"); // FIXME |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
487 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
488 return get (pname); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
489 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
490 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
491 octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
492 subsref (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
|
493 int nargout, size_t& skip, const cdef_class& context, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
494 bool auto_add); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
495 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
496 octave_value |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
497 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
|
498 const octave_value& rhs); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
499 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
500 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
|
501 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
502 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
|
503 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
504 bool 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
|
505 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
506 void mark_as_constructed (void) { ctor_list.clear (); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
507 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
508 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
|
509 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
510 bool is_constructed (void) const { return ctor_list.empty (); } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
511 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
512 protected: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
513 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
514 // Object property values |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
515 octave_scalar_map map; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
516 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
517 // Internal/temporary structure used during object construction |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
518 std::map< cdef_class, std::list<cdef_class>> ctor_list; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
519 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
520 protected: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
521 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
522 // Restricted object copying! |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
523 cdef_object_scalar (const cdef_object_scalar& obj) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
524 : cdef_object_base (obj), map (obj.map), ctor_list (obj.ctor_list) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
525 { } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
526 }; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
527 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
528 class |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
529 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
|
530 { |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
531 public: |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
532 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
533 handle_cdef_object (void) : cdef_object_scalar () { } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
534 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
535 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
|
536 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
537 ~handle_cdef_object (void); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
538 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
539 cdef_object_rep * clone (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
540 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
541 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
|
542 obj->m_count++; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
543 return obj; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
544 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
545 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
546 cdef_object_rep * copy (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
547 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
548 return new handle_cdef_object (*this); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
549 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
550 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
551 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
|
552 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
553 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
|
554 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
555 protected: |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
556 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
557 // Restricted copying! |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
558 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
|
559 : cdef_object_scalar (obj) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
560 { } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
561 }; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
562 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
563 class |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
564 value_cdef_object : public cdef_object_scalar |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
565 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
566 public: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
567 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
568 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
|
569 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
570 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
|
571 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
572 ~value_cdef_object (void); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
573 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
574 cdef_object_rep * clone (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
575 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
576 return new value_cdef_object (*this); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
577 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
578 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
579 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
|
580 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
581 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
|
582 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
583 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
|
584 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
585 private: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
586 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
587 // Private copying! |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
588 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
|
589 : cdef_object_scalar (obj) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
590 { } |
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 class |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
594 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
|
595 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
596 public: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
597 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
598 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
|
599 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
600 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
|
601 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
602 ~cdef_meta_object_rep (void) = default; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
603 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
604 cdef_object_rep * copy (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
605 { 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
|
606 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
607 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
|
608 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
609 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
|
610 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
611 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
|
612 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
613 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
|
614 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
615 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
|
616 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
617 virtual octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
618 meta_subsref (const std::string& /* type */, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
619 const std::list<octave_value_list>& /* idx */, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
620 int /* nargout */) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
621 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
622 error ("subsref: invalid meta object"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
623 } |
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 void meta_release (void) { } |
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 meta_accepts_postfix_index (char /* type */) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
628 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
629 return false; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
630 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
631 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
632 protected: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
633 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
634 // Restricted copying! |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
635 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
|
636 : handle_cdef_object (obj) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
637 { } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
638 }; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
639 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
640 class |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
641 cdef_meta_object : public cdef_object |
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 public: |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
644 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
645 cdef_meta_object (void) : cdef_object () { } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
646 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
647 // Object consistency is checked in sub-classes. |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
648 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
|
649 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
650 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
|
651 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
652 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
|
653 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
654 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
|
655 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
656 ~cdef_meta_object (void) = default; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
657 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
658 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
|
659 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
660 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
|
661 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
662 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
|
663 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
664 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
|
665 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
666 octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
667 meta_subsref (const std::string& type, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
668 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
|
669 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
670 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
|
671 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
672 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
673 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
|
674 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
675 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
|
676 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
677 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
|
678 } |
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 private: |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
681 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
682 cdef_meta_object_rep * get_rep (void) |
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 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
|
685 } |
26771
b55f4781fc6e
* cdef-object.h, cdef-object.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
686 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
687 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
|
688 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
689 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
|
690 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26771
diff
changeset
|
691 }; |
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 |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
694 #endif |