Mercurial > octave-nkf
annotate src/Cell.h @ 8732:a669df7beb73
[mq]: x
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 12 Feb 2009 14:37:43 -0500 |
parents | 280fae940bb0 |
children | eb63fbe60fab |
rev | line source |
---|---|
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" | |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
31 #include "ov.h" |
3353 | 32 |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
33 class octave_value_list; |
3353 | 34 |
35 class | |
6169 | 36 OCTINTERP_API |
4513 | 37 Cell : public ArrayN<octave_value> |
3353 | 38 { |
39 public: | |
40 | |
41 Cell (void) | |
4548 | 42 : ArrayN<octave_value> (dim_vector (0, 0)) { } |
3928 | 43 |
44 Cell (const octave_value& val) | |
4513 | 45 : ArrayN<octave_value> (dim_vector (1, 1), val) { } |
46 | |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
47 Cell (const octave_value_list& ovl); |
3353 | 48 |
7209 | 49 Cell (octave_idx_type n, octave_idx_type m, |
50 const octave_value& val = resize_fill_value ()) | |
4513 | 51 : ArrayN<octave_value> (dim_vector (n, m), val) { } |
3353 | 52 |
4587 | 53 Cell (const dim_vector& dv, const octave_value& val = resize_fill_value ()) |
54 : ArrayN<octave_value> (dv, val) { } | |
4563 | 55 |
4513 | 56 Cell (const ArrayN<octave_value>& c) |
57 : ArrayN<octave_value> (c) { } | |
3354 | 58 |
4567 | 59 Cell (const Array<octave_value>& c) |
60 : ArrayN<octave_value> (c) { } | |
61 | |
5275 | 62 Cell (const Array<octave_value>& c, octave_idx_type nr, octave_idx_type nc) |
4513 | 63 : ArrayN<octave_value> (c, dim_vector (nr, nc)) { } |
3933 | 64 |
5805 | 65 Cell (const string_vector& sv, bool trim = false); |
4216 | 66 |
8732 | 67 Cell (const Array<std::string>& sa); |
68 | |
6116 | 69 Cell (const dim_vector& dv, const string_vector& sv, bool trim = false); |
70 | |
3353 | 71 Cell (const Cell& c) |
4513 | 72 : ArrayN<octave_value> (c) { } |
73 | |
6116 | 74 bool is_cellstr (void) const; |
75 | |
4513 | 76 Cell index (const octave_value_list& idx, bool resize_ok = false) const; |
77 | |
8175
977d5204cf67
fix null assignment for structs
Jaroslav Hajek <highegg@gmail.com>
parents:
7620
diff
changeset
|
78 Cell& delete_elements (const octave_value_list& idx); |
977d5204cf67
fix null assignment for structs
Jaroslav Hajek <highegg@gmail.com>
parents:
7620
diff
changeset
|
79 |
4513 | 80 Cell& assign (const octave_value_list& idx, const Cell& rhs, |
8679
280fae940bb0
optimize scalar indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8626
diff
changeset
|
81 const octave_value& fill_val = resize_fill_value ()); |
8290
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8175
diff
changeset
|
82 |
4901 | 83 Cell reshape (const dim_vector& new_dims) const |
84 { return ArrayN<octave_value>::reshape (new_dims); } | |
85 | |
5602 | 86 octave_idx_type nnz (void) const; |
87 | |
5570 | 88 Cell column (octave_idx_type i) const; |
89 | |
5775 | 90 // FIXME |
4932 | 91 boolMatrix all (int /* dim */ = 0) const { return boolMatrix (); } |
3933 | 92 |
5775 | 93 // FIXME |
4932 | 94 boolMatrix any (int /* dim */ = 0) const { return boolMatrix (); } |
3933 | 95 |
5275 | 96 Cell concat (const Cell& rb, const Array<octave_idx_type>& ra_idx); |
4915 | 97 |
5275 | 98 Cell& insert (const Cell& a, octave_idx_type r, octave_idx_type c); |
99 Cell& insert (const Cell& a, const Array<octave_idx_type>& ra_idx); | |
4806 | 100 |
5775 | 101 // FIXME |
8626
1dce30ab0e72
don't convert NaN to logical in bool expressions
John W. Eaton <jwe@octave.org>
parents:
8579
diff
changeset
|
102 bool any_element_is_nan (void) const { return false; } |
3933 | 103 bool is_true (void) const { return false; } |
104 | |
4219 | 105 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
|
106 |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7618
diff
changeset
|
107 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
|
108 |
7530
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
109 Cell xisalnum (void) const { return map (&octave_value::xisalnum); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
110 Cell xisalpha (void) const { return map (&octave_value::xisalpha); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
111 Cell xisascii (void) const { return map (&octave_value::xisascii); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
112 Cell xiscntrl (void) const { return map (&octave_value::xiscntrl); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
113 Cell xisdigit (void) const { return map (&octave_value::xisdigit); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
114 Cell xisgraph (void) const { return map (&octave_value::xisgraph); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
115 Cell xislower (void) const { return map (&octave_value::xislower); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
116 Cell xisprint (void) const { return map (&octave_value::xisprint); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
117 Cell xispunct (void) const { return map (&octave_value::xispunct); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
118 Cell xisspace (void) const { return map (&octave_value::xisspace); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
119 Cell xisupper (void) const { return map (&octave_value::xisupper); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
120 Cell xisxdigit (void) const { return map (&octave_value::xisxdigit); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
121 Cell xtoascii (void) const { return map (&octave_value::xtoascii); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
122 Cell xtolower (void) const { return map (&octave_value::xtolower); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
123 Cell xtoupper (void) const { return map (&octave_value::xtoupper); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
124 |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
125 private: |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
126 |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
127 typedef octave_value (octave_value::*ctype_mapper) (void) const; |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
128 |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
129 Cell map (ctype_mapper) const; |
3353 | 130 }; |
131 | |
132 #endif | |
133 | |
134 /* | |
135 ;;; Local Variables: *** | |
136 ;;; mode: C++ *** | |
137 ;;; End: *** | |
138 */ |