Boost logo

Boost Users :

Subject: [Boost-users] [statechart] Unhandled events
From: Oleg Smolsky (oleg_at_[hidden])
Date: 2010-10-07 03:25:30


  Hey there, I've been using SC for a while and something has been
bugging me - given a state machine with:
     OuterSt, OneSt and TwoSt

as well as OneEv and TwoEv that are handled by OneSt and TwoSt
respectively, it is possible to send a wrong event to either of the last
two states. Such an "unhandled" event will be forwarded to OuterSt and
then quietly eaten.

My question is as follows - is it possible to define some kind of "catch
all" handler in the OuterSt? I have already fixed a tricky bug in my
code where a submitted event was lost, and wonder if there is a simple
way to handle these situations? I can certainly add a
custom_reaction<>(X) for each possible event to the OuterSt and catch
issues that way, but that's far from ideal.

Any suggestions would be appreciated.

P.S. perhaps a compromise solution would be to add something like this
to OuterSt:
     sc::bug<OneEv>
     sc::bug<TwoEv>

but that would effectively limit handling to issuing an assert(false)...

Thanks,
Oleg.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net