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