26 #if defined (HAVE_CONFIG_H)
80 catch (
const interrupt_exception&)
84 warning (
"interrupt occurred in handle class delete method");
90 std::string msg = ee.message ();
92 warning (
"error caught while executing handle class delete method:\n%s\n",
95 catch (
const exit_exception&)
98 warning (
"exit disabled while executing handle class delete method");
103 warning (
"internal error: unhandled exception in handle class delete method");
142 "struct: converting a classdef object into a struct "
143 "overrides the access restrictions defined for properties. "
144 "All properties are returned, including private and "
151 std::map<std::string, cdef_property> props;
156 for (
auto& prop_val : props)
165 cvalue (i) = prop_val.second.get_value (a_obj(i),
false);
167 retval.setfield (prop_val.first, cvalue);
172 prop_val.second.get_value (*
this,
false));
174 retval.setfield (prop_val.first, cvalue);
217 const std::list<octave_value_list>& idx,
241 for (
int i = 0; i < ival.
length (); i++)
245 iv(i) = ival(i).index_vector ();
280 if (
type.size () == 1 && idx.size () == 1)
306 error (
"can't perform indexing operation on array of %s objects",
316 const std::list<octave_value_list>& idx,
324 if (
type.length () == 1)
329 error (
"can't assign %s object into array of %s objects.",
337 for (
int i = 0; i < ival.
length (); i++)
341 iv(i) = ival(i).index_vector ();
357 rhs_mat(0) = rhs_obj;
380 ? ivl : ((
array.dims ()(0) == 1)
382 :
ovl (ivl(0), one));
388 for (
int i = 0; i < ival.
length (); i++)
392 iv(i) = ival(i).index_vector ();
404 error (
"subsasgn: invalid indexing for object array assignment"
405 ", the index must reference a single object in the "
412 error (
"subsasgn: invalid indexing for object array assignment");
416 int ignore_copies = 0;
430 std::list<octave_value_list> next_idx (idx);
432 next_idx.erase (next_idx.begin ());
442 error (
"subsasgn: invalid assignment into array of %s objects",
449 if (! robj.
is (a(0)))
456 array.assign (iv, rhs_a);
469 error (
"can't perform indexing operation on array of %s objects",
486 for (
int i = 0; i <
n; i++)
488 if (! arr.
xelem (i).ok ())
504 const std::list<octave_value_list>& idx,
505 int nargout,
size_t& skip,
521 std::string
name = (idx.front ())(0).string_value ();
527 int _nargout = (
type.length () > 2 ? 1 : nargout);
533 if (
type.length () > 1 &&
type[1] ==
'(')
535 auto it = idx.begin ();
557 error (
"subsref: unknown method or property: %s",
name.c_str ());
599 error (
"object cannot be indexed with '%c'",
type[0]);
608 const std::list<octave_value_list>& idx,
619 std::string
name = (idx.front ())(0).string_value ();
624 error (
"subsasgn: unknown property: %s",
name.c_str ());
627 error (
"subsasgn: cannot assign constant property: %s",
634 if (
type.length () == 1)
636 prop.
set_value (obj, rhs,
true,
"subsasgn");
644 std::list<octave_value_list> args (idx);
646 args.erase (args.begin ());
649 type.substr (1), args, rhs);
653 prop.
set_value (obj, val,
true,
"subsasgn");
679 error (
"subsasgn: object cannot be index with '%c'",
type[0]);
689 std::string cls_name = cls.
get_name ();
711 std::map<cdef_class, std::list<cdef_class>>::const_iterator it
714 if (it ==
ctor_list.end () || it->second.empty ())
717 for (
const auto& cdef_cls : it->second)
734 <<
" object (handle)" << std::endl;
742 <<
" object (value)" << std::endl;
bool is_scalar(const dim_vector &dim)
N Dimensional Array with copy-on-write semantics.
T & xelem(octave_idx_type n)
Size of the specified dimension.
octave_idx_type numel(void) const
Number of elements in the array.
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
Vector representing the dimensions (size) of an Array.
void delete_object(const cdef_object &obj)
cdef_method find_method(const std::string &nm, bool local=false)
cdef_property find_property(const std::string &nm)
string_vector get_names(void)
std::map< std::string, cdef_property > get_property_map(int mode=property_normal)
std::string get_name(void) const
cdef_object construct_object(const octave_value_list &args)
octave_value_list execute(const octave_value_list &args, int nargout, bool do_check_access=true, const std::string &who="")
bool is_static(void) const
octave_value_list subsref(const std::string &type, const std::list< octave_value_list > &idx, int nargout, size_t &skip, const cdef_class &context, bool auto_add)
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
void fill_empty_values(void)
Array< cdef_object > array
dim_vector dims(void) const
cdef_class get_class(void) const
cdef_object_rep * make_array(void) const
void set_class(const cdef_class &cls)
virtual octave_idx_type static_count(void) const
void release(const cdef_object &obj)
virtual void destroy(void)
refcount< octave_idx_type > m_count
virtual bool is_handle_object(void) const
OCTAVE_NORETURN void err_invalid_object(const char *who) const
std::string class_name(void) const
virtual cdef_class get_class(void) const
virtual string_vector map_keys(void) const
virtual bool is_meta_object(void) const
bool is_constructed_for(const cdef_class &cls) const
bool is_constructed(void) const
octave_value_list subsref(const std::string &type, const std::list< octave_value_list > &idx, int nargout, size_t &skip, const cdef_class &context, bool auto_add)
bool is_partially_constructed_for(const cdef_class &cls) const
void mark_for_construction(const cdef_class &)
std::map< cdef_class, std::list< cdef_class > > ctor_list
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
void mark_as_constructed(void)
octave_value_list subsref(const std::string &type, const std::list< octave_value_list > &idx, int nargout, size_t &skip, const cdef_class &context, bool auto_add=false)
bool is(const cdef_object &obj) const
void set_class(const cdef_class &cls)
std::string class_name(void) const
cdef_class get_class(void) const
octave_map map_value(void) const
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs, int ignore_copies=0)
Array< cdef_object > array_value(void) const
octave_value get(const std::string &pname) const
cdef_object copy(void) const
bool is_array(void) const
void set_value(cdef_object &obj, const octave_value &val, bool do_check_access=true, const std::string &who="")
octave_value get_value(const cdef_object &obj, bool do_check_access=true, const std::string &who="") const
bool is_constant(void) const
~handle_cdef_object(void)
void set_pos_if_unset(octave_idx_type nd_arg, octave_idx_type dim_arg)
void recover_from_exception(void)
octave_idx_type length(void) const
Cell cell_value(void) const
std::string class_name(void) const
octave_value & assign(assign_op op, const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
void warning(const char *fmt,...)
void interpreter_try(octave::unwind_protect &frame)
void warning_with_id(const char *id, const char *fmt,...)
void error(const char *fmt,...)
std::list< cdef_class > lookup_classes(const Cell &cls_list)
octave_value to_ov(const cdef_object &obj)
cdef_object to_cdef(const octave_value &val)
static llvm::LLVMContext & context
interpreter & __get_interpreter__(const std::string &who)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value::octave_value(const Array< char > &chm, char type) return retval
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
sig_atomic_t octave_interrupt_state