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