Mercurial > hg > octave-lyh
annotate src/Cell.h @ 9812:f80c566bc751
improve unary mapper system
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 12 Nov 2009 15:47:58 +0100 |
parents | b4fdfee405b5 |
children | 8fa32b527d9a |
rev | line source |
---|---|
3353 | 1 /* |
2 | |
8920 | 3 Copyright (C) 1999, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
4 2009 John W. Eaton | |
3353 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
3353 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
3353 | 21 |
22 */ | |
23 | |
24 #if !defined (Cell_h) | |
25 #define Cell_h 1 | |
26 | |
27 #include <string> | |
28 | |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
29 #include "Array.h" |
3353 | 30 #include "oct-alloc.h" |
31 #include "str-vec.h" | |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
32 #include "ov.h" |
3353 | 33 |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
34 class octave_value_list; |
3353 | 35 |
36 class | |
6169 | 37 OCTINTERP_API |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
38 Cell : public Array<octave_value> |
3353 | 39 { |
40 public: | |
41 | |
42 Cell (void) | |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
43 : Array<octave_value> (dim_vector (0, 0)) { } |
3928 | 44 |
45 Cell (const octave_value& val) | |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
46 : Array<octave_value> (dim_vector (1, 1), val) { } |
4513 | 47 |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
48 Cell (const octave_value_list& ovl); |
3353 | 49 |
7209 | 50 Cell (octave_idx_type n, octave_idx_type m, |
51 const octave_value& val = resize_fill_value ()) | |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
52 : Array<octave_value> (dim_vector (n, m), val) { } |
3353 | 53 |
4587 | 54 Cell (const dim_vector& dv, const octave_value& val = resize_fill_value ()) |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
55 : Array<octave_value> (dv, val) { } |
3354 | 56 |
4567 | 57 Cell (const Array<octave_value>& c) |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
58 : Array<octave_value> (c) { } |
4567 | 59 |
5275 | 60 Cell (const Array<octave_value>& c, octave_idx_type nr, octave_idx_type nc) |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
61 : Array<octave_value> (c, dim_vector (nr, nc)) { } |
3933 | 62 |
5805 | 63 Cell (const string_vector& sv, bool trim = false); |
4216 | 64 |
8732 | 65 Cell (const Array<std::string>& sa); |
66 | |
6116 | 67 Cell (const dim_vector& dv, const string_vector& sv, bool trim = false); |
68 | |
3353 | 69 Cell (const Cell& c) |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
70 : Array<octave_value> (c) { } |
4513 | 71 |
6116 | 72 bool is_cellstr (void) const; |
73 | |
4513 | 74 Cell index (const octave_value_list& idx, bool resize_ok = false) const; |
75 | |
8175
977d5204cf67
fix null assignment for structs
Jaroslav Hajek <highegg@gmail.com>
parents:
7620
diff
changeset
|
76 Cell& delete_elements (const octave_value_list& idx); |
977d5204cf67
fix null assignment for structs
Jaroslav Hajek <highegg@gmail.com>
parents:
7620
diff
changeset
|
77 |
4513 | 78 Cell& assign (const octave_value_list& idx, const Cell& rhs, |
8679
280fae940bb0
optimize scalar indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8626
diff
changeset
|
79 const octave_value& fill_val = resize_fill_value ()); |
8290
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8175
diff
changeset
|
80 |
4901 | 81 Cell reshape (const dim_vector& new_dims) const |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
82 { return Array<octave_value>::reshape (new_dims); } |
4901 | 83 |
5602 | 84 octave_idx_type nnz (void) const; |
85 | |
5570 | 86 Cell column (octave_idx_type i) const; |
87 | |
5775 | 88 // FIXME |
4932 | 89 boolMatrix all (int /* dim */ = 0) const { return boolMatrix (); } |
3933 | 90 |
5775 | 91 // FIXME |
4932 | 92 boolMatrix any (int /* dim */ = 0) const { return boolMatrix (); } |
3933 | 93 |
5275 | 94 Cell concat (const Cell& rb, const Array<octave_idx_type>& ra_idx); |
4915 | 95 |
5275 | 96 Cell& insert (const Cell& a, octave_idx_type r, octave_idx_type c); |
97 Cell& insert (const Cell& a, const Array<octave_idx_type>& ra_idx); | |
4806 | 98 |
5775 | 99 // FIXME |
8626
1dce30ab0e72
don't convert NaN to logical in bool expressions
John W. Eaton <jwe@octave.org>
parents:
8579
diff
changeset
|
100 bool any_element_is_nan (void) const { return false; } |
3933 | 101 bool is_true (void) const { return false; } |
102 | |
4219 | 103 static octave_value resize_fill_value (void) { return Matrix (); } |
7530
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
104 |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7618
diff
changeset
|
105 Cell diag (octave_idx_type k = 0) const; |
7618
3209a584e1ac
Further type preservation tests and fix of diag for cell arrays
David Bateman <dbateman@free.fr>
parents:
7530
diff
changeset
|
106 |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9732
diff
changeset
|
107 Cell map (unary_mapper_t umap) const; |
3353 | 108 }; |
109 | |
110 #endif | |
111 | |
112 /* | |
113 ;;; Local Variables: *** | |
114 ;;; mode: C++ *** | |
115 ;;; End: *** | |
116 */ |