2882
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 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 |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
2882
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_list_h) |
|
25 #define octave_list_h 1 |
|
26 |
|
27 #include <cstdlib> |
|
28 |
3503
|
29 #include <iostream> |
2882
|
30 #include <string> |
|
31 |
|
32 #include "mx-base.h" |
|
33 #include "str-vec.h" |
|
34 |
4591
|
35 #include "Cell.h" |
2882
|
36 #include "error.h" |
|
37 #include "oct-alloc.h" |
|
38 #include "ov-base.h" |
|
39 #include "ov-typeinfo.h" |
|
40 |
|
41 class tree_walker; |
|
42 |
|
43 // Lists. |
|
44 |
|
45 class |
|
46 octave_list : public octave_base_value |
|
47 { |
|
48 public: |
|
49 |
|
50 octave_list (void) |
|
51 : octave_base_value () { } |
|
52 |
|
53 octave_list (const octave_value_list& l) |
4591
|
54 : octave_base_value (), data (l) { } |
2882
|
55 |
4513
|
56 octave_list (const Cell& c); |
|
57 |
2882
|
58 octave_list (const octave_list& l) |
4591
|
59 : octave_base_value (), data (l.data) { } |
2882
|
60 |
|
61 ~octave_list (void) { } |
|
62 |
5759
|
63 octave_base_value *clone (void) const { return new octave_list (*this); } |
|
64 octave_base_value *empty_clone (void) const { return new octave_list (); } |
3933
|
65 |
4994
|
66 octave_value subsref (const std::string&, |
|
67 const std::list<octave_value_list>&) |
4271
|
68 { |
|
69 panic_impossible (); |
|
70 return octave_value_list (); |
|
71 } |
|
72 |
4994
|
73 octave_value_list subsref (const std::string& type, |
|
74 const std::list<octave_value_list>& idx, |
|
75 int nargout); |
|
76 |
5885
|
77 octave_value do_index_op (const octave_value_list& idx, |
|
78 bool resize_ok = false); |
3933
|
79 |
4247
|
80 octave_value subsasgn (const std::string& type, |
4219
|
81 const std::list<octave_value_list>& idx, |
3933
|
82 const octave_value& rhs); |
2882
|
83 |
3196
|
84 void assign (const octave_value_list& idx, const octave_value& rhs); |
|
85 |
4591
|
86 dim_vector dims (void) const { return dim_vector (1, data.length ()); } |
4559
|
87 |
4791
|
88 size_t byte_size (void) const; |
|
89 |
2882
|
90 bool is_defined (void) const { return true; } |
|
91 |
|
92 bool is_list (void) const { return true; } |
|
93 |
4591
|
94 octave_value_list list_value (void) const; |
2882
|
95 |
3523
|
96 void print (std::ostream& os, bool pr_as_read_syntax = false) const; |
2901
|
97 |
3523
|
98 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
2901
|
99 |
3523
|
100 bool print_name_tag (std::ostream& os, const std::string& name) const; |
2882
|
101 |
4687
|
102 bool save_ascii (std::ostream& os, bool& infnan_warned, |
|
103 bool strip_nan_and_inf); |
|
104 |
|
105 bool load_ascii (std::istream& is); |
|
106 |
|
107 bool save_binary (std::ostream& os, bool& save_as_floats); |
|
108 |
|
109 bool load_binary (std::istream& is, bool swap, |
|
110 oct_mach_info::float_format fmt); |
|
111 |
|
112 #if defined (HAVE_HDF5) |
|
113 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); |
|
114 |
|
115 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); |
|
116 #endif |
|
117 |
4499
|
118 protected: |
2882
|
119 |
|
120 // The list of Octave values. |
4591
|
121 Cell data; |
2882
|
122 |
4499
|
123 private: |
|
124 |
4612
|
125 DECLARE_OCTAVE_ALLOCATOR |
2882
|
126 |
4612
|
127 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2882
|
128 }; |
|
129 |
|
130 #endif |
|
131 |
|
132 /* |
|
133 ;;; Local Variables: *** |
|
134 ;;; mode: C++ *** |
|
135 ;;; End: *** |
|
136 */ |