octave-maintainers
[Top][All Lists]
Advanced

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

Re: [RFC] octave-to-backend notification of property change


From: Maciek Gajewski
Subject: Re: [RFC] octave-to-backend notification of property change
Date: Fri, 4 Jul 2008 22:55:20 +0200
User-agent: KMail/1.9.9

Michael Goffioul write:
> > Let all "set" methods notify backend using the same method, with
> > signature like this:
> >
> > virtual void base_graphics_backend::property_changed( const
> > graphics_handle& owner, const std::string& name );
>
> I also considered that possibility, but I found it way less efficient than
> having specific methods
>
> virtual void base_graphics_backend::figure_property_changed(...)
>
> Indeed, from the octave point of view, when such notification method
> is called, it knows the object and property (because it's called from
> the set_xxx handler), so it can call a specific method directly.
> OTOH, using generic signature as you propose would just force
> the backend to re-do a lot of string comparisons to know which
> property was changed.

So, do you want to have notifier method for each property? That would require 
backend author to re-implement a whole lot of methods, most of which would be 
almost identical.

String comparisons are cheap these days. I could event bet, that entire 
processor time used for these comparisons, on all octave instances, all 
around the world, would be shorter that time spent by programmers to code and 
maintain all these methods :)

Besides - these notifiers would be used in interactive environments, when 
performance isn't all that important as in - for example - running large 
batch calculations.

At the other side - it could be good to have sepearate notifiers per object 
class:

void figure_property_changed( graphics_handle fh,  std::string prop_name );
void axes_property_changed( graphics_handle ah,  std::string prop_name );
void axes_item_property_changed( graphics_handle ih,  std::string prop_name );
void uiobject_property_changed( graphics_handle uh,  std::string prop_name );

Maciek Gajewski



reply via email to

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