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