David Megginson wrote:
> Jon S. Berndt wrote:
> > I'd like to consider using this to send the sound manager events of
> > interest, but a protocol for message passing must be reached.
> 
> Jon sent me some ideas by private mail, and they look workable -- it
> really comes down to a judgement call about how frequently the
> messages will be used.  If they're relatively infrequent (say, less
> than a few every second, as seems the case), then we should optimize
> for ease of coding rather than performance.

David Megginson also wrote:
> If the property manager could enforce basic constraints, it could
> eliminate a lot of C++ code.  What are some reasonable facets for a
> property?  Here's what I've thought of, going from general to
> specific:

Why not kill to birds with one stone, and add the following to the
property system:

+ Listener registration on "event" properties.

So the FDM has an event to distribute, like a landing, it just sets
the appropriate properties for the event ("gears[n]/WoW",
"gears[n]/sink_rate" etc...) and then calls something like:

    fgNewEvent("/fdm/events/landing");

Listeners would register via:

    fgAddListener("/fdm/event/landing", handler);

Where "handler" was an instance of FGEventListener, or somesuch.

This has all the cababilities of a hard-coded event system, and all
the flexibility advantages of the property system.  The only problem
with this (specific) scheme is that only one event of a given type can
be active in the property tree.  That's fixable too, with a little
magic, something like: "/events[n]/gear[0]/WoW", where n is the event
ID delivered with the event call.  The property manager would know
when the event was done, so it could clean up the arguments
automatically.

Andy

-- 
Andrew J. Ross                NextBus Information Systems
Senior Software Engineer      Emeryville, CA
[EMAIL PROTECTED]              http://www.nextbus.com
"Men go crazy in conflagrations.  They only get better one by one."
  - Sting (misquoted)


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to