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 |
|
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 |
4513
|
35 Cell : public ArrayN<octave_value> |
3353
|
36 { |
|
37 public: |
|
38 |
|
39 Cell (void) |
4548
|
40 : ArrayN<octave_value> (dim_vector (0, 0)) { } |
3928
|
41 |
|
42 Cell (const octave_value& val) |
4513
|
43 : ArrayN<octave_value> (dim_vector (1, 1), val) { } |
|
44 |
|
45 Cell (const octave_value_list& ovl) |
|
46 : ArrayN<octave_value> (dim_vector (ovl.length (), 1)) |
|
47 { |
5275
|
48 for (octave_idx_type i = 0; i < ovl.length (); i++) |
4513
|
49 elem (i) = ovl (i); |
|
50 } |
3353
|
51 |
5275
|
52 Cell (octave_idx_type n, octave_idx_type m, const octave_value& val = resize_fill_value ()) |
4513
|
53 : ArrayN<octave_value> (dim_vector (n, m), val) { } |
3353
|
54 |
4587
|
55 Cell (const dim_vector& dv, const octave_value& val = resize_fill_value ()) |
|
56 : ArrayN<octave_value> (dv, val) { } |
4563
|
57 |
4513
|
58 Cell (const ArrayN<octave_value>& c) |
|
59 : ArrayN<octave_value> (c) { } |
3354
|
60 |
4567
|
61 Cell (const Array<octave_value>& c) |
|
62 : ArrayN<octave_value> (c) { } |
|
63 |
5275
|
64 Cell (const Array<octave_value>& c, octave_idx_type nr, octave_idx_type nc) |
4513
|
65 : ArrayN<octave_value> (c, dim_vector (nr, nc)) { } |
3933
|
66 |
4216
|
67 Cell (const string_vector& sv); |
|
68 |
3353
|
69 Cell (const Cell& c) |
4513
|
70 : ArrayN<octave_value> (c) { } |
|
71 |
|
72 Cell index (const octave_value_list& idx, bool resize_ok = false) const; |
|
73 |
|
74 Cell index (idx_vector& i, int resize_ok = 0, |
|
75 const octave_value& rfv = resize_fill_value ()) const |
4567
|
76 { return Cell (ArrayN<octave_value>::index (i, resize_ok, rfv)); } |
4513
|
77 |
|
78 Cell index (idx_vector& i, idx_vector& j, int resize_ok = 0, |
|
79 const octave_value& rfv = resize_fill_value ()) const |
4567
|
80 { return Cell (ArrayN<octave_value>::index (i, j, resize_ok, rfv)); } |
4513
|
81 |
|
82 Cell index (Array<idx_vector>& ra_idx, int resize_ok = 0, |
|
83 const octave_value& rfv = resize_fill_value ()) const |
4567
|
84 { return Cell (ArrayN<octave_value>::index (ra_idx, resize_ok, rfv)); } |
4513
|
85 |
|
86 Cell& assign (const octave_value_list& idx, const Cell& rhs, |
|
87 const octave_value& fill_val = octave_value ()); |
|
88 |
4901
|
89 Cell reshape (const dim_vector& new_dims) const |
|
90 { return ArrayN<octave_value>::reshape (new_dims); } |
|
91 |
3933
|
92 // XXX FIXME XXX |
4932
|
93 boolMatrix all (int /* dim */ = 0) const { return boolMatrix (); } |
3933
|
94 |
|
95 // XXX FIXME XXX |
4932
|
96 boolMatrix any (int /* dim */ = 0) const { return boolMatrix (); } |
3933
|
97 |
5275
|
98 Cell concat (const Cell& rb, const Array<octave_idx_type>& ra_idx); |
4915
|
99 |
5275
|
100 Cell& insert (const Cell& a, octave_idx_type r, octave_idx_type c); |
|
101 Cell& insert (const Cell& a, const Array<octave_idx_type>& ra_idx); |
4806
|
102 |
3933
|
103 // XXX FIXME XXX |
|
104 bool is_true (void) const { return false; } |
|
105 |
4219
|
106 static octave_value resize_fill_value (void) { return Matrix (); } |
3353
|
107 }; |
|
108 |
|
109 #endif |
|
110 |
|
111 /* |
|
112 ;;; Local Variables: *** |
|
113 ;;; mode: C++ *** |
|
114 ;;; End: *** |
|
115 */ |