GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
ov-classdef.cc
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2012-2025 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 <algorithm>
31#include <iomanip>
32
33#include "cdef-class.h"
34#include "cdef-method.h"
35#include "cdef-package.h"
36#include "cdef-property.h"
37#include "cdef-utils.h"
38#include "defun.h"
39#include "errwarn.h"
40#include "interpreter-private.h"
41#include "load-path.h"
42#include "ov-classdef.h"
43#include "ov-fcn-handle.h"
44#include "ov-typeinfo.h"
45#include "ov-usr-fcn.h"
46#include "parse.h"
47#include "pr-output.h"
48#include "pt-eval.h"
49#include "pt-misc.h"
50#include "oct-lvalue.h"
51
52static bool
53in_class_method (const octave::cdef_class& cls)
54{
55 octave::cdef_class ctx = octave::get_class_context ();
56
57 return (ctx.ok () && octave::is_superclass (ctx, cls));
58}
59
60int octave_classdef::s_t_id (-1);
61
62const std::string octave_classdef::s_t_name ("object");
63
64void
65octave_classdef::register_type (octave::type_info& ti)
66{
67 s_t_id = ti.register_type (octave_classdef::s_t_name, "<unknown>",
69}
70
72octave_classdef::subsref (const std::string& type,
73 const std::list<octave_value_list>& idx,
74 int nargout)
75{
76 std::size_t skip = 0;
77 octave_value_list retval;
78
79 octave::cdef_class cls = m_object.get_class ();
80
81 if (! in_class_method (cls) && ! called_from_builtin ())
82 {
83 octave::cdef_method meth = cls.find_method ("subsref");
84
85 if (meth.ok ())
86 {
88
89 args(1) = make_idx_args (type, idx, "subsref");
90
91 m_count++;
92 args(0) = octave_value (this);
93
94 octave::cdef_method meth_nargout
95 = cls.find_method ("numArgumentsFromSubscript");
96 if (meth_nargout.ok ())
97 {
98 octave_value_list args_nargout (3);
99
100 args_nargout(0) = args(0);
101 args_nargout(1) = args(1);
102 // FIXME: Third argument should be one of the possible values of
103 // the matlab.mixin.util.IndexingContext enumeration class.
104 args_nargout(2) = octave_value (Matrix ());
105 retval = meth_nargout.execute (args_nargout, 1, true,
106 "numArgumentsFromSubscript");
107
108 nargout = retval(0).strict_int_value
109 ("subsref: return value of 'numArgumentsFromSubscript' must be integer");
110 }
111 else if (nargout <= 0)
112 {
113 // If the number of output arguments is unknown, attempt to set up
114 // a proper value for nargout at least in the simple case where the
115 // cs-list-type expression - i.e., {} or ().x, is the leading one.
116 bool maybe_cs_list_query = (type[0] == '.' || type[0] == '{'
117 || (type.length () > 1 && type[0] == '('
118 && type[1] == '.'));
119
120 if (maybe_cs_list_query)
121 {
122 // Set up a proper nargout for the subsref call by calling numel.
124 int nout;
125 if (type[0] != '.')
126 tmp = idx.front ();
127
128 nout = xnumel (tmp);
129 // Take nout as nargout for subsref, unless the index expression
130 // is a whole sentence starting with the form id.member and id is
131 // one element (in that case, nargout remains 0).
132 if (type[0] != '.' || nout != 1 || nargout < 0)
133 nargout = nout;
134 }
135 else if (nargout < 0)
136 nargout = 1;
137 }
138
139 retval = meth.execute (args, nargout, true, "subsref");
140
141 // Since we're handling subsref, if the list has more than one element
142 // and the caller to subsref accepts more that one output, return
143 // the elements as a comma-separated list so that we can pass it to the
144 // evaluator
145 if (retval.length () > 1 && (nargout < 0 || nargout > 1))
146 {
147 if (nargout <= 0 || nargout >= retval.length ())
148 // Take the whole list
149 retval = octave_value (retval);
150 else
151 // Take nargout elements of the list
152 retval = octave_value (retval.slice (0, nargout));
153 }
154
155 return retval;
156 }
157 }
158
159 // At this point, the default subsref mechanism must be used.
160
161 retval = m_object.subsref (type, idx, nargout, skip, octave::cdef_class ());
162
163 if (type.length () > skip && idx.size () > skip)
164 retval = retval(0).next_subsref (nargout, type, idx, skip);
165
166 return retval;
167}
168
170octave_classdef::subsref (const std::string& type,
171 const std::list<octave_value_list>& idx,
172 bool auto_add)
173{
174 std::size_t skip = 0;
175 octave_value_list retval;
176
177 // This variant of subsref is used to create temporary values when doing
178 // assignment with multi-level indexing. AFAIK this is only used for internal
179 // purpose (not sure we should even implement this).
180
181 octave::cdef_class cls = m_object.get_class ();
182
183 if (! in_class_method (cls))
184 {
185 octave::cdef_method meth = cls.find_method ("subsref");
186
187 if (meth.ok ())
188 {
190
191 args(1) = make_idx_args (type, idx, "subsref");
192
193 m_count++;
194 args(0) = octave_value (this);
195
196 retval = meth.execute (args, 1, true, "subsref");
197
198 return retval.length () > 0 ? retval(0) : octave_value ();
199 }
200 }
201
202 retval = m_object.subsref (type, idx, 1, skip,
203 octave::cdef_class (), auto_add);
204
205 if (type.length () > skip && idx.size () > skip)
206 retval = retval(0).next_subsref (1, type, idx, skip);
207
208 return retval.length () > 0 ? retval(0) : octave_value ();
209}
210
212octave_classdef::subsasgn (const std::string& type,
213 const std::list<octave_value_list>& idx,
214 const octave_value& rhs)
215{
216 octave_value retval;
217
218 octave::cdef_class cls = m_object.get_class ();
219
220 if (! in_class_method (cls) && ! called_from_builtin ())
221 {
222 octave::cdef_method meth = cls.find_method ("subsasgn");
223
224 if (meth.ok ())
225 {
227
228 args(1) = make_idx_args (type, idx, "subsasgn");
229
230 m_count++;
231 args(0) = octave_value (this);
232 args(2) = rhs;
233
234 octave_value_list retlist;
235
236 retlist = meth.execute (args, 1, true, "subsasgn");
237
238 if (retlist.empty ())
239 error ("overloaded method 'subsasgn' did not return any value");
240
241 retval = retlist(0);
242 }
243 }
244
245 if (! retval.is_defined ())
246 retval = m_object.subsasgn (type, idx, rhs);
247
248 return retval;
249}
250
252octave_classdef::undef_subsasgn (const std::string& type,
253 const std::list<octave_value_list>& idx,
254 const octave_value& rhs)
255{
256 if (type.length () == 1 && type[0] == '(')
257 {
258 m_object = m_object.make_array ();
259
260 return subsasgn (type, idx, rhs);
261 }
262 else
263 return octave_base_value::undef_subsasgn (type, idx, rhs);
264
265 return octave_value ();
266}
267
268Matrix
270{
271 octave::cdef_class cls = m_object.get_class ();
272
273 if (! in_class_method (cls) && ! called_from_builtin ())
274 {
275 octave::cdef_method meth = cls.find_method ("size");
276
277 if (meth.ok ())
278 {
279 m_count++;
280 octave_value_list args (1, octave_value (this));
281
282 octave_value_list lv = meth.execute (args, 1, true, "size");
283 if (lv.length () <= 0
284 || ! lv(0).is_matrix_type () || ! lv(0).dims ().isvector ())
285 error ("%s.size: invalid return value", class_name ().c_str ());
286
287 return lv(0).matrix_value ();
288 }
289 }
290
291 return octave_base_value::size ();
292}
293
296{
297 octave_idx_type retval = -1;
298
299 octave::cdef_class cls = m_object.get_class ();
300
301 if (! in_class_method (cls) && ! called_from_builtin ())
302 {
303 octave::cdef_method meth = cls.find_method ("numel");
304
305 if (meth.ok ())
306 {
307 octave_value_list args (idx.length () + 1, octave_value ());
308
309 m_count++;
310 args(0) = octave_value (this);
311
312 for (octave_idx_type i = 0; i < idx.length (); i++)
313 args(i+1) = idx(i);
314
315 // Temporarily set lvalue list of current statement to NULL, to avoid
316 // using that list for the execution of the method "numel"
317 octave::interpreter& interp = octave::__get_interpreter__ ();
318 octave::tree_evaluator& tw = interp.get_evaluator();
319
320 octave::unwind_action act ([&tw] (const std::list<octave::octave_lvalue> *lvl)
321 {
322 tw.set_lvalue_list (lvl);
323 }, tw.lvalue_list ());
324 tw.set_lvalue_list (nullptr);
325
326 octave_value_list lv = meth.execute (args, 1, true, "numel");
327 if (lv.length () != 1 || ! lv(0).is_scalar_type ())
328 error ("@%s/numel: invalid return value", cls.get_name ().c_str ());
329
330 retval = lv(0).idx_type_value (true);
331
332 return retval;
333 }
334 }
335
336 retval = octave_base_value::xnumel (idx);
337
338 return retval;
339}
340
341void
342octave_classdef::print (std::ostream& os, bool)
343{
344 print_raw (os);
345}
346
347void
348octave_classdef::print_raw (std::ostream& os, bool) const
349{
350 octave::cdef_class cls = m_object.get_class ();
351
352 if (cls.ok ())
353 {
354 bool is_array = m_object.is_array ();
355
357
358 indent (os);
359 os << class_name () << " object";
360 if (is_array)
361 os << " array";
362 os << " with properties:";
363 newline (os);
364 if (! Vcompact_format)
365 newline (os);
366
368
369 std::map<octave::property_key, octave::cdef_property> property_map
370 = cls.get_property_map ();
371
372 std::size_t max_len = 0;
373 for (const auto& pname_prop : property_map)
374 {
375 // FIXME: this loop duplicates a significant portion of the
376 // loop below and the loop in Fproperties.
377
378 const octave::cdef_property& prop = pname_prop.second;
379
380 const std::string nm = prop.get_name ();
381
382 octave_value acc = prop.get ("GetAccess");
383
384 if (! acc.is_string () || acc.string_value () != "public")
385 continue;
386
387 octave_value hid = prop.get ("Hidden");
388
389 if (hid.bool_value ())
390 continue;
391
392 std::size_t sz = nm.size ();
393
394 if (sz > max_len)
395 max_len = sz;
396 }
397
398 for (auto& pname_prop : property_map)
399 {
400 const octave::cdef_property& prop = pname_prop.second;
401
402 const std::string nm = prop.get_name ();
403
404 octave_value acc = prop.get ("GetAccess");
405
406 if (! acc.is_string () || acc.string_value () != "public")
407 continue;
408
409 octave_value hid = prop.get ("Hidden");
410
411 if (hid.bool_value ())
412 continue;
413
414 indent (os);
415
416 if (is_array)
417 os << " " << nm;
418 else
419 {
420 os << std::setw (max_len+2) << nm << ": ";
421
422 octave_value val = prop.get_value (m_object, false);
423
424 val.short_disp (os);
425 }
426
427 newline (os);
428 }
429
432 }
433}
434
435bool
436octave_classdef::is_instance_of (const std::string& cls_name) const
437{
438 octave::cdef_class cls = octave::lookup_class (cls_name, false, false);
439
440 if (cls.ok ())
441 return is_superclass (cls, m_object.get_class ());
442
443 return false;
444}
445
447octave_classdef::superclass_ref (const std::string& meth,
448 const std::string& cls)
449{
450 return octave_value (new octave_classdef_superclass_ref (meth, cls));
451}
452
454octave_classdef::metaclass_query (const std::string& cls)
455{
456 return octave::to_ov (octave::lookup_class (cls));
457}
458
459bool
460octave_classdef_meta::is_classdef_method (const std::string& cname) const
461{
462 bool retval = false;
463
464 if (m_object.is_method ())
465 {
466 if (cname.empty ())
467 retval = true;
468 else
469 {
470 octave::cdef_method meth (m_object);
471
472 return meth.is_defined_in_class (cname);
473 }
474 }
475
476 return retval;
477}
478
479bool
480octave_classdef_meta::is_classdef_constructor (const std::string& cname) const
481{
482 bool retval = false;
483
484 if (m_object.is_class ())
485 {
486 if (cname.empty ())
487 retval = true;
488 else
489 {
490 octave::cdef_class cls (m_object);
491
492 if (cls.get_name () == cname)
493 retval = true;
494 }
495 }
496 else if (m_object.is_method ())
497 {
498 octave::cdef_method meth (m_object);
499
500 if (meth.is_constructor ())
501 {
502 std::string meth_name = meth.get_name ();
503
504 // Only consider METH to be a constructor if the dispatch
505 // class CNAME is the same as or derived from the class of
506 // METH.
507
508 if (cname == meth_name)
509 retval = true;
510 else
511 {
512 octave::cdef_class meth_cls = octave::lookup_class (meth_name, false, false);
513 octave::cdef_class dispatch_cls = octave::lookup_class (cname, false, false);
514
515 retval = octave::is_superclass (meth_cls, dispatch_cls);
516 }
517 }
518 }
519
520 return retval;
521}
522
523std::string
524octave_classdef_meta::doc_string (const std::string& meth_name) const
525{
526 if (m_object.is_class ())
527 {
528 octave::cdef_class cls (m_object);
529
530 if (meth_name.empty ())
531 return cls.doc_string ();
532
533 octave::cdef_method cdef_meth = cls.find_method (meth_name);
534
535 if (cdef_meth.ok ())
536 return cdef_meth.get_doc_string ();
537 }
538
539 return "";
540}
541
542std::string
544{
545 if (m_object.is_class ())
546 {
547 octave::cdef_class cls (m_object);
548
549 return cls.file_name ();
550 }
551
552 return "";
553}
554
556octave_classdef_superclass_ref::execute (octave::tree_evaluator& tw,
557 int nargout,
558 const octave_value_list& idx)
559{
560 octave_value_list retval;
561
562 std::string meth_name;
563 bool in_constructor;
564 octave::cdef_class ctx;
565
566 ctx = octave::get_class_context (meth_name, in_constructor);
567
568 if (! ctx.ok ())
569 error ("superclass calls can only occur in methods or constructors");
570
571 std::string mname = m_method_name;
572 std::string cname = m_class_name;
573
574 // CLS is the superclass. The lookup_class function handles
575 // pkg.class names.
576
577 octave::cdef_class cls = octave::lookup_class (cname);
578
579 if (in_constructor)
580 {
581 if (! is_direct_superclass (cls, ctx))
582 error ("'%s' is not a direct superclass of '%s'",
583 cname.c_str (), ctx.get_name ().c_str ());
584
585 if (! is_constructed_object (tw, mname))
586 error ("cannot call superclass constructor with variable '%s'",
587 mname.c_str ());
588
589 octave_value sym = tw.varval (mname);
590
591 cls.run_constructor (octave::to_cdef_ref (sym), idx);
592
593 retval(0) = sym;
594 }
595 else
596 {
597 std::size_t pos = mname.find ('.');
598
599 octave::cdef_object obj;
600
601 if (pos != std::string::npos)
602 {
603 // We are looking at obj.meth.
604
605 std::string oname = m_method_name.substr (0, pos);
606 mname = mname.substr (pos + 1);
607
608 octave_value tval = tw.varval (oname);
609
610 // FIXME: Can we only call superclass methods on the current
611 // object? If so, and we are looking at something like
612 //
613 // function meth (obj, ...)
614 // obj.meth@superclass (...)
615 //
616 // Do we need to verify that the object that was passed to
617 // meth is the same as the object we find when looking up
618 // obj in the expression obj.meth? If so, what is the right
619 // way to perform that check?
620
621 if (tval.is_classdef_object ())
622 {
623 octave_classdef *cdobj = tval.classdef_object_value ();
624
625 obj = cdobj->get_object ();
626 }
627 }
628
629 if (mname != meth_name)
630 error ("method name mismatch ('%s' != '%s')",
631 mname.c_str (), meth_name.c_str ());
632
633 if (! is_strict_superclass (cls, ctx))
634 error ("'%s' is not a superclass of '%s'",
635 cname.c_str (), ctx.get_name ().c_str ());
636
637 // I see 2 possible implementations here:
638 // 1) use cdef_object::subsref with a different class
639 // context; this avoids duplicating code, but
640 // assumes the object is always the first argument
641 // 2) lookup the method manually and call
642 // cdef_method::execute; this duplicates part of
643 // logic in cdef_object::subsref, but avoid the
644 // assumption of 1)
645 // Not being sure about the assumption of 1), I
646 // go with option 2) for the time being.
647
648 octave::cdef_method meth = cls.find_method (meth_name, false);
649
650 if (! meth.ok ())
651 error ("no method '%s' found in superclass '%s'",
652 meth_name.c_str (), cname.c_str ());
653
654 retval = (obj.ok ()
655 ? meth.execute (obj, idx, nargout, true, meth_name)
656 : meth.execute (idx, nargout, true, meth_name));
657 }
658
659 return retval;
660}
661
662bool
663octave_classdef_superclass_ref::is_constructed_object (octave::tree_evaluator& tw,
664 const std::string& nm)
665{
666 octave_function *of = tw.current_function ();
667
668 if (of->is_classdef_constructor ())
669 {
671
672 if (uf)
673 {
674 octave::tree_parameter_list *ret_list = uf->return_list ();
675
676 if (ret_list && ret_list->size () == 1)
677 return (ret_list->front ()->name () == nm);
678 }
679 }
680
681 return false;
682}
683
685
686DEFUN (__meta_get_package__, args, ,
687 doc: /* -*- texinfo -*-
688@deftypefn {} {@var{pkg} =} __meta_get_package__ (@var{pkg_name})
689Undocumented internal function.
690@end deftypefn */)
691{
692 if (args.length () != 1)
693 print_usage ();
694
695 std::string cname = args(0).xstring_value ("PKG_NAME must be a string");
696
697 return to_ov (lookup_package (cname));
698}
699
700DEFUN (metaclass, args, ,
701 doc: /* -*- texinfo -*-
702@deftypefn {} {@var{metaclass_obj} =} metaclass (obj)
703Return the meta.class object corresponding to the class of @var{obj}.
704@end deftypefn */)
705{
706 if (args.length () != 1)
707 print_usage ();
708
709 cdef_object obj = to_cdef (args(0));
710
711 return to_ov (obj.get_class ());
712}
713
714// FIXME: What about dynamic properties if obj is a scalar, or the
715// properties of the class of obj if obj is an array? Probably there
716// should be a function to do this job so that the DEFUN is just a
717// simple wrapper.
718
719DEFUN (properties, args, nargout,
720 doc: /* -*- texinfo -*-
721@deftypefn {} {} properties (@var{obj})
722@deftypefnx {} {} properties (@var{class_name})
723@deftypefnx {} {@var{proplist} =} properties (@dots{})
724Display or return the public properties for the classdef object @var{obj} or
725the named class @var{class_name}.
726
727If an output value is requested, return the list of property names in a cell
728array.
729
730Programming Note: Property names are returned if the @code{GetAccess} attribute
731is public and if the @code{Hidden} attribute is false.
732@seealso{methods}
733@end deftypefn */)
734{
735 if (args.length () != 1)
736 print_usage ();
737
738 octave_value arg = args(0);
739
740 std::string class_name;
741
742 if (arg.isobject ())
743 class_name = arg.class_name ();
744 else if (arg.is_string ())
745 class_name = arg.string_value ();
746 else
747 err_wrong_type_arg ("properties", arg);
748
749 cdef_class cls;
750
751 cls = lookup_class (class_name, false, true);
752
753 if (! cls.ok ())
754 error ("invalid class: %s", class_name.c_str ());
755
756 std::map<octave::property_key, cdef_property> property_map =
757 cls.get_property_map ();
758
759 std::list<std::string> property_names;
760
761 for (const auto& pname_prop : property_map)
762 {
763 // FIXME: this loop duplicates a significant portion of the loops
764 // in octave_classdef::print_raw.
765 const cdef_property& prop = pname_prop.second;
766
767 octave_value acc = prop.get ("GetAccess");
768
769 if (! acc.is_string () || acc.string_value () != "public")
770 continue;
771
772 octave_value hid = prop.get ("Hidden");
773
774 if (hid.bool_value ())
775 continue;
776
777 property_names.push_back (pname_prop.second.get_name ());
778 }
779
780 if (nargout > 0)
781 return octave_value (Cell (string_vector (property_names)));
782
783 octave_stdout << "properties for class " << class_name << ":\n\n";
784
785 for (const auto& nm : property_names)
786 octave_stdout << " " << nm << "\n";
787
788 octave_stdout << std::endl;
789
790 return octave_value ();
791}
792
793/*
794%!assert (properties ("inputParser"),
795%! {"CaseSensitive"; "FunctionName"; "KeepUnmatched"; "PartialMatching";
796%! "StructExpand"; "Parameters"; "Results"; "Unmatched";
797%! "UsingDefaults"});
798*/
799
800// FIXME: Need to implement the -full option.
801
802DEFMETHOD (__methods__, interp, args, ,
803 doc: /* -*- texinfo -*-
804@deftypefn {} {[@var{mtds}, @var{found}] =} __methods__ (@var{obj})
805@deftypefnx {} {[@var{mtds}, @var{found}] =} __methods__ ("classname")
806Implement @code{methods} for Octave class objects and classnames.
807@seealso{methods}
808@end deftypefn */)
809{
810 // Input validation has already been done in methods.m.
811 octave_value arg = args(0);
812
813 std::string class_name;
814
815 if (arg.isobject ())
816 class_name = arg.class_name ();
817 else if (arg.is_string ())
818 class_name = arg.string_value ();
819 else
820 err_wrong_type_arg ("__methods__", arg);
821
822 string_vector sv;
823 bool found = false;
824
825 cdef_class cls = lookup_class (class_name, false, true);
826
827 if (cls.ok ())
828 {
829 // Find methods for classdef objects.
830 std::map<std::string, cdef_method> method_map
831 = cls.get_method_map (false, true);
832
833 std::list<std::string> method_names;
834
835 for (const auto& nm_mthd : method_map)
836 {
837 const cdef_method& method = nm_mthd.second;
838
839 octave_value acc = method.get ("Access");
840
841 if (! acc.is_string () || acc.string_value () != "public")
842 continue;
843
844 octave_value hid = method.get ("Hidden");
845
846 if (hid.bool_value ())
847 continue;
848
849 method_names.push_back (nm_mthd.first);
850 }
851
852 sv = string_vector (method_names);
853 found = true;
854 }
855 else
856 {
857 // Find methods for legacy @CLASS objects.
858 load_path& lp = interp.get_load_path ();
859
860 sv = string_vector (lp.methods (class_name));
861 found = ! sv.empty ();
862 }
863
864 return ovl (Cell (sv), found);
865}
866
867/*
868// BIST tests are in file methods.m
869%!assert (1)
870*/
871
872OCTAVE_END_NAMESPACE(octave)
bool isvector(const dim_vector &dim)
bool is_superclass(const cdef_class &clsa, const cdef_class &clsb, bool allow_equal, int max_depth)
bool is_strict_superclass(const cdef_class &clsa, const cdef_class &clsb)
cdef_object to_cdef(const octave_value &val)
cdef_class lookup_class(const std::string &name, bool error_if_not_found, bool load_if_not_found)
Definition cdef-utils.cc:80
octave_value to_ov(const cdef_object &obj)
cdef_package lookup_package(const std::string &name, bool error_if_not_found, bool load_if_not_found)
bool is_direct_superclass(const cdef_class &clsa, const cdef_class &clsb)
Definition Cell.h:41
std::map< property_key, cdef_property > get_property_map(int mode=property_normal)
Definition cdef-class.h:308
std::map< std::string, cdef_method > get_method_map(bool only_inherited=false, bool include_ctor=false)
Definition cdef-class.h:290
cdef_class get_class() const
bool ok() const
octave_value get(const std::string &pname) const
std::list< std::string > methods(const std::string &class_name, const std::string &pack_name="")
Definition load-path.h:91
virtual bool is_scalar_type() const
Definition ov-base.h:519
void increment_indent_level() const
Definition ov-base.h:939
void indent(std::ostream &os) const
Definition ov-base.cc:1358
virtual Matrix size()
Definition ov-base.cc:220
void newline(std::ostream &os) const
Definition ov-base.cc:1377
static void register_type()
Definition ov-base.cc:101
octave::refcount< octave_idx_type > m_count
Definition ov-base.h:958
virtual octave_idx_type xnumel(const octave_value_list &)
Definition ov-base.cc:230
void decrement_indent_level() const
Definition ov-base.h:942
virtual octave_user_function * user_function_value(bool silent=false)
Definition ov-base.cc:944
virtual octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition ov-base.cc:360
friend class octave_value
Definition ov-base.h:278
virtual bool is_matrix_type() const
Definition ov-base.h:521
bool is_classdef_method(const std::string &cname="") const
std::string file_name() const
bool is_classdef_constructor(const std::string &cname="") const
std::string doc_string(const std::string &meth_name) const
octave_value_list execute(octave::tree_evaluator &tw, int nargout, const octave_value_list &idx)
void print(std::ostream &os, bool pr_as_read_syntax=false)
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
dim_vector dims() const
octave_value_list subsref(const std::string &type, const std::list< octave_value_list > &idx, int nargout)
bool is_instance_of(const std::string &cls_name) const
octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
octave::cdef_object get_object() const
Definition ov-classdef.h:72
static octave_value metaclass_query(const std::string &cls)
octave_idx_type xnumel(const octave_value_list &)
static octave_value superclass_ref(const std::string &meth, const std::string &cls)
std::string class_name() const
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
virtual bool is_classdef_constructor(const std::string &="") const
Definition ov-fcn.h:127
octave::tree_parameter_list * return_list()
Definition ov-usr-fcn.h:389
bool empty() const
Definition ovl.h:113
octave_value_list slice(octave_idx_type offset, octave_idx_type len, bool tags=false) const
Definition ovl.h:129
octave_idx_type length() const
Definition ovl.h:111
bool is_classdef_object() const
Definition ov.h:655
std::string class_name() const
Definition ov.h:1362
bool bool_value(bool warn=false) const
Definition ov.h:891
octave_classdef * classdef_object_value(bool silent=false) const
bool is_string() const
Definition ov.h:637
void short_disp(std::ostream &os) const
Definition ov.h:1348
Matrix size()
Definition ov.h:462
bool is_defined() const
Definition ov.h:592
std::string string_value(bool force=false) const
Definition ov.h:983
bool isobject() const
Definition ov.h:664
bool empty() const
Definition str-vec.h:75
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void print_usage()
Definition defun-int.h:72
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
Definition defun.h:111
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
Definition defun.h:56
void error(const char *fmt,...)
Definition error.cc:1003
void err_wrong_type_arg(const char *name, const char *s)
Definition errwarn.cc:166
octave_value make_idx_args(const std::string &type, const std::list< octave_value_list > &idx, const std::string &who)
Definition ov-base.cc:1450
bool called_from_builtin()
Definition ov-base.cc:1513
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
Definition ovl.h:217
#define octave_stdout
Definition pager.h:301
bool Vcompact_format
Definition pr-output.cc:102