00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if !defined (octave_char_matrix_h)
00025 #define octave_char_matrix_h 1
00026
00027 #include <cstdlib>
00028
00029 #include <iosfwd>
00030 #include <string>
00031
00032 #include "mx-base.h"
00033 #include "oct-alloc.h"
00034 #include "str-vec.h"
00035
00036 #include "error.h"
00037 #include "ov.h"
00038 #include "ov-base.h"
00039 #include "ov-base-mat.h"
00040 #include "ov-re-mat.h"
00041 #include "ov-typeinfo.h"
00042
00043 class Octave_map;
00044 class octave_value_list;
00045
00046 class tree_walker;
00047
00048
00049
00050 class
00051 octave_char_matrix : public octave_base_matrix<charNDArray>
00052 {
00053 protected:
00054
00055 octave_char_matrix (void)
00056 : octave_base_matrix<charNDArray> () { }
00057
00058 octave_char_matrix (const charMatrix& chm)
00059 : octave_base_matrix<charNDArray> (chm) { }
00060
00061 octave_char_matrix (const charNDArray& chm)
00062 : octave_base_matrix<charNDArray> (chm) { }
00063
00064 octave_char_matrix (char c)
00065 : octave_base_matrix<charNDArray> (c) { }
00066
00067 octave_char_matrix (const char *s)
00068 : octave_base_matrix<charNDArray> (s) { }
00069
00070 octave_char_matrix (const std::string& s)
00071 : octave_base_matrix<charNDArray> (s) { }
00072
00073 octave_char_matrix (const string_vector& s)
00074 : octave_base_matrix<charNDArray> (s) { }
00075
00076 octave_char_matrix (const octave_char_matrix& chm)
00077 : octave_base_matrix<charNDArray> (chm) { }
00078
00079 public:
00080
00081 ~octave_char_matrix (void) { }
00082
00083 octave_base_value *clone (void) const { return new octave_char_matrix (*this); }
00084 octave_base_value *empty_clone (void) const { return new octave_char_matrix (); }
00085
00086 idx_vector index_vector (void) const;
00087
00088 builtin_type_t builtin_type (void) const { return btyp_char; }
00089
00090 bool is_char_matrix (void) const { return true; }
00091 bool is_real_matrix (void) const { return true; }
00092
00093 bool is_real_type (void) const { return true; }
00094
00095 double double_value (bool = false) const;
00096
00097 float float_value (bool = false) const;
00098
00099 double scalar_value (bool frc_str_conv = false) const
00100 { return double_value (frc_str_conv); }
00101
00102 float float_scalar_value (bool frc_str_conv = false) const
00103 { return float_value (frc_str_conv); }
00104
00105 Matrix matrix_value (bool = false) const
00106 { return Matrix (matrix.matrix_value ()); }
00107
00108 FloatMatrix float_matrix_value (bool = false) const
00109 { return FloatMatrix (matrix.matrix_value ()); }
00110
00111 NDArray array_value (bool = false) const
00112 { return NDArray (matrix); }
00113
00114 FloatNDArray float_array_value (bool = false) const
00115 { return FloatNDArray (matrix); }
00116
00117 Complex complex_value (bool = false) const;
00118
00119 FloatComplex float_complex_value (bool = false) const;
00120
00121 ComplexMatrix complex_matrix_value (bool = false) const
00122 { return ComplexMatrix (matrix.matrix_value ()); }
00123
00124 FloatComplexMatrix float_complex_matrix_value (bool = false) const
00125 { return FloatComplexMatrix (matrix.matrix_value ()); }
00126
00127 ComplexNDArray complex_array_value (bool = false) const
00128 { return ComplexNDArray (matrix); }
00129
00130 FloatComplexNDArray float_complex_array_value (bool = false) const
00131 { return FloatComplexNDArray (matrix); }
00132
00133 charMatrix char_matrix_value (bool = false) const
00134 { return matrix.matrix_value (); }
00135
00136 charNDArray char_array_value (bool = false) const
00137 { return matrix; }
00138
00139 octave_value convert_to_str_internal (bool, bool, char type) const
00140 { return octave_value (matrix, type); }
00141
00142 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
00143
00144 mxArray *as_mxArray (void) const;
00145
00146 octave_value xisalnum (void) const;
00147 octave_value xisalpha (void) const;
00148 octave_value xisascii (void) const;
00149 octave_value xiscntrl (void) const;
00150 octave_value xisdigit (void) const;
00151 octave_value xisgraph (void) const;
00152 octave_value xislower (void) const;
00153 octave_value xisprint (void) const;
00154 octave_value xispunct (void) const;
00155 octave_value xisspace (void) const;
00156 octave_value xisupper (void) const;
00157 octave_value xisxdigit (void) const;
00158 octave_value xtoascii (void) const;
00159 octave_value xtolower (void) const;
00160 octave_value xtoupper (void) const;
00161
00162 #define MAT_MAPPER(MAP) \
00163 octave_value MAP (void) const \
00164 { \
00165 octave_matrix m (array_value (true)); \
00166 return m.MAP (); \
00167 }
00168
00169 MAT_MAPPER (abs)
00170 MAT_MAPPER (angle)
00171 MAT_MAPPER (arg)
00172 MAT_MAPPER (ceil)
00173 MAT_MAPPER (conj)
00174 MAT_MAPPER (fix)
00175 MAT_MAPPER (floor)
00176 MAT_MAPPER (imag)
00177 MAT_MAPPER (real)
00178 MAT_MAPPER (round)
00179 MAT_MAPPER (signum)
00180
00181 #undef MAT_MAPPER
00182
00183 #define BOOL_MAT_MAPPER(MAP, VAL) \
00184 octave_value MAP (void) const \
00185 { \
00186 return boolNDArray (matrix.dims (), VAL); \
00187 }
00188
00189 BOOL_MAT_MAPPER (finite, true)
00190 BOOL_MAT_MAPPER (isinf, false)
00191 BOOL_MAT_MAPPER (isna, false)
00192 BOOL_MAT_MAPPER (isnan, false)
00193
00194 #undef BOOL_MAT_MAPPER
00195
00196 };
00197
00198 #endif
00199
00200
00201
00202
00203
00204