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 |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
3353
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (Cell_h) |
|
25 #define Cell_h 1 |
|
26 |
|
27 #include <string> |
|
28 |
4513
|
29 #include "ArrayN.h" |
3353
|
30 #include "oct-alloc.h" |
|
31 #include "str-vec.h" |
|
32 |
4055
|
33 #include "oct-obj.h" |
3353
|
34 |
|
35 class |
6169
|
36 OCTINTERP_API |
4513
|
37 Cell : public ArrayN<octave_value> |
3353
|
38 { |
|
39 public: |
|
40 |
|
41 Cell (void) |
4548
|
42 : ArrayN<octave_value> (dim_vector (0, 0)) { } |
3928
|
43 |
|
44 Cell (const octave_value& val) |
4513
|
45 : ArrayN<octave_value> (dim_vector (1, 1), val) { } |
|
46 |
|
47 Cell (const octave_value_list& ovl) |
6833
|
48 : ArrayN<octave_value> (dim_vector (1, ovl.length ())) |
4513
|
49 { |
5275
|
50 for (octave_idx_type i = 0; i < ovl.length (); i++) |
4513
|
51 elem (i) = ovl (i); |
|
52 } |
3353
|
53 |
5275
|
54 Cell (octave_idx_type n, octave_idx_type m, const octave_value& val = resize_fill_value ()) |
4513
|
55 : ArrayN<octave_value> (dim_vector (n, m), val) { } |
3353
|
56 |
4587
|
57 Cell (const dim_vector& dv, const octave_value& val = resize_fill_value ()) |
|
58 : ArrayN<octave_value> (dv, val) { } |
4563
|
59 |
4513
|
60 Cell (const ArrayN<octave_value>& c) |
|
61 : ArrayN<octave_value> (c) { } |
3354
|
62 |
4567
|
63 Cell (const Array<octave_value>& c) |
|
64 : ArrayN<octave_value> (c) { } |
|
65 |
5275
|
66 Cell (const Array<octave_value>& c, octave_idx_type nr, octave_idx_type nc) |
4513
|
67 : ArrayN<octave_value> (c, dim_vector (nr, nc)) { } |
3933
|
68 |
5805
|
69 Cell (const string_vector& sv, bool trim = false); |
4216
|
70 |
6116
|
71 Cell (const dim_vector& dv, const string_vector& sv, bool trim = false); |
|
72 |
3353
|
73 Cell (const Cell& c) |
4513
|
74 : ArrayN<octave_value> (c) { } |
|
75 |
6116
|
76 bool is_cellstr (void) const; |
|
77 |
4513
|
78 Cell index (const octave_value_list& idx, bool resize_ok = false) const; |
|
79 |
|
80 Cell index (idx_vector& i, int resize_ok = 0, |
|
81 const octave_value& rfv = resize_fill_value ()) const |
4567
|
82 { return Cell (ArrayN<octave_value>::index (i, resize_ok, rfv)); } |
4513
|
83 |
|
84 Cell index (idx_vector& i, idx_vector& j, int resize_ok = 0, |
|
85 const octave_value& rfv = resize_fill_value ()) const |
4567
|
86 { return Cell (ArrayN<octave_value>::index (i, j, resize_ok, rfv)); } |
4513
|
87 |
|
88 Cell index (Array<idx_vector>& ra_idx, int resize_ok = 0, |
|
89 const octave_value& rfv = resize_fill_value ()) const |
4567
|
90 { return Cell (ArrayN<octave_value>::index (ra_idx, resize_ok, rfv)); } |
4513
|
91 |
|
92 Cell& assign (const octave_value_list& idx, const Cell& rhs, |
|
93 const octave_value& fill_val = octave_value ()); |
|
94 |
4901
|
95 Cell reshape (const dim_vector& new_dims) const |
|
96 { return ArrayN<octave_value>::reshape (new_dims); } |
|
97 |
5602
|
98 octave_idx_type nnz (void) const; |
|
99 |
5570
|
100 Cell column (octave_idx_type i) const; |
|
101 |
5775
|
102 // FIXME |
4932
|
103 boolMatrix all (int /* dim */ = 0) const { return boolMatrix (); } |
3933
|
104 |
5775
|
105 // FIXME |
4932
|
106 boolMatrix any (int /* dim */ = 0) const { return boolMatrix (); } |
3933
|
107 |
5275
|
108 Cell concat (const Cell& rb, const Array<octave_idx_type>& ra_idx); |
4915
|
109 |
5275
|
110 Cell& insert (const Cell& a, octave_idx_type r, octave_idx_type c); |
|
111 Cell& insert (const Cell& a, const Array<octave_idx_type>& ra_idx); |
4806
|
112 |
5775
|
113 // FIXME |
3933
|
114 bool is_true (void) const { return false; } |
|
115 |
4219
|
116 static octave_value resize_fill_value (void) { return Matrix (); } |
3353
|
117 }; |
|
118 |
|
119 #endif |
|
120 |
|
121 /* |
|
122 ;;; Local Variables: *** |
|
123 ;;; mode: C++ *** |
|
124 ;;; End: *** |
|
125 */ |