Mercurial > hg > octave-nkf
annotate src/Cell.h @ 10521:4d1fc073fbb7
add some missing copyright stmts
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 14 Apr 2010 12:23:13 +0200 |
parents | f3b65e1ae355 |
children | 64472dd48517 |
rev | line source |
---|---|
3353 | 1 /* |
2 | |
8920 | 3 Copyright (C) 1999, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
4 2009 John W. Eaton | |
10521
4d1fc073fbb7
add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
5 Copyright (C) 2009, 2010 VZLU Prague |
3353 | 6 |
7 This file is part of Octave. | |
8 | |
9 Octave is free software; you can redistribute it and/or modify it | |
10 under the terms of the GNU General Public License as published by the | |
7016 | 11 Free Software Foundation; either version 3 of the License, or (at your |
12 option) any later version. | |
3353 | 13 |
14 Octave is distributed in the hope that it will be useful, but WITHOUT | |
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
17 for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
7016 | 20 along with Octave; see the file COPYING. If not, see |
21 <http://www.gnu.org/licenses/>. | |
3353 | 22 |
23 */ | |
24 | |
25 #if !defined (Cell_h) | |
26 #define Cell_h 1 | |
27 | |
28 #include <string> | |
29 | |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
30 #include "Array.h" |
3353 | 31 #include "oct-alloc.h" |
32 #include "str-vec.h" | |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
33 #include "ov.h" |
3353 | 34 |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
35 class octave_value_list; |
3353 | 36 |
37 class | |
6169 | 38 OCTINTERP_API |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
39 Cell : public Array<octave_value> |
3353 | 40 { |
41 public: | |
42 | |
43 Cell (void) | |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
44 : Array<octave_value> (dim_vector (0, 0)) { } |
3928 | 45 |
46 Cell (const octave_value& val) | |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
47 : Array<octave_value> (dim_vector (1, 1), val) { } |
4513 | 48 |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8333
diff
changeset
|
49 Cell (const octave_value_list& ovl); |
3353 | 50 |
7209 | 51 Cell (octave_idx_type n, octave_idx_type m, |
10313 | 52 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
|
53 : Array<octave_value> (dim_vector (n, m), val) { } |
3353 | 54 |
4587 | 55 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
|
56 : Array<octave_value> (dv, val) { } |
3354 | 57 |
4567 | 58 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
|
59 : Array<octave_value> (c) { } |
4567 | 60 |
5275 | 61 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
|
62 : Array<octave_value> (c, dim_vector (nr, nc)) { } |
3933 | 63 |
5805 | 64 Cell (const string_vector& sv, bool trim = false); |
4216 | 65 |
8732 | 66 Cell (const Array<std::string>& sa); |
67 | |
6116 | 68 Cell (const dim_vector& dv, const string_vector& sv, bool trim = false); |
69 | |
3353 | 70 Cell (const Cell& c) |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
71 : Array<octave_value> (c) { } |
4513 | 72 |
6116 | 73 bool is_cellstr (void) const; |
74 | |
10065
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
75 Array<std::string> cellstr_value (void) const; |
64a06079cae4
improve cellstr cache implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
76 |
4513 | 77 Cell index (const octave_value_list& idx, bool resize_ok = false) const; |
78 | |
8175
977d5204cf67
fix null assignment for structs
Jaroslav Hajek <highegg@gmail.com>
parents:
7620
diff
changeset
|
79 Cell& delete_elements (const octave_value_list& idx); |
977d5204cf67
fix null assignment for structs
Jaroslav Hajek <highegg@gmail.com>
parents:
7620
diff
changeset
|
80 |
4513 | 81 Cell& assign (const octave_value_list& idx, const Cell& rhs, |
10313 | 82 const octave_value& fill_val = resize_fill_value ()); |
8290
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8175
diff
changeset
|
83 |
4901 | 84 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
|
85 { return Array<octave_value>::reshape (new_dims); } |
4901 | 86 |
5602 | 87 octave_idx_type nnz (void) const; |
88 | |
5570 | 89 Cell column (octave_idx_type i) const; |
90 | |
5775 | 91 // FIXME |
4932 | 92 boolMatrix all (int /* dim */ = 0) const { return boolMatrix (); } |
3933 | 93 |
5775 | 94 // FIXME |
4932 | 95 boolMatrix any (int /* dim */ = 0) const { return boolMatrix (); } |
3933 | 96 |
5275 | 97 Cell concat (const Cell& rb, const Array<octave_idx_type>& ra_idx); |
4915 | 98 |
5275 | 99 Cell& insert (const Cell& a, octave_idx_type r, octave_idx_type c); |
100 Cell& insert (const Cell& a, const Array<octave_idx_type>& ra_idx); | |
4806 | 101 |
5775 | 102 // FIXME |
8626
1dce30ab0e72
don't convert NaN to logical in bool expressions
John W. Eaton <jwe@octave.org>
parents:
8579
diff
changeset
|
103 bool any_element_is_nan (void) const { return false; } |
3933 | 104 bool is_true (void) const { return false; } |
105 | |
4219 | 106 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
|
107 |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7618
diff
changeset
|
108 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
|
109 |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
110 Cell xisalnum (void) const { return map (&octave_value::xisalnum); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
111 Cell xisalpha (void) const { return map (&octave_value::xisalpha); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
112 Cell xisascii (void) const { return map (&octave_value::xisascii); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
113 Cell xiscntrl (void) const { return map (&octave_value::xiscntrl); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
114 Cell xisdigit (void) const { return map (&octave_value::xisdigit); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
115 Cell xisgraph (void) const { return map (&octave_value::xisgraph); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
116 Cell xislower (void) const { return map (&octave_value::xislower); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
117 Cell xisprint (void) const { return map (&octave_value::xisprint); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
118 Cell xispunct (void) const { return map (&octave_value::xispunct); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
119 Cell xisspace (void) const { return map (&octave_value::xisspace); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
120 Cell xisupper (void) const { return map (&octave_value::xisupper); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
121 Cell xisxdigit (void) const { return map (&octave_value::xisxdigit); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
122 Cell xtoascii (void) const { return map (&octave_value::xtoascii); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
123 Cell xtolower (void) const { return map (&octave_value::xtolower); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
124 Cell xtoupper (void) const { return map (&octave_value::xtoupper); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
125 |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
126 private: |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
127 |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
128 typedef octave_value (octave_value::*ctype_mapper) (void) const; |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
129 |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
130 Cell map (ctype_mapper) const; |
3353 | 131 }; |
132 | |
133 #endif |