octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Graphics properties as objects


From: Michael Goffioul
Subject: Re: Graphics properties as objects
Date: Fri, 4 Jan 2008 23:42:49 +0100

On 1/4/08, John W. Eaton <address@hidden> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]