GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Cell.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1999-2015 John W. Eaton
4 Copyright (C) 2009-2010 VZLU Prague
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
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
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
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if !defined (octave_Cell_h)
25 #define octave_Cell_h 1
26 
27 #include <string>
28 
29 #include "Array.h"
30 #include "str-vec.h"
31 #include "ov.h"
32 
33 class octave_value_list;
34 
35 class
38 {
39 public:
40 
41  Cell (void)
42  : Array<octave_value> (dim_vector (0, 0)) { }
43 
44  Cell (const octave_value& val)
45  : Array<octave_value> (dim_vector (1, 1), val) { }
46 
47  Cell (const octave_value_list& ovl);
48 
50  const octave_value& val = Matrix ())
51  : Array<octave_value> (dim_vector (n, m), val) { }
52 
53  Cell (const dim_vector& dv, const octave_value& val = Matrix ())
54  : Array<octave_value> (dv, val) { }
55 
57  : Array<octave_value> (c) { }
58 
60  : Array<octave_value> (c, dim_vector (nr, nc)) { }
61 
62  Cell (const string_vector& sv, bool trim = false);
63 
64  Cell (const std::list<std::string>& lst);
65 
66  Cell (const Array<std::string>& sa);
67 
68  Cell (const dim_vector& dv, const string_vector& sv, bool trim = false);
69 
70  Cell (const Cell& c)
71  : Array<octave_value> (c) { }
72 
73  bool is_cellstr (void) const;
74 
75  Array<std::string> cellstr_value (void) const;
76 
78 
79  Cell index (const octave_value_list& idx, bool resize_ok = false) const;
80 
82 
83  void delete_elements (const octave_value_list& idx);
84 
86 
87  void assign (const octave_value_list& idx, const Cell& rhs,
88  const octave_value& fill_val = Matrix ());
89 
90  Cell reshape (const dim_vector& new_dims) const
91  { return Array<octave_value>::reshape (new_dims); }
92 
93  octave_idx_type nnz (void) const;
94 
95  Cell column (octave_idx_type i) const;
96 
97  // FIXME
98  boolMatrix all (int /* dim */ = 0) const { return boolMatrix (); }
99 
100  // FIXME
101  boolMatrix any (int /* dim */ = 0) const { return boolMatrix (); }
102 
103  Cell concat (const Cell& rb, const Array<octave_idx_type>& ra_idx);
104 
105  Cell& insert (const Cell& a, octave_idx_type r, octave_idx_type c);
106  Cell& insert (const Cell& a, const Array<octave_idx_type>& ra_idx);
107 
108  // FIXME
109  bool any_element_is_nan (void) const { return false; }
110  bool is_true (void) const { return false; }
111 
113  {
114  static Matrix rfv;
115  return rfv;
116  }
117 
118  Cell diag (octave_idx_type k = 0) const;
119 
120  Cell diag (octave_idx_type m, octave_idx_type n) const;
121 
122  Cell xisalnum (void) const { return map (&octave_value::xisalnum); }
123  Cell xisalpha (void) const { return map (&octave_value::xisalpha); }
124  Cell xisascii (void) const { return map (&octave_value::xisascii); }
125  Cell xiscntrl (void) const { return map (&octave_value::xiscntrl); }
126  Cell xisdigit (void) const { return map (&octave_value::xisdigit); }
127  Cell xisgraph (void) const { return map (&octave_value::xisgraph); }
128  Cell xislower (void) const { return map (&octave_value::xislower); }
129  Cell xisprint (void) const { return map (&octave_value::xisprint); }
130  Cell xispunct (void) const { return map (&octave_value::xispunct); }
131  Cell xisspace (void) const { return map (&octave_value::xisspace); }
132  Cell xisupper (void) const { return map (&octave_value::xisupper); }
133  Cell xisxdigit (void) const { return map (&octave_value::xisxdigit); }
134  Cell xtoascii (void) const { return map (&octave_value::xtoascii); }
135  Cell xtolower (void) const { return map (&octave_value::xtolower); }
136  Cell xtoupper (void) const { return map (&octave_value::xtoupper); }
137 
138 private:
139 
140  typedef octave_value (octave_value::*ctype_mapper) (void) const;
141 
142  Cell map (ctype_mapper) const;
143 };
144 
145 template<>
147 { return v.cell_value (); }
148 
149 #endif
boolMatrix all(int=0) const
Definition: Cell.h:98
Cell xtolower(void) const
Definition: Cell.h:135
Definition: Cell.h:35
Cell xispunct(void) const
Definition: Cell.h:130
octave_value resize_fill_value(void) const
Definition: Cell.h:112
Cell xisxdigit(void) const
Definition: Cell.h:133
Cell xisupper(void) const
Definition: Cell.h:132
const octave_base_value const Array< octave_idx_type > & ra_idx
Cell reshape(const dim_vector &new_dims) const
Definition: Cell.h:90
octave_value xisalpha(void) const
Definition: ov.h:1208
Cell(const dim_vector &dv, const octave_value &val=Matrix())
Definition: Cell.h:53
Cell xisgraph(void) const
Definition: Cell.h:127
Cell xisspace(void) const
Definition: Cell.h:131
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:664
octave_value xisprint(void) const
Definition: ov.h:1214
octave_value xtoascii(void) const
Definition: ov.h:1220
octave_value xisxdigit(void) const
Definition: ov.h:1218
boolMatrix any(int=0) const
Definition: Cell.h:101
Cell xisprint(void) const
Definition: Cell.h:129
Cell(const Cell &c)
Definition: Cell.h:70
Cell(const Array< octave_value > &c)
Definition: Cell.h:56
octave_value xispunct(void) const
Definition: ov.h:1215
octave_value xtolower(void) const
Definition: ov.h:1221
bool is_true(void) const
Definition: Cell.h:110
#define OCTINTERP_API
Definition: mexproto.h:66
octave_value xisalnum(void) const
Definition: ov.h:1207
Cell(octave_idx_type n, octave_idx_type m, const octave_value &val=Matrix())
Definition: Cell.h:49
octave_value xisupper(void) const
Definition: ov.h:1217
octave_value xisspace(void) const
Definition: ov.h:1216
Definition: dMatrix.h:35
bool any_element_is_nan(void) const
Definition: Cell.h:109
Cell(const Array< octave_value > &c, octave_idx_type nr, octave_idx_type nc)
Definition: Cell.h:59
octave_value xiscntrl(void) const
Definition: ov.h:1210
Cell xisalnum(void) const
Definition: Cell.h:122
Cell octave_value_extract< Cell >(const octave_value &v)
Definition: Cell.h:146
Cell xtoupper(void) const
Definition: Cell.h:136
octave_value xtoupper(void) const
Definition: ov.h:1222
Cell xiscntrl(void) const
Definition: Cell.h:125
octave_value xisascii(void) const
Definition: ov.h:1209
octave_value_list ovl(const octave_value &a0)
Definition: oct-obj.h:178
Cell xisascii(void) const
Definition: Cell.h:124
Cell(void)
Definition: Cell.h:41
octave_value xisgraph(void) const
Definition: ov.h:1212
Cell xisalpha(void) const
Definition: Cell.h:123
Array< T > reshape(octave_idx_type nr, octave_idx_type nc) const
Definition: Array.h:460
Cell xisdigit(void) const
Definition: Cell.h:126
Cell(const octave_value &val)
Definition: Cell.h:44
octave_value xisdigit(void) const
Definition: ov.h:1211
Cell xislower(void) const
Definition: Cell.h:128
octave_value xislower(void) const
Definition: ov.h:1213
Cell xtoascii(void) const
Definition: Cell.h:134
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))