From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2004-05-23 21:39:56
David Abrahams writes:
> "Andreas Huber" <ah2003_at_[hidden]> writes:
> > David Abrahams wrote:
> > [snip]
> >> Also, do I note that there's always function pointer indirection for
> >> event dispatch?
> > I'm not sure I understand what you mean with "function pointer indirection".
> > Event dispatch consists of a virtual function call followed by a linear
> > search for a reaction matching the event.
> That's what I mean. If you look at the FSM examples I posted, no
> virtual call is needed, and in fact the linear search could be
> optimized by the compiler into a hashed case statement or by
> metaprogramming into a log(n) search. The 2nd example uses a
> constant-time lookup, dispatching through a single function pointer.
> There are lots of dispatching tradeoffs available.
> I really like your state representation; it seems as though it should
> be possible to get all these different dispatching options with your
> state representation, rather than requiring a monolithic STT sequence
> to be assembled as my examples do.
A monolithic STT has many advantages, especially for small FSMs.
-- Aleksey Gurtovoy MetaCommunications Engineering
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk