From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2008-08-31 12:55:45
On Sun, 2008-08-31 at 15:28 +0200, Thomas Klimpel wrote:
> Andrey Semashev wrote:
> > Not exactly. You don't have to override the transit handler unless you
> > want to define some non-trivial transition logic. If you stick to the
> > same degree of functionality that TMP provides (IOW, no runtime
> > conditions for the transition to take place), then you can use the
> > fsm::transition class as a direct replacement for the row template in
> > the TMP approach.
> > If you have to decide when and which state to transit to in runtime,
> > then yes, you have to define your custom transition rule.
> But how can I specify the "transition action", if not by overriding the "transit" method?
ï»¿As I said, if you need some non-trivial (i.e. something more complex
than a mere call to switch_to), you have to implement the transit
handler. Otherwise, you don't have to do that and you get precisely what
the TMP solution provides.
> And even if I override the "transit" method, how should I handle the fact that the event will still be delivered to the target state?
Process the event. Every event passed to the state machine must be
processed in some way - either in one of the on_process handlers, or in
the unexpected events handler. You cannot cancel the event delivery
because the machine has to return something from the FSM's process
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk