|
Boost Users : |
From: Andreas Huber (ahd6974-spamboostorgtrap_at_[hidden])
Date: 2008-03-06 15:01:05
Hi
> Here is an simple example: Each session object of the server has two
> states:
> signed-off and authorized. Receiving a login event leads to a transition
> to
> the authorized state. Thats pretty easy. But the login data (stored in the
> login event) got lost. I can hold this data in the state machine itself
> (outermost_context()). Or I can use a pseudo event to forward this data to
> the authorized state. But I'm looking for a nifty way to avoid this
> overhead.
Your observations are correct. Provided that you absolutely want to
transition when such an event arrives, then these are currently the only
ways to make the event available to the destination state. Which way is best
depends on your situation but in your example I'd probably simply post the
incoming event and have it picked up with an in-state reaction in the
destination state.
> I like this concept of state-local storage very much. But I'm not
> shure about how to use it.
Maybe you've noticed the existence of
BOOST_STATECHART_RELAX_TRANSITION_CONTEXT? Currently, this doesn't help you.
However, one way to solve your problem would be to generalize the relaxing
concept, so that you can specify any function that happens to accept the
right type of event and also is a member of any state in the source or
destination configuration. I've tried to implement this before, but
abandoned the idea because it makes at lot of heavily templated code much
more complex. Maybe I'll try again but don't count on getting this feature
soon!
HTH,
-- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
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