Mercurial > hg > octave-nkf
annotate src/ov-struct.h @ 12386:c1ea9b90a272 release-3-4-x
Added tag ss-3-3-92 for changeset c468c5b902b3
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 06 Feb 2011 07:30:27 -0500 |
parents | 12df7854fa7c |
children | 72c96de7a403 |
rev | line source |
---|---|
2376 | 1 /* |
2 | |
11523 | 3 Copyright (C) 1996-2011 John W. Eaton |
2376 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2376 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2376 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_struct_h) | |
24 #define octave_struct_h 1 | |
25 | |
26 #include <cstdlib> | |
27 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
28 #include <iosfwd> |
2376 | 29 #include <string> |
30 | |
31 #include "mx-base.h" | |
32 #include "str-vec.h" | |
33 | |
34 #include "error.h" | |
2477 | 35 #include "oct-alloc.h" |
2376 | 36 #include "oct-map.h" |
37 #include "ov-base.h" | |
38 #include "ov-typeinfo.h" | |
39 | |
40 class octave_value_list; | |
41 | |
42 class tree_walker; | |
43 | |
2477 | 44 // Data structures. |
2376 | 45 |
46 class | |
47 octave_struct : public octave_base_value | |
48 { | |
49 public: | |
50 | |
51 octave_struct (void) | |
11584
cda4aa780d58
Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11523
diff
changeset
|
52 : octave_base_value (), map () { } |
2376 | 53 |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
54 octave_struct (const octave_map& m) |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
55 : octave_base_value (), map (m) { } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
56 |
2376 | 57 octave_struct (const octave_struct& s) |
58 : octave_base_value (), map (s.map) { } | |
59 | |
60 ~octave_struct (void) { } | |
61 | |
5759 | 62 octave_base_value *clone (void) const { return new octave_struct (*this); } |
63 octave_base_value *empty_clone (void) const { return new octave_struct (); } | |
3933 | 64 |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
65 octave_base_value *try_narrowing_conversion (void); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
66 |
9529
8e5009334661
partially revert e79470be3ecb
Jaroslav Hajek <highegg@gmail.com>
parents:
9522
diff
changeset
|
67 Cell dotref (const octave_value_list& idx, bool auto_add = false); |
2376 | 68 |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7622
diff
changeset
|
69 octave_value subsref (const std::string& type, |
10313 | 70 const std::list<octave_value_list>& idx) |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7622
diff
changeset
|
71 { |
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7622
diff
changeset
|
72 octave_value_list tmp = subsref (type, idx, 1); |
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7622
diff
changeset
|
73 return tmp.length () > 0 ? tmp(0) : octave_value (); |
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7622
diff
changeset
|
74 } |
7622
c195bd0a5c64
treat structs and cells as "constants"
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
75 |
c195bd0a5c64
treat structs and cells as "constants"
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
76 octave_value_list subsref (const std::string&, |
10313 | 77 const std::list<octave_value_list>&, int); |
4994 | 78 |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
79 octave_value subsref (const std::string& type, |
10313 | 80 const std::list<octave_value_list>& idx, |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
81 bool auto_add); |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
82 |
8546
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
7651
diff
changeset
|
83 static octave_value numeric_conv (const octave_value& val, |
10313 | 84 const std::string& type); |
2376 | 85 |
4247 | 86 octave_value subsasgn (const std::string& type, |
10313 | 87 const std::list<octave_value_list>& idx, |
88 const octave_value& rhs); | |
2376 | 89 |
7046 | 90 octave_value squeeze (void) const { return map.squeeze (); } |
91 | |
92 octave_value permute (const Array<int>& vec, bool inv = false) const | |
93 { return map.permute (vec, inv); } | |
94 | |
95 octave_value do_index_op (const octave_value_list& idx, | |
10313 | 96 bool resize_ok = false); |
7046 | 97 |
4563 | 98 dim_vector dims (void) const { return map.dims (); } |
4200 | 99 |
4791 | 100 size_t byte_size (void) const; |
101 | |
5900 | 102 // This is the number of elements in each field. The total number |
103 // of elements is numel () * nfields (). | |
104 octave_idx_type numel (void) const | |
105 { | |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
106 return map.numel (); |
5900 | 107 } |
108 | |
6639 | 109 octave_idx_type nfields (void) const { return map.nfields (); } |
5900 | 110 |
4567 | 111 octave_value reshape (const dim_vector& new_dims) const |
112 { return map.reshape (new_dims); } | |
113 | |
10754
92eb5fb58ebc
fix resize with structs
Jaroslav Hajek <highegg@gmail.com>
parents:
10742
diff
changeset
|
114 octave_value resize (const dim_vector& dv, bool fill = false) const |
92eb5fb58ebc
fix resize with structs
Jaroslav Hajek <highegg@gmail.com>
parents:
10742
diff
changeset
|
115 { octave_map tmap = map; tmap.resize (dv, fill); return tmap; } |
4936 | 116 |
2376 | 117 bool is_defined (void) const { return true; } |
118 | |
7622
c195bd0a5c64
treat structs and cells as "constants"
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
119 bool is_constant (void) const { return true; } |
c195bd0a5c64
treat structs and cells as "constants"
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
120 |
2376 | 121 bool is_map (void) const { return true; } |
122 | |
10087
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
9881
diff
changeset
|
123 builtin_type_t builtin_type (void) const { return btyp_struct; } |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
9881
diff
changeset
|
124 |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
125 octave_map map_value (void) const { return map; } |
2376 | 126 |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
127 string_vector map_keys (void) const { return map.fieldnames (); } |
3933 | 128 |
3523 | 129 void print (std::ostream& os, bool pr_as_read_syntax = false) const; |
2901 | 130 |
3523 | 131 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
2901 | 132 |
3523 | 133 bool print_name_tag (std::ostream& os, const std::string& name) const; |
2376 | 134 |
6974 | 135 bool save_ascii (std::ostream& os); |
4687 | 136 |
137 bool load_ascii (std::istream& is); | |
138 | |
139 bool save_binary (std::ostream& os, bool& save_as_floats); | |
140 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11584
diff
changeset
|
141 bool load_binary (std::istream& is, bool swap, |
10313 | 142 oct_mach_info::float_format fmt); |
4687 | 143 |
144 #if defined (HAVE_HDF5) | |
145 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |
146 | |
9881
b3089dba88bf
Remove HDF5 cruft for older versions of HDF5
Kacper Kowalik
parents:
9529
diff
changeset
|
147 bool load_hdf5 (hid_t loc_id, const char *name); |
4687 | 148 #endif |
149 | |
5900 | 150 mxArray *as_mxArray (void) const; |
151 | |
10760
76079e505f9d
optimize cellfun with uniform struct output
Jaroslav Hajek <highegg@gmail.com>
parents:
10754
diff
changeset
|
152 octave_value |
76079e505f9d
optimize cellfun with uniform struct output
Jaroslav Hajek <highegg@gmail.com>
parents:
10754
diff
changeset
|
153 fast_elem_extract (octave_idx_type n) const; |
76079e505f9d
optimize cellfun with uniform struct output
Jaroslav Hajek <highegg@gmail.com>
parents:
10754
diff
changeset
|
154 |
76079e505f9d
optimize cellfun with uniform struct output
Jaroslav Hajek <highegg@gmail.com>
parents:
10754
diff
changeset
|
155 bool |
76079e505f9d
optimize cellfun with uniform struct output
Jaroslav Hajek <highegg@gmail.com>
parents:
10754
diff
changeset
|
156 fast_elem_insert (octave_idx_type n, const octave_value& x); |
76079e505f9d
optimize cellfun with uniform struct output
Jaroslav Hajek <highegg@gmail.com>
parents:
10754
diff
changeset
|
157 |
7336 | 158 protected: |
2376 | 159 |
2477 | 160 // The associative array used to manage the structure data. |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
161 octave_map map; |
2376 | 162 |
7336 | 163 private: |
164 | |
3219 | 165 DECLARE_OCTAVE_ALLOCATOR |
2477 | 166 |
3219 | 167 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2376 | 168 }; |
169 | |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
170 class |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
171 octave_scalar_struct : public octave_base_value |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
172 { |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
173 public: |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
174 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
175 octave_scalar_struct (void) |
11584
cda4aa780d58
Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11523
diff
changeset
|
176 : octave_base_value (), map () { } |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
177 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
178 octave_scalar_struct (const octave_scalar_map& m) |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
179 : octave_base_value (), map (m) { } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
180 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
181 octave_scalar_struct (const octave_scalar_struct& s) |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
182 : octave_base_value (), map (s.map) { } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
183 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
184 ~octave_scalar_struct (void) { } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
185 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
186 octave_base_value *clone (void) const { return new octave_scalar_struct (*this); } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
187 octave_base_value *empty_clone (void) const { return new octave_scalar_struct (); } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
188 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
189 octave_value dotref (const octave_value_list& idx, bool auto_add = false); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
190 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
191 octave_value subsref (const std::string& type, |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
192 const std::list<octave_value_list>& idx); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
193 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
194 octave_value_list subsref (const std::string& type, |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
195 const std::list<octave_value_list>& idx, int); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
196 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
197 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
198 octave_value subsref (const std::string& type, |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
199 const std::list<octave_value_list>& idx, |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
200 bool auto_add); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
201 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
202 static octave_value numeric_conv (const octave_value& val, |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
203 const std::string& type); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
204 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
205 octave_value subsasgn (const std::string& type, |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
206 const std::list<octave_value_list>& idx, |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
207 const octave_value& rhs); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
208 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
209 octave_value squeeze (void) const { return map; } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
210 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
211 octave_value permute (const Array<int>& vec, bool inv = false) const |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
212 { return octave_map (map).permute (vec, inv); } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
213 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
214 octave_value do_index_op (const octave_value_list& idx, |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
215 bool resize_ok = false); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
216 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
217 dim_vector dims (void) const { static dim_vector dv (1, 1); return dv; } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
218 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
219 size_t byte_size (void) const; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
220 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
221 // This is the number of elements in each field. The total number |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
222 // of elements is numel () * nfields (). |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
223 octave_idx_type numel (void) const |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
224 { |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
225 return 1; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
226 } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
227 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
228 octave_idx_type nfields (void) const { return map.nfields (); } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
229 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
230 octave_value reshape (const dim_vector& new_dims) const |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
231 { return octave_map (map).reshape (new_dims); } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
232 |
10754
92eb5fb58ebc
fix resize with structs
Jaroslav Hajek <highegg@gmail.com>
parents:
10742
diff
changeset
|
233 octave_value resize (const dim_vector& dv, bool fill = false) const |
92eb5fb58ebc
fix resize with structs
Jaroslav Hajek <highegg@gmail.com>
parents:
10742
diff
changeset
|
234 { octave_map tmap = map; tmap.resize (dv, fill); return tmap; } |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
235 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
236 bool is_defined (void) const { return true; } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
237 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
238 bool is_constant (void) const { return true; } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
239 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
240 bool is_map (void) const { return true; } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
241 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
242 builtin_type_t builtin_type (void) const { return btyp_struct; } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
243 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
244 octave_map map_value (void) const { return map; } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
245 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
246 octave_scalar_map scalar_map_value (void) const { return map; } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
247 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
248 string_vector map_keys (void) const { return map.fieldnames (); } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
249 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
250 void print (std::ostream& os, bool pr_as_read_syntax = false) const; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
251 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
252 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
253 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
254 bool print_name_tag (std::ostream& os, const std::string& name) const; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
255 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
256 bool save_ascii (std::ostream& os); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
257 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
258 bool load_ascii (std::istream& is); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
259 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
260 bool save_binary (std::ostream& os, bool& save_as_floats); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
261 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11584
diff
changeset
|
262 bool load_binary (std::istream& is, bool swap, |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
263 oct_mach_info::float_format fmt); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
264 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
265 #if defined (HAVE_HDF5) |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
266 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
267 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
268 bool load_hdf5 (hid_t loc_id, const char *name); |
2376 | 269 #endif |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
270 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
271 mxArray *as_mxArray (void) const; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
272 |
10760
76079e505f9d
optimize cellfun with uniform struct output
Jaroslav Hajek <highegg@gmail.com>
parents:
10754
diff
changeset
|
273 bool fast_elem_insert_self (void *where, builtin_type_t btyp) const; |
76079e505f9d
optimize cellfun with uniform struct output
Jaroslav Hajek <highegg@gmail.com>
parents:
10754
diff
changeset
|
274 |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
275 protected: |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
276 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
277 // The associative array used to manage the structure data. |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
278 octave_scalar_map map; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
279 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
280 private: |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
281 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
282 octave_value to_array (void); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
283 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
284 DECLARE_OCTAVE_ALLOCATOR |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
285 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
286 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
287 }; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
288 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
289 #endif |