GNU Octave 11.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
cdef-object.cc
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2012-2026 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if defined (HAVE_CONFIG_H)
27# include "config.h"
28#endif
29
30#include <memory>
31
32#include "cdef-class.h"
33#include "cdef-object.h"
34#include "cdef-property.h"
35#include "cdef-utils.h"
36#include "interpreter.h"
37#include "interpreter-private.h"
38#include "ov-classdef.h"
39
40#define OCTAVE_CDEF_OBJECT_DEBUG 0
41#if OCTAVE_CDEF_OBJECT_DEBUG
42# include <iostream>
43#endif
44
46
47void
49{
50 // We need to be careful to keep a reference to the object if we are
51 // calling the delete method. The object is passed to the delete
52 // method as an argument and if the count is already zero when we
53 // do that, then we will increment the count while creating the
54 // argument list for the delete method and then it will be decremented
55 // back to zero and we'll find ourselves in an infinite loop.
56
57 if (m_count - 1 > static_count ())
58 {
59 --m_count;
60 return;
61 }
62
63 if (is_handle_object () && ! is_meta_object ())
64 {
65 unwind_protect frame;
66
67 // Clear interrupts.
70
71 // Disallow quit().
73 quit_allowed = false;
74
76
77 interpreter_try (frame);
78
79 try
80 {
81 // Call classdef "delete()" method on object
82 get_class ().delete_object (obj);
83 }
84 catch (const interrupt_exception&)
85 {
86 interp.recover_from_exception ();
87
88 warning ("interrupt occurred in handle class delete method");
89 }
90 catch (const execution_exception& ee)
91 {
92 interp.recover_from_exception ();
93
94 std::string msg = ee.message ();
95
96 warning ("error caught while executing handle class delete method:\n%s\n",
97 msg.c_str ());
98 }
99 catch (const exit_exception&)
100 {
101 // This shouldn't happen since we disabled quit above.
102 warning ("exit disabled while executing handle class delete method");
103 }
104 catch (...) // Yes, the black hole. We're in a d-tor.
105 {
106 // This shouldn't happen, in theory.
107 warning ("internal error: unhandled exception in handle class delete method");
108 }
109 }
110
111 // Now it is safe to set the count to zero.
112 m_count--;
113
114 destroy ();
115}
116
119{
120 err_invalid_object ("get_class");
121}
122
123std::string
125{
126 return get_class ().get_name ();
127}
128
131{
132 cdef_class cls = get_class ();
133
134 if (cls.ok ())
135 return cls.get_names ();
136
137 return string_vector ();
138}
139
141cdef_object::map_value (bool warn, bool for_save) const
142{
143 octave_map retval;
144
145 if (warn)
146 warning_with_id ("Octave:classdef-to-struct",
147 "struct: converting a classdef object into a struct "
148 "overrides the access restrictions defined for "
149 "properties. All properties are returned, including "
150 "private and protected ones.");
151
152 cdef_class cls = get_class ();
153
154 if (cls.ok ())
155 {
156 std::map<property_key, cdef_property> props;
157
159
160 // FIXME: Why not const here?
161 for (auto& prop_val : props)
162 {
163 // Do not include properties that have the "Transient" attribute
164 // when creating the map for saving the object to a file.
165 if (for_save && prop_val.second.get ("Transient").bool_value ())
166 continue;
167
168 if (is_array ())
169 {
171
172 Cell cvalue (a_obj.dims ());
173
174 for (octave_idx_type i = 0; i < a_obj.numel (); i++)
175 cvalue (i) = prop_val.second.get_value (a_obj(i), false);
176
177 retval.setfield (prop_val.second.get_name (), cvalue);
178 }
179 else
180 {
181 Cell cvalue (dim_vector (1, 1),
182 prop_val.second.get_value (*this, false));
183
184 retval.setfield (prop_val.second.get_name (), cvalue);
185 }
186 }
187 }
188
189 return retval;
190}
191
194{
195 return m_rep->get_class ();
196}
197
200{
201 return cdef_class (m_klass);
202}
203
204void
206{
207 if ((m_klass.ok () && cls.ok () && cls != get_class ())
208 || (m_klass.ok () && ! cls.ok ())
209 || (! m_klass.ok () && cls.ok ()))
210 {
211 m_klass = cls;
212 }
213}
214
217{
219
220 r->set_class (get_class ());
221
222 return r;
223}
224
227{
228 Array<cdef_object> new_array (m_array.dims ());
229
230 for (octave_idx_type i = 0; i < m_array.numel (); i++)
231 new_array(i) = m_array(i).clone ();
232
233 cdef_object_array *retval = new cdef_object_array (new_array);
234 retval->set_class (get_class ());
235 return retval;
236}
237
239cdef_object_array::permute (const Array<int>& vec, bool inv) const
240{
241 Array<cdef_object> cpy_array = m_array.permute (vec, inv);
242
243 cdef_object_array *retval = new cdef_object_array (cpy_array);
244 retval->set_class (get_class ());
245 return retval;
246}
247
249cdef_object_array::resize (const dim_vector& dv, bool fill) const
250{
251 cdef_object_array *retval = dynamic_cast<cdef_object_array *> (clone ());
252 std::unique_ptr<cdef_object_array> guard (retval);
253
254 retval->m_array.resize (dv, cdef_object ());
255
256 if (fill)
257 retval->fill_empty_values ();
258
259 return guard.release ();
260}
261
264{
265 if (m_array.ndims () > 2)
266 error ("transpose not defined for N-D objects");
267
268 auto perm_vec = Array<int> (std::vector<int> {1, 0}, dim_vector (1, 2));
269 return permute (perm_vec);
270}
271
273cdef_object_array::subsref (const std::string& type,
274 const std::list<octave_value_list>& idx,
275 int /* nargout */, std::size_t& skip,
276 const cdef_class& /* context */, bool auto_add)
277{
278 octave_value_list retval;
279
280 skip = 1;
281
282 switch (type[0])
283 {
284 case '(':
285 {
286 const octave_value_list& ival = idx.front ();
287
288 if (ival.empty ())
289 {
290 m_count++;
291 retval(0) = to_ov (cdef_object (this));
292 break;
293 }
294
295 bool is_scalar = true;
296 Array<idx_vector> iv (dim_vector (1, ival.length ()));
297
298 for (int i = 0; i < ival.length (); i++)
299 {
300 try
301 {
302 iv(i) = ival(i).index_vector ();
303 }
304 catch (index_exception& ie)
305 {
306 // Rethrow to allow more info to be reported later.
307 ie.set_pos_if_unset (ival.length (), i+1);
308 throw;
309 }
310
311 is_scalar = is_scalar && iv(i).is_scalar ();
312 }
313
314 Array<cdef_object> ires = m_array.index (iv, auto_add);
315
316 // If resizing is enabled (auto_add = true), it's possible
317 // indexing was out-of-bound and the result array contains
318 // invalid cdef_objects.
319
320 if (auto_add)
321 fill_empty_values (ires);
322
323 if (is_scalar)
324 retval(0) = to_ov (ires(0));
325 else
326 {
327 cdef_object array_obj (new cdef_object_array (ires));
328
329 array_obj.set_class (get_class ());
330
331 retval(0) = to_ov (array_obj);
332 }
333 }
334 break;
335
336 case '.':
337 if (m_array.numel () == 1)
338 {
339 // If there is only one element in the array, implicitly index the
340 // first element. In this case, also allow indexing with more than
341 // one level.
342
343 // dummy variables
344 std::size_t dummy_skip;
345 cdef_class dummy_cls;
346 retval = m_array(0).subsref (type, idx, 1, dummy_skip, dummy_cls);
347
348 break;
349 }
350 else if (type.size () == 1 && idx.size () == 1)
351 {
352 Cell c (dims ());
353
354 octave_idx_type n = m_array.numel ();
355
356 // dummy variables
357 std::size_t dummy_skip;
358 cdef_class dummy_cls;
359
360 for (octave_idx_type i = 0; i < n; i++)
361 {
362 octave_value_list r = m_array(i).subsref (type, idx, 1,
363 dummy_skip,
364 dummy_cls);
365
366 if (r.length () > 0)
367 c(i) = r(0);
368 }
369
370 retval(0) = octave_value (c, true);
371
372 break;
373 }
374 OCTAVE_FALLTHROUGH;
375
376 default:
377 error ("can't perform indexing operation on array of %s objects",
378 class_name ().c_str ());
379 break;
380 }
381
382 return retval;
383}
384
386cdef_object_array::subsasgn (const std::string& type,
387 const std::list<octave_value_list>& idx,
388 const octave_value& rhs)
389{
390 octave_value retval;
391
392 switch (type[0])
393 {
394 case '(':
395 if (type.length () == 1)
396 {
397 const octave_value_list& ival = idx.front ();
398 bool is_scalar = true;
399 Array<idx_vector> iv (dim_vector (1, ival.length ()));
400
401 for (int i = 0; i < ival.length (); i++)
402 {
403 try
404 {
405 iv(i) = ival(i).index_vector ();
406 }
407 catch (index_exception& ie)
408 {
409 ie.set_pos_if_unset (ival.length (), i+1);
410 throw; // var name set in pt-idx.cc / pt-assign.cc
411 }
412
413 is_scalar = is_scalar && iv(i).is_scalar ();
414 }
415
416 if (rhs.isempty ())
417 m_array.delete_elements (iv);
418 else
419 {
420 cdef_object rhs_obj = to_cdef (rhs);
421
422 if (rhs_obj.get_class () != get_class ())
423 error ("can't assign %s object into array of %s objects",
424 rhs_obj.class_name ().c_str (),
425 class_name ().c_str ());
426
427 Array<cdef_object> rhs_mat;
428
429 if (! rhs_obj.is_array ())
430 {
431 rhs_mat = Array<cdef_object> (dim_vector (1, 1));
432 rhs_mat(0) = rhs_obj;
433 }
434 else
435 rhs_mat = rhs_obj.array_value ();
436
437 octave_idx_type n = m_array.numel ();
438
439 m_array.assign (iv, rhs_mat, cdef_object ());
440
441 if (m_array.numel () > n)
443 }
444
445 m_count++;
446 retval = to_ov (cdef_object (this));
447 }
448 else
449 {
450 const octave_value_list& ival = idx.front ();
451
452 bool is_scalar = true;
453
454 Array<idx_vector> iv (dim_vector (1, ival.length ()));
455
456 for (int i = 0; i < ival.length (); i++)
457 {
458 try
459 {
460 iv(i) = ival(i).index_vector ();
461 }
462 catch (index_exception& ie)
463 {
464 // Rethrow to allow more info to be reported later.
465 ie.set_pos_if_unset (ival.length (), i+1);
466 throw;
467 }
468
469 is_scalar = is_scalar && iv(i).is_scalar ();
470
471 if (! is_scalar)
472 error ("subsasgn: invalid indexing for object array assignment"
473 ", the index must reference a single object in the "
474 "array.");
475 }
476
477 Array<cdef_object> a = m_array.index (iv, true);
478
479 if (a.numel () != 1)
480 error ("subsasgn: invalid indexing for object array assignment");
481
482 cdef_object obj = a(0);
483
484 int ignore_copies = 0;
485
486 // If the object in 'a' is not valid, this means the index
487 // was out-of-bound and we need to create a new object.
488
489 if (! obj.ok ())
491 else
492 // Optimize the subsasgn call to come. There are 2 copies
493 // that we can safely ignore:
494 // - 1 in "array"
495 // - 1 in "a"
496 ignore_copies = 2;
497
498 std::list<octave_value_list> next_idx (std::next (idx.begin ()),
499 idx.end ());
500
501 octave_value tmp = obj.subsasgn (type.substr (1), next_idx,
502 rhs, ignore_copies);
503
504 cdef_object robj = to_cdef (tmp);
505
506 if (! robj.ok ()
507 || robj.is_array ()
508 || robj.get_class () != get_class ())
509 error ("subsasgn: invalid assignment into array of %s objects",
510 class_name ().c_str ());
511
512 // Small optimization, when dealing with handle
513 // objects, we don't need to re-assign the result
514 // of subsasgn back into the array.
515
516 if (! robj.is (a(0)))
517 {
518 Array<cdef_object> rhs_a (dim_vector (1, 1),
519 robj);
520
521 octave_idx_type n = m_array.numel ();
522
523 m_array.assign (iv, rhs_a);
524
525 if (m_array.numel () > n)
527 }
528
529 m_count++;
530
531 retval = to_ov (cdef_object (this));
532 }
533 break;
534
535 case '.':
536 if (m_array.numel () == 1)
537 {
538 // If there is only one element in the array, implicitly index the
539 // first element.
540
541 retval = m_array(0).subsasgn (type, idx, rhs);
542
543 break;
544 }
545 OCTAVE_FALLTHROUGH;
546
547 default:
548 error ("can't perform indexing operation on array of %s objects",
549 class_name ().c_str ());
550 break;
551 }
552
553 return retval;
554}
555
558{
559 cdef_object_array retval = cdef_object_array (*this);
560 retval.m_array = Array<cdef_object> (m_array, new_dims);
561 return to_ov (cdef_object (new cdef_object_array (retval)));
562}
563
564void
566{
567 cdef_class cls = get_class ();
568
569 cdef_object obj;
570
571 int n = arr.numel ();
572
573 for (int i = 0; i < n; i++)
574 {
575 if (! arr.xelem (i).ok ())
576 {
577 if (! obj.ok ())
578 {
579 obj = cls.construct_object (octave_value_list ());
580
581 arr.xelem (i) = obj;
582 }
583 else
584 arr.xelem (i) = obj.copy ();
585 }
586 }
587}
588
589void
590cdef_object_array::break_closure_cycles (const std::shared_ptr<stack_frame>& frame)
591{
592 for (octave_idx_type i = 0; i < m_array.numel (); i++)
593 m_array(i).break_closure_cycles (frame);
594}
595
596void
597cdef_object_scalar::break_closure_cycles (const std::shared_ptr<stack_frame>& frame)
598{
599 for (octave_idx_type i = 0; i < m_map.nfields (); i++)
601}
602
604cdef_object_scalar::subsref (const std::string& type,
605 const std::list<octave_value_list>& idx,
606 int nargout, std::size_t& skip,
607 const cdef_class& context, bool auto_add)
608{
609 skip = 0;
610
611 cdef_class cls = (context.ok () ? context : get_class ());
612
613 octave_value_list retval;
614
615 if (! cls.ok ())
616 return retval;
617
618 switch (type[0])
619 {
620 case '.':
621 {
622 std::string name = (idx.front ())(0).string_value ();
623
624 cdef_property prop = cls.find_property (name);
625
626 if (prop.ok ())
627 {
628 if (prop.is_constant ())
629 retval(0) = prop.get_value (true, "subsref");
630 else
631 {
632 m_count++;
633 retval(0) = prop.get_value (cdef_object (this),
634 true, "subsref");
635 }
636
637 skip = 1;
638 }
639
640 if (skip == 0)
641 {
642 cdef_method meth = cls.find_method (name);
643
644 if (! meth.ok ())
645 error ("subsref: unknown method or property: %s", name.c_str ());
646
647 // If the method call is followed by another index operation,
648 // the number of outputs of the call will be 1.
649 int nargout_mtd = (type.length () > 2
650 || (type.length () == 2 && type[1] != '(')
651 ? 1 : nargout);
652
654
655 skip = 1;
656
657 if (type.length () > 1 && type[1] == '(')
658 {
659 auto it = idx.begin ();
660
661 args = *++it;
662
663 skip++;
664 }
665
666 if (meth.is_static ())
667 retval = meth.execute (args, nargout_mtd, true, "subsref");
668 else
669 {
670 m_count++;
671 retval = meth.execute (cdef_object (this), args, nargout_mtd,
672 true, "subsref");
673 }
674 }
675
676 break;
677 }
678
679 case '(':
680 {
681 const octave_value_list& ival = idx.front ();
682
683 m_count++;
684 cdef_object this_obj (this);
685
686 if (ival.empty ())
687 {
688 skip++;
689 retval(0) = to_ov (this_obj);
690 }
691 else
692 {
693 Array<cdef_object> arr (dim_vector (1, 1), this_obj);
694
695 cdef_object new_obj = cdef_object (new cdef_object_array (arr));
696
697 new_obj.set_class (get_class ());
698
699 retval = new_obj.subsref (type, idx, nargout, skip, cls, auto_add);
700 }
701 }
702 break;
703
704 default:
705 error ("object cannot be indexed with '%c'", type[0]);
706 break;
707 }
708
709 return retval;
710}
711
713cdef_object_scalar::subsasgn (const std::string& type,
714 const std::list<octave_value_list>& idx,
715 const octave_value& rhs)
716{
717 octave_value retval;
718
719 cdef_class cls = get_class ();
720
721 switch (type[0])
722 {
723 case '.':
724 {
725 std::string name = (idx.front ())(0).string_value ();
726
727 cdef_property prop = cls.find_property (name);
728
729 if (! prop.ok ())
730 error ("subsasgn: unknown property: %s", name.c_str ());
731
732 if (prop.is_constant ())
733 error ("subsasgn: cannot assign constant property: %s",
734 name.c_str ());
735
736 m_count++;
737
738 cdef_object obj (this);
739
740 if (type.length () == 1)
741 {
742 prop.set_value (obj, rhs, true, "subsasgn");
743
744 retval = to_ov (obj);
745 }
746 else
747 {
748 octave_value val = prop.get_value (obj, true, "subsasgn");
749
750 std::list<octave_value_list> args (std::next (idx.begin ()),
751 idx.end ());
752
754 type.substr (1), args, rhs);
755
756 if (val.class_name () != "object"
757 || ! to_cdef (val).is_handle_object ())
758 prop.set_value (obj, val, true, "subsasgn");
759
760 retval = to_ov (obj);
761 }
762 }
763 break;
764
765 case '(':
766 {
767 m_count++;
768
769 cdef_object this_obj (this);
770
771 Array<cdef_object> arr (dim_vector (1, 1), this_obj);
772
773 cdef_object new_obj = cdef_object (new cdef_object_array (arr));
774
775 new_obj.set_class (get_class ());
776
777 octave_value tmp = new_obj.subsasgn (type, idx, rhs);
778
779 retval = tmp;
780 }
781 break;
782
783 default:
784 error ("subsasgn: object cannot be index with '%c'", type[0]);
785 break;
786 }
787
788 return retval;
789}
790
793{
794 if (new_dims.numel () != 1)
795 {
796 std::string new_dims_str = new_dims.str ();
797 error ("reshape: cannot reshape scalar classdef object to %s array",
798 new_dims_str.c_str ());
799 }
800
801 return to_ov (cdef_object (clone()));
802}
803
805cdef_object_scalar::resize (const dim_vector& dv, bool fill) const
806{
807 if (dv.numel () == 1)
808 return clone ();
809
810 Array<cdef_object> arr (dv);
811
812 // Need to guard against this statement being called when an empty array
813 // is generated
814 if (dv.numel () > 0)
815 arr(0) = cdef_object (const_cast<cdef_object_scalar *> (this)->clone ());
816
817 cdef_object_array *retval = new cdef_object_array (arr);
818 std::unique_ptr<cdef_object_array> guard (retval);
819
820 retval->set_class (get_class ());
821
822 if (fill)
823 retval->fill_empty_values ();
824
825 return guard.release ();
826}
827
828void
830{
831 std::string cls_name = cls.get_name ();
832
833 Cell supcls = cls.get ("SuperClasses").cell_value ();
834
835 std::list<cdef_class> supcls_list = lookup_classes (supcls);
836
837 m_ctor_list[cls] = supcls_list;
838}
839
840bool
842{
843 return (is_constructed ()
844 || m_ctor_list.find (cls) == m_ctor_list.end ());
845}
846
847bool
849{
850 if (is_constructed ())
851 return true;
852
853 std::map<cdef_class, std::list<cdef_class>>::const_iterator it
854 = m_ctor_list.find (cls);
855
856 if (it == m_ctor_list.end () || it->second.empty ())
857 return true;
858
859 for (const auto& cdef_cls : it->second)
860 if (! is_partially_constructed_for (cdef_cls))
861 return false;
862
863 return true;
864}
865
866void
868{
869 m_ctor_list.erase (cls);
870}
871
873{
874#if OCTAVE_CDEF_OBJECT_DEBUG
875 std::cerr << "deleting " << get_class ().get_name ()
876 << " object (handle)" << std::endl;
877#endif
878}
879
881{
882#if OCTAVE_CDEF_OBJECT_DEBUG
883 std::cerr << "deleting " << get_class ().get_name ()
884 << " object (value)" << std::endl;
885#endif
886}
887
888OCTAVE_END_NAMESPACE(octave)
bool is_scalar(const dim_vector &dim)
cdef_object to_cdef(const octave_value &val)
octave_value to_ov(const cdef_object &obj)
std::list< cdef_class > lookup_classes(const Cell &cls_list)
N Dimensional Array with copy-on-write semantics.
Definition Array-base.h:130
const dim_vector & dims() const
Return a const-reference so that dims ()(i) works efficiently.
Definition Array-base.h:529
T & xelem(octave_idx_type n)
Size of the specified dimension.
Definition Array-base.h:547
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).
int ndims() const
Size of the specified dimension.
Definition Array-base.h:701
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
void delete_elements(const octave::idx_vector &i)
Deleting elements.
Array< T, Alloc > permute(const Array< octave_idx_type > &vec, bool inv=false) const
Size of the specified dimension.
octave_idx_type numel() const
Number of elements in the array.
Definition Array-base.h:440
Definition Cell.h:41
void protect_var(T &var)
cdef_method find_method(const std::string &nm, bool local=false)
Definition cdef-class.h:473
string_vector get_names()
Definition cdef-class.h:316
cdef_object construct_object(const octave_value_list &args, const bool default_initialize=false)
Definition cdef-class.h:388
std::map< property_key, cdef_property > get_property_map(int mode=property_normal)
Definition cdef-class.h:311
std::string get_name() const
Definition cdef-class.h:332
void delete_object(const cdef_object &obj)
Definition cdef-class.h:336
cdef_property find_property(const std::string &nm)
Definition cdef-class.h:479
octave_value_list execute(const octave_value_list &args, int nargout, bool do_check_access=true, const std::string &who="")
bool is_static() const
cdef_object_rep * transpose() const
cdef_object_rep * permute(const Array< int > &vec, bool inv=false) const
octave_value reshape(const dim_vector &new_dims) const
cdef_object_rep * clone() const
dim_vector dims() const
void break_closure_cycles(const std::shared_ptr< stack_frame > &frame)
cdef_object_rep * resize(const dim_vector &dv, bool fill=false) 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)
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 cdef_object_rep * clone() const
Definition cdef-object.h:67
virtual void set_class(const cdef_class &)
Definition cdef-object.h:62
virtual string_vector map_keys() const
virtual bool is_meta_object() const
Definition cdef-object.h:93
virtual void destroy()
virtual bool is_handle_object() const
Definition cdef-object.h:91
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_scalar_map m_map
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 &)
cdef_object_rep * resize(const dim_vector &dv, bool fill=false) const
bool is_partially_constructed_for(const cdef_class &cls) const
void break_closure_cycles(const std::shared_ptr< stack_frame > &frame)
octave_value reshape(const dim_vector &new_dims) const
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)
bool is_array() const
cdef_class get_class() const
bool ok() const
void set_class(const cdef_class &cls)
std::string class_name() const
octave_map map_value(bool warn=true, bool for_save=false) const
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs, int ignore_copies=0)
cdef_object copy() 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)
Array< cdef_object > array_value() const
void set_value(cdef_object &obj, const octave_value &val, bool do_check_access=true, const std::string &who="")
bool is_constant() const
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.
Definition dim-vector.h:92
std::string str(char sep='x') const
Definition dim-vector.cc:58
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
Definition dim-vector.h:341
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)
Definition oct-map.cc:282
const octave_value & contents(const_iterator p) const
Definition oct-map.h:197
octave_idx_type nfields() const
Definition oct-map.h:210
bool empty() const
Definition ovl.h:113
octave_idx_type length() const
Definition ovl.h:111
std::string class_name() const
Definition ov.h:1360
Cell cell_value() const
bool isempty() const
Definition ov.h:599
void break_closure_cycles(const std::shared_ptr< octave::stack_frame > &)
@ op_asn_eq
Definition ov.h:135
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 interpreter_try(unwind_protect &frame)
Definition error.cc:2311
void warning(const char *fmt,...)
Definition error.cc:1083
void warning_with_id(const char *id, const char *fmt,...)
Definition error.cc:1098
void error(const char *fmt,...)
Definition error.cc:1008
interpreter & __get_interpreter__()
bool quit_allowed
std::atomic< int > octave_interrupt_state
Definition quit.cc:39