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
ov-ch-mat.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-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_ov_ch_mat_h)
25 #define octave_ov_ch_mat_h 1
26 
27 #include <cstdlib>
28 
29 #include <iosfwd>
30 #include <string>
31 
32 #include "mx-base.h"
33 #include "str-vec.h"
34 
35 #include "error.h"
36 #include "ov.h"
37 #include "ov-base.h"
38 #include "ov-base-mat.h"
39 #include "ov-re-mat.h"
40 #include "ov-typeinfo.h"
41 
42 class octave_value_list;
43 
44 class tree_walker;
45 
46 // Character matrix values.
47 
48 class
50 {
51 protected:
52 
55 
57  : octave_base_matrix<charNDArray> (chm) { }
58 
60  : octave_base_matrix<charNDArray> (chm) { }
61 
63  : octave_base_matrix<charNDArray> (chm) { }
64 
67 
68  octave_char_matrix (const char *s)
70 
71  octave_char_matrix (const std::string& s)
73 
76 
78  : octave_base_matrix<charNDArray> (chm) { }
79 
80 public:
81 
83 
84  octave_base_value *clone (void) const
85  { return new octave_char_matrix (*this); }
87  { return new octave_char_matrix (); }
88 
89  idx_vector index_vector (bool require_integers = false) const;
90 
91  builtin_type_t builtin_type (void) const { return btyp_char; }
92 
93  bool is_char_matrix (void) const { return true; }
94  bool is_real_matrix (void) const { return true; }
95 
96  bool is_real_type (void) const { return true; }
97 
98  double double_value (bool = false) const;
99 
100  float float_value (bool = false) const;
101 
102  double scalar_value (bool frc_str_conv = false) const
103  { return double_value (frc_str_conv); }
104 
105  float float_scalar_value (bool frc_str_conv = false) const
106  { return float_value (frc_str_conv); }
107 
108  Matrix matrix_value (bool = false) const
109  { return Matrix (charMatrix (matrix)); }
110 
111  FloatMatrix float_matrix_value (bool = false) const
112  { return FloatMatrix (charMatrix (matrix)); }
113 
114  NDArray array_value (bool = false) const
115  { return NDArray (matrix); }
116 
117  FloatNDArray float_array_value (bool = false) const
118  { return FloatNDArray (matrix); }
119 
120  Complex complex_value (bool = false) const;
121 
122  FloatComplex float_complex_value (bool = false) const;
123 
124  ComplexMatrix complex_matrix_value (bool = false) const
125  { return ComplexMatrix (charMatrix (matrix)); }
126 
128  { return FloatComplexMatrix (charMatrix (matrix)); }
129 
130  ComplexNDArray complex_array_value (bool = false) const
131  { return ComplexNDArray (matrix); }
132 
134  { return FloatComplexNDArray (matrix); }
135 
136  charMatrix char_matrix_value (bool = false) const
137  { return charMatrix (matrix); }
138 
139  charNDArray char_array_value (bool = false) const
140  { return matrix; }
141 
142  octave_value convert_to_str_internal (bool, bool, char type) const
143  { return octave_value (matrix, type); }
144 
145  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
146 
147  // Unsafe. This function exists to support the MEX interface.
148  // You should not use it anywhere else.
149  void *mex_get_data (void) const { return matrix.mex_get_data (); }
150 
151  mxArray *as_mxArray (void) const;
152 
153  octave_value map (unary_mapper_t umap) const;
154 };
155 
156 #endif
~octave_char_matrix(void)
Definition: ov-ch-mat.h:82
FloatMatrix float_matrix_value(bool=false) const
Definition: ov-ch-mat.h:111
double scalar_value(bool frc_str_conv=false) const
Definition: ov-ch-mat.h:102
octave_value convert_to_str_internal(bool, bool, char type) const
Definition: ov-ch-mat.h:142
ComplexNDArray complex_array_value(bool=false) const
Definition: ov-ch-mat.h:130
bool is_real_matrix(void) const
Definition: ov-ch-mat.h:94
octave_char_matrix(void)
Definition: ov-ch-mat.h:53
octave_char_matrix(const charMatrix &chm)
Definition: ov-ch-mat.h:56
octave_base_value * empty_clone(void) const
Definition: ov-ch-mat.h:86
FloatComplexMatrix float_complex_matrix_value(bool=false) const
Definition: ov-ch-mat.h:127
FloatComplexNDArray float_complex_array_value(bool=false) const
Definition: ov-ch-mat.h:133
octave_char_matrix(const charNDArray &chm)
Definition: ov-ch-mat.h:59
bool is_real_type(void) const
Definition: ov-ch-mat.h:96
octave_char_matrix(const string_vector &s)
Definition: ov-ch-mat.h:74
ComplexMatrix complex_matrix_value(bool=false) const
Definition: ov-ch-mat.h:124
builtin_type_t
Definition: ov-base.h:59
octave_char_matrix(const std::string &s)
Definition: ov-ch-mat.h:71
void * mex_get_data(void) const
Definition: ov-ch-mat.h:149
Matrix matrix_value(bool=false) const
Definition: ov-ch-mat.h:108
builtin_type_t builtin_type(void) const
Definition: ov-ch-mat.h:91
octave_char_matrix(const char *s)
Definition: ov-ch-mat.h:68
octave_char_matrix(const Array< char > &chm)
Definition: ov-ch-mat.h:62
octave_base_value * clone(void) const
Definition: ov-ch-mat.h:84
Definition: dMatrix.h:35
charMatrix char_matrix_value(bool=false) const
Definition: ov-ch-mat.h:136
float float_scalar_value(bool frc_str_conv=false) const
Definition: ov-ch-mat.h:105
octave_char_matrix(const octave_char_matrix &chm)
Definition: ov-ch-mat.h:77
octave_char_matrix(char c)
Definition: ov-ch-mat.h:65
charNDArray char_array_value(bool=false) const
Definition: ov-ch-mat.h:139
NDArray array_value(bool=false) const
Definition: ov-ch-mat.h:114
std::complex< float > FloatComplex
Definition: oct-cmplx.h:30
bool is_char_matrix(void) const
Definition: ov-ch-mat.h:93
std::complex< double > Complex
Definition: oct-cmplx.h:29
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
FloatNDArray float_array_value(bool=false) const
Definition: ov-ch-mat.h:117