Graphics properties as objects
Michael Goffioul
michael.goffioul at gmail.com
Fri Jan 4 16:42:49 CST 2008
On 1/4/08, John W. Eaton <jwe at bevo.che.wisc.edu> wrote:
> I would really prefer to have the properties be objects instead of
> pointers to objects.
>
> What do you really need the map for?
I think it significantly simplify any code that access properties
by name, because it provides a unified access.
> Even if they are not stored in a map, all property types can still be
> derived from a base class that stores things like the hidden flag.
Indeed, that's what I have for the moment. Actually, I just thought
about something else. Keep the property field as typed classes
in the nested "properties" classes (as it is now); keep the interface
"property" class (as I proposed) as unified access and for reference
count; store all properties in a std::map<caseless_str,property>,
but for fixed properties, artificially increment the internal count by
one to take into account the field use for direct access. That is
something like this:
string_property string;
const string_property& get_string (void) const { return string; }
void set_string (const octave_value& v) { string = v; }
and to store the property in the global map, do something like
(conceptually):
property p (&string);
p.increment_count_by_one ();
xproperties.add (p);
Would this be better?
Michael.
More information about the Octave-maintainers
mailing list