26 #if ! defined (octave_ov_base_h)
27 #define octave_ov_base_h 1
29 #include "octave-config.h"
94 extern OCTINTERP_API std::string
125 template <
typename T>
131 #define DEF_CLASS_TO_BTYP(CLASS,BTYP) \
133 struct class_to_btyp<CLASS> \
135 static const builtin_type_t btyp = BTYP; \
156 #define OCTAVE_EMPTY_CPP_ARG
158 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA \
159 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2 (OCTAVE_EMPTY_CPP_ARG)
161 #define DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA \
162 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(virtual)
164 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(VIRTUAL) \
166 VIRTUAL int type_id (void) const { return t_id; } \
167 VIRTUAL std::string type_name (void) const { return t_name; } \
168 VIRTUAL std::string class_name (void) const { return c_name; } \
169 static int static_type_id (void) { return t_id; } \
170 static std::string static_type_name (void) { return t_name; } \
171 static std::string static_class_name (void) { return c_name; } \
172 static void register_type (void); \
173 static void register_type (octave::type_info&); \
177 static const std::string t_name; \
178 static const std::string c_name;
180 #define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c) \
182 const std::string t::t_name (n); \
183 const std::string t::c_name (c); \
184 void t::register_type (void) \
186 octave::type_info& type_info \
187 = octave::__get_type_info__ (#t "::register_type"); \
189 register_type (type_info); \
191 void t::register_type (octave::type_info& ti) \
193 octave_value v (new t ()); \
194 t_id = ti.register_type (t::t_name, t::c_name, v); \
214 : _fcn (
f), _type_id (t) { }
216 operator type_conv_fcn (
void)
const {
return _fcn; }
219 {
return (*_fcn) (v); }
250 virtual type_conv_info
254 virtual type_conv_info
287 const std::list<octave_value_list>& idx);
291 const std::list<octave_value_list>& idx,
296 const std::list<octave_value_list>& idx,
306 const std::list<octave_value_list>& idx,
311 const std::list<octave_value_list>& idx,
361 virtual bool iscell (
void)
const {
return false; }
387 virtual bool is_range (
void)
const {
return false; }
389 virtual bool isstruct (
void)
const {
return false; }
391 virtual bool isobject (
void)
const {
return false; }
401 virtual bool isjava (
void)
const {
return false; }
419 virtual bool isfloat (
void)
const {
return false; }
441 virtual bool isreal (
void)
const {
return false; }
453 virtual bool issparse (
void)
const {
return false; }
455 virtual bool is_true (
void)
const {
return false; }
457 virtual bool isnull (
void)
const {
return false; }
483 virtual short int short_value (
bool =
false,
bool =
false)
const;
485 virtual unsigned short int ushort_value (
bool =
false,
bool =
false)
const;
487 virtual int int_value (
bool =
false,
bool =
false)
const;
489 virtual unsigned int uint_value (
bool =
false,
bool =
false)
const;
493 virtual long int long_value (
bool =
false,
bool =
false)
const;
495 virtual unsigned long int ulong_value (
bool =
false,
bool =
false)
const;
497 virtual int64_t
int64_value (
bool =
false,
bool =
false)
const;
499 virtual uint64_t
uint64_value (
bool =
false,
bool =
false)
const;
594 virtual std::string
string_value (
bool force =
false)
const;
606 virtual size_t nparents (
void)
const;
636 char type =
'\'')
const;
649 virtual void print (std::ostream& os,
bool pr_as_read_syntax =
false);
652 print_raw (std::ostream& os,
bool pr_as_read_syntax =
false)
const;
659 bool print_padding =
true);
661 virtual void short_disp (std::ostream& os)
const { os <<
"..."; }
669 virtual void print_info (std::ostream& os,
const std::string& prefix)
const;
675 virtual bool save_binary (std::ostream& os,
bool save_as_floats);
677 virtual bool load_binary (std::istream& is,
bool swap,
716 virtual void lock (
void);
718 virtual void unlock (
void);
720 virtual bool islocked (
void)
const {
return false; }
790 num_unary_mappers = umap_unknown
835 const std::list<octave_value_list>& idx,
839 { curr_print_indent_level = 0; }
842 { curr_print_indent_level += 2; }
845 { curr_print_indent_level -= 2; }
848 {
return curr_print_indent_level; }
850 void indent (std::ostream& os)
const;
852 void newline (std::ostream& os)
const;
854 void reset (
void)
const;
864 void warn_load (
const char *
type)
const;
865 void warn_save (
const char *
type)
const;
869 void wrong_type_arg_error (
void)
const;
886 const std::list<octave_value_list>& idx,
887 const std::string& who);
Vector representing the dimensions (size) of an Array.
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
bool zero_by_zero(void) const
octave_idx_type ndims(void) const
Number of dimensions.
type_conv_info(type_conv_fcn f=nullptr, int t=-1)
virtual bool is_mex_function(void) const
virtual bool isinteger(void) const
virtual bool is_uint64_type(void) const
virtual void * mex_get_data(void) const
virtual ~octave_base_value(void)=default
virtual type_conv_info numeric_conversion_function(void) const
virtual bool isfloat(void) const
virtual type_conv_info numeric_demotion_function(void) const
static bool beginning_of_line
virtual bool is_real_matrix(void) const
octave_idx_type columns(void) const
octave::refcount< octave_idx_type > count
virtual bool is_classdef_superclass_ref(void) const
void decrement_indent_level(void) const
virtual bool is_classdef_object(void) const
virtual bool is_diag_matrix(void) const
virtual bool is_function(void) const
virtual void short_disp(std::ostream &os) const
virtual bool is_user_code(void) const
void increment_indent_level(void) const
virtual bool is_package(void) const
virtual bool issparse(void) const
virtual bool is_uint16_type(void) const
virtual bool is_constant(void) const
virtual bool is_uint32_type(void) const
virtual bool is_user_function(void) const
virtual void erase_subfunctions(void)
int current_print_indent_level(void) const
virtual bool is_string(void) const
virtual octave_base_value * unique_parent_class(const std::string &)
virtual bool is_complex_matrix(void) const
virtual bool is_int32_type(void) const
virtual void call_object_destructor(void)
virtual bool isjava(void) const
virtual float float_scalar_value(bool frc_str_conv=false) const
virtual bool is_function_handle(void) const
virtual bool print_as_scalar(void) const
virtual bool is_true(void) const
virtual octave_base_value * unique_clone(void)
virtual void assign(const std::string &, const octave_value &)
virtual bool iscellstr(void) const
virtual bool is_uint8_type(void) const
virtual bool is_bool_scalar(void) const
virtual bool is_inline_function(void) const
virtual bool islogical(void) const
virtual bool is_user_script(void) const
bool is_zero_by_zero(void) const
virtual std::string edit_display(const float_display_format &, octave_idx_type, octave_idx_type) const
virtual bool isobject(void) const
static int curr_print_indent_level
virtual bool is_matrix_type(void) const
virtual bool is_complex_scalar(void) const
virtual bool is_bool_matrix(void) const
virtual void maybe_economize(void)
virtual bool is_scalar_type(void) const
void reset_indent_level(void) const
virtual bool is_all_va_args(void) const
virtual octave_idx_type * mex_get_ir(void) const
virtual bool is_cs_list(void) const
virtual bool is_int16_type(void) const
virtual dim_vector dims(void) const
virtual octave_idx_type numel(void) const
virtual builtin_type_t builtin_type(void) const
virtual bool is_dld_function(void) const
octave_base_value(const octave_base_value &)
virtual bool is_int8_type(void) const
virtual bool isstruct(void) const
virtual octave_base_value * try_narrowing_conversion(void)
octave_idx_type rows(void) const
virtual bool is_double_type(void) const
virtual double scalar_value(bool frc_str_conv=false) const
virtual octave_base_value * find_parent_class(const std::string &)
virtual bool is_char_matrix(void) const
virtual octave_idx_type * mex_get_jc(void) const
virtual bool is_anonymous_function(void) const
virtual bool is_int64_type(void) const
virtual bool islocked(void) const
virtual bool is_instance_of(const std::string &) const
virtual int ndims(void) const
virtual bool isnull(void) const
virtual bool is_real_scalar(void) const
virtual bool iscomplex(void) const
virtual bool is_perm_matrix(void) const
virtual bool is_classdef_meta(void) const
virtual bool is_single_type(void) const
virtual bool is_magic_colon(void) const
virtual size_t byte_size(void) const
virtual bool isreal(void) const
virtual bool isnumeric(void) const
virtual bool is_defined(void) const
virtual bool is_sq_string(void) const
virtual octave_base_value * clone(void) const
virtual bool iscell(void) const
virtual bool is_builtin_function(void) const
virtual bool is_range(void) const
MatrixType matrix_type(void) const
uint64_t uint64_value(bool req_int=false, bool frc_str_conv=false) const
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
int32NDArray int32_array_value(void) const
boolNDArray bool_array_value(bool warn=false) const
uint16NDArray uint16_array_value(void) const
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
bool bool_value(bool warn=false) const
octave_int64 int64_scalar_value(void) const
octave_value convert_to_str_internal(bool pad, bool force, char type) const
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
charMatrix char_matrix_value(bool frc_str_conv=false) const
octave_uint8 uint8_scalar_value(void) const
DiagMatrix diag_matrix_value(bool force=false) const
bool fast_elem_insert(octave_idx_type n, const octave_value &x)
Assign the n-th element, aka 'val(n) = x'.
octave_uint32 uint32_scalar_value(void) const
octave_user_function * user_function_value(bool silent=false) const
int int_value(bool req_int=false, bool frc_str_conv=false) const
void print_with_name(std::ostream &os, const std::string &name) const
octave_idx_type nnz(void) const
mxArray * as_mxArray(void) const
int64_t int64_value(bool req_int=false, bool frc_str_conv=false) const
short int short_value(bool req_int=false, bool frc_str_conv=false) const
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
octave_value permute(const Array< int > &vec, bool inv=false) const
FloatDiagMatrix float_diag_matrix_value(bool force=false) const
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
std::list< std::string > parent_class_name_list(void) const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
octave_value dump(void) const
Complex complex_value(bool frc_str_conv=false) const
octave_value as_uint64(void) const
octave_value as_uint16(void) const
FloatComplexDiagMatrix float_complex_diag_matrix_value(bool force=false) const
octave_value as_single(void) const
octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
unsigned short int ushort_value(bool req_int=false, bool frc_str_conv=false) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
octave_value full_value(void) const
Range range_value(void) const
octave_value squeeze(void) const
octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
size_t nparents(void) const
void convert_to_row_or_column_vector(void)
octave_user_code * user_code_value(bool silent=false) const
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
octave_base_value * empty_clone(void) const
octave_value as_uint32(void) const
octave_int8 int8_scalar_value(void) const
bool save_binary(std::ostream &os, bool save_as_floats)
charNDArray char_array_value(bool frc_str_conv=false) const
octave_int32 int32_scalar_value(void) const
octave_uint16 uint16_scalar_value(void) const
bool save_ascii(std::ostream &os)
Cell cell_value(void) const
FloatComplex float_complex_value(bool frc_str_conv=false) const
octave_idx_type xnumel(const octave_value_list &idx)
int8NDArray int8_array_value(void) const
octave_value as_int64(void) const
float float_value(bool frc_str_conv=false) const
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
int64NDArray int64_array_value(void) const
octave_function * function_value(bool silent=false) const
unsigned long int ulong_value(bool req_int=false, bool frc_str_conv=false) const
uint8NDArray uint8_array_value(void) const
octave_value any(int dim=0) const
octave_value reshape(const dim_vector &dv) const
octave_value as_int16(void) const
octave_value as_uint8(void) const
bool load_ascii(std::istream &is)
octave_value as_int32(void) const
octave_fcn_handle * fcn_handle_value(bool silent=false) const
boolMatrix bool_matrix_value(bool warn=false) const
octave_idx_type nfields(void) const
octave_value fast_elem_extract(octave_idx_type n) const
Extract the n-th element, aka 'val(n)'.
std::string string_value(bool force=false) const
ComplexDiagMatrix complex_diag_matrix_value(bool force=false) const
int nint_value(bool frc_str_conv=false) const
FloatMatrix float_matrix_value(bool frc_str_conv=false) const
string_vector parent_class_names(void) const
void print_info(std::ostream &os, const std::string &prefix="") const
octave_scalar_map scalar_map_value(void) const
octave_value map(octave_base_value::unary_mapper_t umap) const
octave_idx_type nzmax(void) const
long int long_value(bool req_int=false, bool frc_str_conv=false) const
uint64NDArray uint64_array_value(void) const
string_vector string_vector_value(bool pad=false) const
PermMatrix perm_matrix_value(void) const
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
octave_classdef * classdef_object_value(bool silent=false) const
octave_uint64 uint64_scalar_value(void) const
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
NDArray array_value(bool frc_str_conv=false) const
int write(octave::stream &os, int block_size, oct_data_conv::data_type output_type, int skip, octave::mach_info::float_format flt_fmt) const
uint32NDArray uint32_array_value(void) const
octave_value convert_to_str(bool pad=false, bool force=false, char type='\'') const
bool print_name_tag(std::ostream &os, const std::string &name) const
octave_value_list list_value(void) const
sortmode issorted(sortmode mode=UNSORTED) const
octave_value all(int dim=0) const
std::string xstring_value(const char *fmt,...) const
octave_map map_value(void) const
idx_vector index_vector(bool require_integers=false) const
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
octave_value resize(const dim_vector &dv, bool fill=false) const
FloatNDArray float_array_value(bool frc_str_conv=false) const
octave_int16 int16_scalar_value(void) const
Array< std::string > cellstr_value(void) const
int16NDArray int16_array_value(void) const
string_vector map_keys(void) const
octave_base_value * clone(void) const
Matrix matrix_value(bool frc_str_conv=false) const
FloatComplexMatrix float_complex_matrix_value(bool frc_str_conv=false) const
void print(std::ostream &os, bool pr_as_read_syntax=false)
octave_value diag(octave_idx_type k=0) const
double double_value(bool frc_str_conv=false) const
unsigned int uint_value(bool req_int=false, bool frc_str_conv=false) const
octave_value as_int8(void) const
dim_vector dims(void) const
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
octave_user_script * user_script_value(bool silent=false) const
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
F77_RET_T const F77_DBLE * x
F77_RET_T const F77_DBLE const F77_DBLE * f
static float_display_format get_edit_display_format(const octave_value &val)
type_info & __get_type_info__(const std::string &who)
std::complex< double > Complex
std::complex< float > FloatComplex
static double as_double(time_t sec, long usec)
bool btyp_isnumeric(builtin_type_t btyp)
bool btyp_isinteger(builtin_type_t btyp)
OCTINTERP_API builtin_type_t btyp_mixed_numeric(builtin_type_t x, builtin_type_t y)
Determine the resulting type for a possible mixed-type operation.
OCTINTERP_API bool called_from_builtin(void)
#define DEF_CLASS_TO_BTYP(CLASS, BTYP)
OCTINTERP_API std::string btyp_class_name[btyp_num_types]
#define DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA
bool btyp_isarray(builtin_type_t btyp)
bool btyp_isfloat(builtin_type_t btyp)
OCTINTERP_API octave_value make_idx_args(const std::string &type, const std::list< octave_value_list > &idx, const std::string &who)
OCTINTERP_API bool Vsparse_auto_mutate
static const builtin_type_t btyp