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");
116 err_invalid_object (
"get_class");
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);
198 || (m_klass.
ok () && ! cls.
ok ())
199 || (! m_klass.
ok () && cls.
ok ()))
217 const std::list<octave_value_list>& idx,
218 int , std::size_t& skip,
241 for (
int i = 0; i < ival.
length (); i++)
245 iv(i) = ival(i).index_vector ();
264 fill_empty_values (ires);
267 retval(0) =
to_ov (ires(0));
274 retval(0) =
to_ov (array_obj);
280 if (type.size () == 1 && idx.size () == 1)
287 std::size_t dummy_skip;
307 error (
"can't perform indexing operation on array of %s objects",
317 const std::list<octave_value_list>& idx,
325 if (type.length () == 1)
330 error (
"can't assign %s object into array of %s objects",
338 for (
int i = 0; i < ival.
length (); i++)
342 iv(i) = ival(i).index_vector ();
358 rhs_mat(0) = rhs_obj;
368 fill_empty_values ();
381 ? ivl : ((m_array.
dims ()(0) == 1)
383 :
ovl (ivl(0), one));
389 for (
int i = 0; i < ival.
length (); i++)
393 iv(i) = ival(i).index_vector ();
405 error (
"subsasgn: invalid indexing for object array assignment"
406 ", the index must reference a single object in the "
413 error (
"subsasgn: invalid indexing for object array assignment");
417 int ignore_copies = 0;
431 std::list<octave_value_list> next_idx (idx);
433 next_idx.erase (next_idx.begin ());
443 error (
"subsasgn: invalid assignment into array of %s objects",
450 if (! robj.
is (a(0)))
457 m_array.
assign (iv, rhs_a);
460 fill_empty_values ();
470 error (
"can't perform indexing operation on array of %s objects",
487 for (
int i = 0; i <
n; i++)
512 const std::list<octave_value_list>& idx,
513 int nargout, std::size_t& skip,
529 std::string name = (idx.front ())(0).string_value ();
535 int _nargout = (type.length () > 2 ? 1 : nargout);
541 if (type.length () > 1 && type[1] ==
'(')
543 auto it = idx.begin ();
551 retval = meth.
execute (args, _nargout,
true,
"subsref");
565 error (
"subsref: unknown method or property: %s", name.c_str ());
568 retval(0) = prop.
get_value (
true,
"subsref");
591 retval(0) =
to_ov (this_obj);
601 retval = new_obj.
subsref (type, idx, nargout, skip, cls, auto_add);
607 error (
"object cannot be indexed with '%c'", type[0]);
616 const std::list<octave_value_list>& idx,
627 std::string name = (idx.front ())(0).string_value ();
632 error (
"subsasgn: unknown property: %s", name.c_str ());
635 error (
"subsasgn: cannot assign constant property: %s",
642 if (type.length () == 1)
644 prop.
set_value (obj, rhs,
true,
"subsasgn");
646 retval =
to_ov (obj);
652 std::list<octave_value_list> args (idx);
654 args.erase (args.begin ());
657 type.substr (1), args, rhs);
661 prop.
set_value (obj, val,
true,
"subsasgn");
663 retval =
to_ov (obj);
687 error (
"subsasgn: object cannot be index with '%c'", type[0]);
697 std::string cls_name = cls.
get_name ();
719 std::map<cdef_class, std::list<cdef_class>>::const_iterator it
722 if (it ==
m_ctor_list.end () || it->second.empty ())
725 for (
const auto& cdef_cls : it->second)
742 <<
" object (handle)" << std::endl;
750 <<
" object (value)" << std::endl;
754 OCTAVE_END_NAMESPACE(
octave)
bool is_scalar(const dim_vector &dim)
cdef_object to_cdef(const octave_value &val)
std::list< cdef_class > lookup_classes(const Cell &cls_list)
octave_value to_ov(const cdef_object &obj)
Array< T, Alloc > index(const octave::idx_vector &i) const
Indexing without resizing.
void assign(const octave::idx_vector &i, const Array< T, Alloc > &rhs, const T &rfv)
Indexed assignment (always with resize & fill).
const dim_vector & dims() const
Return a const-reference so that dims ()(i) works efficiently.
T & xelem(octave_idx_type n)
Size of the specified dimension.
octave_idx_type numel() const
Number of elements in the array.
cdef_method find_method(const std::string &nm, bool local=false)
string_vector get_names()
std::map< std::string, cdef_property > get_property_map(int mode=property_normal)
std::string get_name() const
void delete_object(const cdef_object &obj)
cdef_property find_property(const std::string &nm)
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="")
octave_value_list subsref(const std::string &type, const std::list< octave_value_list > &idx, int nargout, std::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)
cdef_class get_class() const
void set_class(const cdef_class &cls)
cdef_object_rep * make_array() const
void release(const cdef_object &obj)
virtual string_vector map_keys() const
virtual bool is_meta_object() const
virtual bool is_handle_object() const
std::string class_name() const
virtual octave_idx_type static_count() const
virtual cdef_class get_class() const
refcount< octave_idx_type > m_count
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
std::map< cdef_class, std::list< cdef_class > > m_ctor_list
bool is_constructed() const
void mark_for_construction(const cdef_class &)
bool is_partially_constructed_for(const cdef_class &cls) const
void mark_as_constructed()
void break_closure_cycles(const std::shared_ptr< stack_frame > &frame)
bool is_constructed_for(const cdef_class &cls) const
octave_value_list subsref(const std::string &type, const std::list< octave_value_list > &idx, int nargout, std::size_t &skip, const cdef_class &context, bool auto_add)
cdef_class get_class() const
octave_map map_value() const
void set_class(const cdef_class &cls)
std::string class_name() 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() const
bool is(const cdef_object &obj) const
octave_value get(const std::string &pname) const
octave_value_list subsref(const std::string &type, const std::list< octave_value_list > &idx, int nargout, std::size_t &skip, const cdef_class &context, bool auto_add=false)
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
Vector representing the dimensions (size) of an Array.
void set_pos_if_unset(octave_idx_type nd_arg, octave_idx_type dim_arg)
void recover_from_exception()
void setfield(const std::string &key, const Cell &val)
const octave_value & contents(const_iterator p) const
octave_idx_type nfields() const
octave_idx_type length() const
std::string class_name() const
void break_closure_cycles(const std::shared_ptr< octave::stack_frame > &)
octave_value & assign(assign_op op, const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void warning(const char *fmt,...)
void warning_with_id(const char *id, const char *fmt,...)
void() error(const char *fmt,...)
void interpreter_try(octave::unwind_protect &)
interpreter & __get_interpreter__()
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
std::atomic< sig_atomic_t > octave_interrupt_state