26 #if ! defined (octave_cdef_object_h)
27 #define octave_cdef_object_h 1
29 #include "octave-config.h"
67 err_invalid_object (
"set_class");
72 err_invalid_object (
"clone");
77 err_invalid_object (
"empty_clone");
82 err_invalid_object (
"copy");
87 err_invalid_object (
"make_array");
90 virtual bool is_array (
void)
const {
return false; }
100 err_invalid_object (
"array_value");
104 { err_invalid_object (
"put"); }
108 err_invalid_object (
"get");
114 err_invalid_object (
"set_property");
119 err_invalid_object (
"get_property");
123 subsref (
const std::string&,
const std::list<octave_value_list>&,
126 err_invalid_object (
"subsref");
130 subsasgn (
const std::string&,
const std::list<octave_value_list>&,
133 err_invalid_object (
"subsasgn");
138 virtual bool is_valid (
void)
const {
return false; }
140 std::string class_name (
void)
const;
144 err_invalid_object (
"mark_for_construction");
149 err_invalid_object (
"is_constructed_for");
154 err_invalid_object (
"is_partially_constructed_for");
159 err_invalid_object (
"mark_as_constructed");
164 err_invalid_object (
"mark_as_constructed");
169 err_invalid_object (
"is_constructed");
193 error (
"%s: invalid object", who);
215 rep->release (*
this);
228 std::string
class_name (
void)
const {
return rep->class_name (); }
246 bool is_array (
void)
const {
return rep->is_array (); }
258 rep->put (pname, val);
263 return rep->get (pname);
269 return rep->set_property (idx, pname, pval);
275 return rep->get_property (idx, pname);
279 subsref (
const std::string&
type,
const std::list<octave_value_list>& idx,
281 bool auto_add =
false)
283 return rep->subsref (
type, idx, nargout, skip,
context, auto_add);
287 subsasgn (
const std::string&
type,
const std::list<octave_value_list>& idx,
290 make_unique (ignore_copies);
291 return rep->subsasgn (
type, idx, rhs);
300 bool ok (
void)
const {
return rep->is_valid (); }
304 rep->mark_for_construction (cls);
311 return rep->is_constructed_for (cls);
316 return rep->is_partially_constructed_for (cls);
322 { rep->mark_as_constructed (cls); }
332 if (rep->m_count > ignore_copies + 1)
407 subsref (
const std::string&
type,
const std::list<octave_value_list>& idx,
412 subsasgn (
const std::string&
type,
const std::list<octave_value_list>& idx,
420 return tmp.
put (pname, pval);
428 return tmp.
get (pname);
460 map.assign (pname, val);
465 Cell val = map.contents (pname);
467 if (val.
numel () < 1)
468 error (
"get: unknown slot: %s", pname.c_str ());
477 error (
"invalid index");
486 error (
"invalid index");
492 subsref (
const std::string&
type,
const std::list<octave_value_list>& idx,
497 subsasgn (
const std::string&
type,
const std::list<octave_value_list>& idx,
500 void mark_for_construction (
const cdef_class&);
502 bool is_constructed_for (
const cdef_class& cls)
const;
504 bool is_partially_constructed_for (
const cdef_class& cls)
const;
508 void mark_as_constructed (
const cdef_class& cls);
609 virtual bool is_class (
void)
const {
return false; }
619 const std::list<octave_value_list>& ,
622 error (
"subsref: invalid meta object");
658 bool is_class (
void)
const {
return get_rep ()->is_class (); }
660 bool is_property (
void)
const {
return get_rep ()->is_property (); }
662 bool is_method (
void)
const {
return get_rep ()->is_method (); }
664 bool is_package (
void)
const {
return get_rep ()->is_package (); }
668 const std::list<octave_value_list>& idx,
int nargout)
670 return get_rep ()->meta_subsref (
type, idx, nargout);
677 return get_rep ()->meta_accepts_postfix_index (
type);
N Dimensional Array with copy-on-write semantics.
octave_idx_type numel(void) const
Number of elements in the array.
Vector representing the dimensions (size) of an Array.
~cdef_object_array(void)=default
bool is_valid(void) const
void set_property(octave_idx_type idx, const std::string &pname, const octave_value &pval)
cdef_object_array(const Array< cdef_object > &a)
cdef_object_array(const cdef_object_array &obj)
octave_value get_property(octave_idx_type idx, const std::string &pname) const
Array< cdef_object > array_value(void) const
cdef_object_rep * clone(void) const
bool is_array(void) const
void fill_empty_values(void)
Array< cdef_object > array
dim_vector dims(void) const
cdef_object_base(const cdef_object_base &obj)
cdef_object_rep * empty_clone(void) const
virtual octave_idx_type static_count(void) const
virtual bool is_constructed_for(const cdef_class &) const
virtual void destroy(void)
virtual ~cdef_object_rep(void)=default
virtual cdef_object_rep * clone(void) const
virtual void set_class(const cdef_class &)
refcount< octave_idx_type > m_count
virtual octave_value get(const std::string &) const
virtual void put(const std::string &, const octave_value &)
virtual bool is_handle_object(void) const
virtual Array< cdef_object > array_value(void) const
OCTAVE_NORETURN void err_invalid_object(const char *who) const
virtual bool is_partially_constructed_for(const cdef_class &) const
virtual cdef_object_rep * copy(void) const
virtual bool is_array(void) const
virtual octave_value subsasgn(const std::string &, const std::list< octave_value_list > &, const octave_value &)
virtual void mark_as_constructed(const cdef_class &)
virtual void set_property(octave_idx_type, const std::string &, const octave_value &)
cdef_object_rep(const cdef_object_rep &)
virtual bool is_constructed(void) const
virtual cdef_object_rep * empty_clone(void) const
virtual bool is_valid(void) const
virtual octave_value get_property(octave_idx_type, const std::string &) const
virtual void mark_as_constructed(void)
virtual octave_value_list subsref(const std::string &, const std::list< octave_value_list > &, int, size_t &, const cdef_class &, bool)
virtual dim_vector dims(void) const
virtual bool is_value_object(void) const
virtual void mark_for_construction(const cdef_class &)
virtual cdef_object_rep * make_array(void) const
virtual bool is_meta_object(void) const
void set_property(octave_idx_type idx, const std::string &pname, const octave_value &pval)
dim_vector dims(void) const
octave_value get(const std::string &pname) const
void put(const std::string &pname, const octave_value &val)
bool is_constructed(void) const
std::map< cdef_class, std::list< cdef_class > > ctor_list
~cdef_object_scalar(void)=default
void mark_as_constructed(void)
octave_value get_property(octave_idx_type idx, const std::string &pname) const
cdef_object_scalar(const cdef_object_scalar &obj)
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 make_unique(int ignore_copies)
bool is_constructed_for(const cdef_class &cls) const
void mark_for_construction(const cdef_class &cls)
void set_property(octave_idx_type idx, const std::string &pname, const octave_value &pval)
bool is_value_object(void) const
bool is_constructed(void) const
cdef_object_rep * get_rep(void)
cdef_object make_array(void) const
void put(const std::string &pname, const octave_value &val)
void set_class(const cdef_class &cls)
std::string class_name(void) const
bool is_handle_object(void) const
bool is_meta_object(void) const
cdef_object clone(void) const
bool is_partially_constructed_for(const cdef_class &cls) const
cdef_object(const cdef_object &obj)
void mark_as_constructed(const cdef_class &cls)
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 empty_clone(void) const
dim_vector dims(void) const
cdef_object(cdef_object_rep *r)
cdef_object copy(void) const
string_vector map_keys(void) const
virtual ~cdef_object(void)
octave_value get_property(octave_idx_type idx, const std::string &pname) const
void mark_as_constructed(void)
bool is_array(void) const
const cdef_object_rep * get_rep(void) const
handle_cdef_object(const handle_cdef_object &obj)
cdef_object_rep * copy(void) const
bool is_valid(void) const
bool is_handle_object(void) const
cdef_object_rep * clone(void) const
cdef_object_rep * clone(void) const
cdef_object_rep * copy(void) const
bool is_valid(void) const
value_cdef_object(const value_cdef_object &obj)
bool is_value_object(void) const
void error(const char *fmt,...)
std::string release(void)
static llvm::LLVMContext & context