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 |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (Cell_h) |
|
24 #define Cell_h 1 |
|
25 |
4192
|
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
3353
|
27 #pragma interface |
|
28 #endif |
|
29 |
|
30 #include <string> |
|
31 |
4513
|
32 #include "ArrayN.h" |
3353
|
33 #include "oct-alloc.h" |
|
34 #include "str-vec.h" |
|
35 |
4055
|
36 #include "oct-obj.h" |
3353
|
37 |
|
38 class |
4513
|
39 Cell : public ArrayN<octave_value> |
3353
|
40 { |
|
41 public: |
|
42 |
|
43 Cell (void) |
4548
|
44 : ArrayN<octave_value> (dim_vector (0, 0)) { } |
3928
|
45 |
|
46 Cell (const octave_value& val) |
4513
|
47 : ArrayN<octave_value> (dim_vector (1, 1), val) { } |
|
48 |
|
49 Cell (const octave_value_list& ovl) |
|
50 : ArrayN<octave_value> (dim_vector (ovl.length (), 1)) |
|
51 { |
|
52 for (int i = 0; i < ovl.length (); i++) |
|
53 elem (i) = ovl (i); |
|
54 } |
3353
|
55 |
4219
|
56 Cell (int n, int m, const octave_value& val = resize_fill_value ()) |
4513
|
57 : ArrayN<octave_value> (dim_vector (n, m), val) { } |
3353
|
58 |
4587
|
59 Cell (const dim_vector& dv, const octave_value& val = resize_fill_value ()) |
|
60 : ArrayN<octave_value> (dv, val) { } |
4563
|
61 |
4513
|
62 Cell (const ArrayN<octave_value>& c) |
|
63 : ArrayN<octave_value> (c) { } |
3354
|
64 |
4567
|
65 Cell (const Array<octave_value>& c) |
|
66 : ArrayN<octave_value> (c) { } |
|
67 |
3933
|
68 Cell (const Array<octave_value>& c, int nr, int nc) |
4513
|
69 : ArrayN<octave_value> (c, dim_vector (nr, nc)) { } |
3933
|
70 |
4216
|
71 Cell (const string_vector& sv); |
|
72 |
3353
|
73 Cell (const Cell& c) |
4513
|
74 : ArrayN<octave_value> (c) { } |
|
75 |
|
76 Cell index (const octave_value_list& idx, bool resize_ok = false) const; |
|
77 |
|
78 Cell index (idx_vector& i, int resize_ok = 0, |
|
79 const octave_value& rfv = resize_fill_value ()) const |
4567
|
80 { return Cell (ArrayN<octave_value>::index (i, resize_ok, rfv)); } |
4513
|
81 |
|
82 Cell index (idx_vector& i, idx_vector& j, int resize_ok = 0, |
|
83 const octave_value& rfv = resize_fill_value ()) const |
4567
|
84 { return Cell (ArrayN<octave_value>::index (i, j, resize_ok, rfv)); } |
4513
|
85 |
|
86 Cell index (Array<idx_vector>& ra_idx, int resize_ok = 0, |
|
87 const octave_value& rfv = resize_fill_value ()) const |
4567
|
88 { return Cell (ArrayN<octave_value>::index (ra_idx, resize_ok, rfv)); } |
4513
|
89 |
|
90 Cell& assign (const octave_value_list& idx, const Cell& rhs, |
|
91 const octave_value& fill_val = octave_value ()); |
|
92 |
4901
|
93 Cell reshape (const dim_vector& new_dims) const |
|
94 { return ArrayN<octave_value>::reshape (new_dims); } |
|
95 |
3933
|
96 // XXX FIXME XXX |
4015
|
97 boolMatrix all (int dim = 0) const { return boolMatrix (); } |
3933
|
98 |
|
99 // XXX FIXME XXX |
4015
|
100 boolMatrix any (int dim = 0) const { return boolMatrix (); } |
3933
|
101 |
4806
|
102 int cat (const Cell& ra_arg, int dim, int iidx, int move); |
|
103 |
3933
|
104 // XXX FIXME XXX |
|
105 bool is_true (void) const { return false; } |
|
106 |
4219
|
107 static octave_value resize_fill_value (void) { return Matrix (); } |
3353
|
108 }; |
|
109 |
|
110 #endif |
|
111 |
|
112 /* |
|
113 ;;; Local Variables: *** |
|
114 ;;; mode: C++ *** |
|
115 ;;; End: *** |
|
116 */ |