3353
|
1 /* |
|
2 |
|
3 Copyright (C) 1999 John W. Eaton |
|
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. |
3353
|
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/>. |
3353
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_cell_h) |
|
24 #define octave_cell_h 1 |
|
25 |
|
26 #include <cstdlib> |
|
27 |
3503
|
28 #include <iostream> |
3353
|
29 #include <string> |
|
30 |
|
31 #include "mx-base.h" |
|
32 #include "oct-alloc.h" |
|
33 #include "str-vec.h" |
|
34 |
|
35 #include "Cell.h" |
|
36 #include "error.h" |
3928
|
37 #include "ov-base-mat.h" |
3353
|
38 #include "ov-typeinfo.h" |
|
39 |
|
40 class Octave_map; |
|
41 class octave_value_list; |
|
42 |
|
43 class tree_walker; |
|
44 |
|
45 // Cells. |
|
46 |
|
47 class |
3928
|
48 octave_cell : public octave_base_matrix<Cell> |
3353
|
49 { |
|
50 public: |
|
51 |
|
52 octave_cell (void) |
3928
|
53 : octave_base_matrix<Cell> () { } |
3353
|
54 |
|
55 octave_cell (const Cell& c) |
3928
|
56 : octave_base_matrix<Cell> (c) { } |
3353
|
57 |
|
58 octave_cell (const octave_cell& c) |
3928
|
59 : octave_base_matrix<Cell> (c) { } |
3353
|
60 |
|
61 ~octave_cell (void) { } |
|
62 |
|
63 void assign (const octave_value_list& idx, const octave_value& rhs); |
|
64 |
5759
|
65 octave_base_value *clone (void) const { return new octave_cell (*this); } |
|
66 octave_base_value *empty_clone (void) const { return new octave_cell (); } |
3353
|
67 |
3928
|
68 #if 0 |
5759
|
69 octave_base_value *try_narrowing_conversion (void); |
3928
|
70 #endif |
|
71 |
4994
|
72 octave_value subsref (const std::string&, |
|
73 const std::list<octave_value_list>&) |
4271
|
74 { |
|
75 panic_impossible (); |
|
76 return octave_value_list (); |
|
77 } |
|
78 |
4994
|
79 octave_value_list subsref (const std::string& type, |
|
80 const std::list<octave_value_list>& idx, |
|
81 int nargout); |
|
82 |
4247
|
83 octave_value subsasgn (const std::string& type, |
4219
|
84 const std::list<octave_value_list>& idx, |
3933
|
85 const octave_value& rhs); |
|
86 |
4791
|
87 size_t byte_size (void) const; |
|
88 |
4645
|
89 bool is_matrix_type (void) const { return false; } |
|
90 |
4370
|
91 bool is_numeric_type (void) const { return false; } |
|
92 |
3928
|
93 bool is_defined (void) const { return true; } |
3353
|
94 |
4994
|
95 bool is_constant (void) const { return false; } |
|
96 |
3724
|
97 bool is_cell (void) const { return true; } |
|
98 |
6116
|
99 bool is_cellstr (void) const { return matrix.is_cellstr (); } |
|
100 |
3928
|
101 Cell cell_value (void) const { return matrix; } |
3353
|
102 |
3933
|
103 octave_value_list list_value (void) const; |
|
104 |
5715
|
105 octave_value convert_to_str_internal (bool pad, bool, char type) const |
|
106 { return octave_value (all_strings (pad), type); } |
4358
|
107 |
5715
|
108 string_vector all_strings (bool pad = false) const; |
4243
|
109 |
4604
|
110 bool print_as_scalar (void) const; |
|
111 |
3933
|
112 void print (std::ostream& os, bool pr_as_read_syntax = false) const; |
|
113 |
|
114 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
|
115 |
4687
|
116 |
6974
|
117 bool save_ascii (std::ostream& os); |
4687
|
118 |
|
119 bool load_ascii (std::istream& is); |
|
120 |
|
121 bool save_binary (std::ostream& os, bool& save_as_floats); |
|
122 |
|
123 bool load_binary (std::istream& is, bool swap, |
|
124 oct_mach_info::float_format fmt); |
|
125 |
|
126 #if defined (HAVE_HDF5) |
|
127 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); |
|
128 |
|
129 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); |
|
130 #endif |
|
131 |
5900
|
132 mxArray *as_mxArray (void) const; |
|
133 |
3353
|
134 private: |
4612
|
135 |
3353
|
136 DECLARE_OCTAVE_ALLOCATOR |
|
137 |
|
138 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
|
139 }; |
|
140 |
|
141 #endif |
|
142 |
|
143 /* |
|
144 ;;; Local Variables: *** |
|
145 ;;; mode: C++ *** |
|
146 ;;; End: *** |
|
147 */ |