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 |
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) |
|
47 : ArrayN<octave_value> (dim_vector (ovl.length (), 1)) |
|
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 |
3353
|
70 Cell (const Cell& c) |
4513
|
71 : ArrayN<octave_value> (c) { } |
|
72 |
|
73 Cell index (const octave_value_list& idx, bool resize_ok = false) const; |
|
74 |
|
75 Cell index (idx_vector& i, int resize_ok = 0, |
|
76 const octave_value& rfv = resize_fill_value ()) const |
4567
|
77 { return Cell (ArrayN<octave_value>::index (i, resize_ok, rfv)); } |
4513
|
78 |
|
79 Cell index (idx_vector& i, idx_vector& j, int resize_ok = 0, |
|
80 const octave_value& rfv = resize_fill_value ()) const |
4567
|
81 { return Cell (ArrayN<octave_value>::index (i, j, resize_ok, rfv)); } |
4513
|
82 |
|
83 Cell index (Array<idx_vector>& ra_idx, int resize_ok = 0, |
|
84 const octave_value& rfv = resize_fill_value ()) const |
4567
|
85 { return Cell (ArrayN<octave_value>::index (ra_idx, resize_ok, rfv)); } |
4513
|
86 |
|
87 Cell& assign (const octave_value_list& idx, const Cell& rhs, |
|
88 const octave_value& fill_val = octave_value ()); |
|
89 |
4901
|
90 Cell reshape (const dim_vector& new_dims) const |
|
91 { return ArrayN<octave_value>::reshape (new_dims); } |
|
92 |
5602
|
93 octave_idx_type nnz (void) const; |
|
94 |
5570
|
95 Cell column (octave_idx_type i) const; |
|
96 |
5775
|
97 // FIXME |
4932
|
98 boolMatrix all (int /* dim */ = 0) const { return boolMatrix (); } |
3933
|
99 |
5775
|
100 // FIXME |
4932
|
101 boolMatrix any (int /* dim */ = 0) const { return boolMatrix (); } |
3933
|
102 |
5275
|
103 Cell concat (const Cell& rb, const Array<octave_idx_type>& ra_idx); |
4915
|
104 |
5275
|
105 Cell& insert (const Cell& a, octave_idx_type r, octave_idx_type c); |
|
106 Cell& insert (const Cell& a, const Array<octave_idx_type>& ra_idx); |
4806
|
107 |
5775
|
108 // FIXME |
3933
|
109 bool is_true (void) const { return false; } |
|
110 |
4219
|
111 static octave_value resize_fill_value (void) { return Matrix (); } |
3353
|
112 }; |
|
113 |
|
114 #endif |
|
115 |
|
116 /* |
|
117 ;;; Local Variables: *** |
|
118 ;;; mode: C++ *** |
|
119 ;;; End: *** |
|
120 */ |