Mercurial > hg > octave-lyh
diff src/pt-const.h @ 747:6182de8cb3b7
[project @ 1994-09-30 15:09:36 by jwe]
author | jwe |
---|---|
date | Fri, 30 Sep 1994 15:12:14 +0000 |
parents | 86ddd7cfaac8 |
children | 3fc1ccd5a9db |
line wrap: on
line diff
--- a/src/pt-const.h +++ b/src/pt-const.h @@ -40,6 +40,7 @@ #include "oct-obj.h" class idx_vector; +class Octave_map; struct Mapper_fcn; @@ -123,6 +124,9 @@ tree_constant (const Range& r) : tree_fvc () { rep = new tree_constant_rep (r); rep->count = 1; } + tree_constant (const Octave_map& m) : tree_fvc () + { rep = new tree_constant_rep (m); rep->count = 1; } + tree_constant (tree_constant::magic_colon t) : tree_fvc () { tree_constant_rep::constant_type tmp; @@ -148,19 +152,11 @@ // Simple assignment. - tree_constant operator = (const tree_constant& a) - { - if (--rep->count <= 0 && rep != a.rep) - delete rep; - - rep = a.rep; - rep->count++; - return *this; - } + tree_constant operator = (const tree_constant& a); // Indexed assignment. - tree_constant assign (tree_constant& rhs, const Octave_object& args) + tree_constant assign (const tree_constant& rhs, const Octave_object& args) { if (rep->count > 1) { @@ -172,6 +168,15 @@ return *this; } +// Simple structure assignment. + + tree_constant assign_map_element (SLList<char*>& list, tree_constant& rhs); + +// Indexed structure assignment. + + tree_constant assign_map_element (SLList<char*>& list, tree_constant& rhs, + const Octave_object& args); + // Type. It would be nice to eliminate the need for this. int is_constant (void) const { return 1; } @@ -197,6 +202,7 @@ int is_complex_matrix (void) const { return rep->is_complex_matrix (); } int is_string (void) const { return rep->is_string (); } int is_range (void) const { return rep->is_range (); } + int is_map (void) const { return rep->is_map (); } int is_magic_colon (void) const { return rep->is_magic_colon (); } // Are any or all of the elements in this constant nonzero? @@ -264,6 +270,10 @@ Range range_value (void) const { return rep->range_value (); } + Octave_map map_value (void) const; + + tree_constant lookup_map_element (SLList<char*>& list); + ColumnVector vector_value (int force_string_conversion = 0, int force_vector_conversion = 0) const { return rep->vector_value (); } @@ -339,6 +349,16 @@ char *type_as_string (void) const { return rep->type_as_string (); } +// We really do need this, and it should be private: + +private: + + void make_unique (void); + + tree_constant_rep *make_unique_map (void); + +public: + // ------------------------------------------------------------------- // These may not need to be member functions.