|
Boost Users : |
Subject: Re: [Boost-users] [statechart] handling unexpected events
From: Robert Mecklenburg (rmecklenburg_at_[hidden])
Date: 2008-09-19 14:57:27
On 2008-09-18 20:54:11 GMT, Robert wrote:
> The only thing I can see is that the unconsumed_event() function is
> called with the unexpected event object. What I'd like to do in this
> function is:
>
> 1. Abort my transaction and force the state machine back to the Ready
> state. I'm not sure how to do this.
I've implemented a hack with an internal event, ResetEvent, that I
post. This sort of works, but it executes the exit() member function
of the aborted state. I'd rather not, I'm trying to abort the
behavior of the current state, not complete it.
If there was a way from unconsumed_event() to get the current state
object and set a flag in it, I could avoid completing the state
behavior with a guard. I can use state_downcast<const T *>() to get a
const pointer to my state object, but because it is const I can't set
a flag. I cannot seem to get a non-const pointer.
> 2. Reprocess the unexpected event if it is a hello or get, discard it
> otherwise. I'm not sure how to do this, either.
I've discovered that post_event() will enqueue any event for
processing after the current react() is finished.
Thanks for any insight you can provide,
-- Robert
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