Boost logo

Boost :

From: Andreas Huber (ahd6974-spamboostorgtrap_at_[hidden])
Date: 2007-08-30 17:58:02


--- Leandro Lucarella <llucarella_at_[hidden]> wrote:
> It was a problem with my ISP, if it's not much trouble, please
> Cc/forward me to luca at integratech dyndns org. Thanks!

Ok, I'll try to remember.

> > I'm considering to add such a class. I'll have to think about the
> naming and the exact interface though.
>
> Great! What about the other idea? I'm sorry about the lame format,
> my
> MUA was messing my ASCII-art =P. Here it is again, I hope this time
> is
> more readable:
>
> struct ev: sc::event< ev > {};
> struct B;
> struct C;
> struct A: sc::simple_state< A, Machine >
> {
> typedef mpl::list<
> sc::completion_transition< >,
> sc::custom_reaction< ev >
> > reactions;
> sc::result react(const completion_event&)
> {
> if (guard)
> return transit< B >();
> return discard_event();
> }
> sc::result react(const ev&)
> {
> if (!guard)
> return transit< C >();
> return discard_event();
> }
> };

I'm not sure how this is an improvement over the choice-point-like class?

> >> Another simple question about statechart: it can handle this?
> >>
> >> ,-----------------.
> >> | S |<--- T
> >> | |
> >> o--+--> A --> B <--o |
> >> | |
> >> `-----------------´
>
> Same here. What I wanted to show was:
>
> ,-------------------. z
> | S |<--- T
> w | x y |
> o---+--> A ---> B <---o |
> | |
> `-------------------´

Ok, I guess now I see what you want to achieve. Yes, this is a (minor)
limitation of the library. The state that you specify as InitialState of an
FSM must be an outermost state of the FSM. Similarly, the argument passed
for the InnerInitial parameter of simple_state must be a *direct* inner
state, please see

<http://www.boost.org/libs/statechart/doc/reference.html#ClassTemplatestate_machine>
<http://www.boost.org/libs/statechart/doc/reference.html#ClassTemplatesimple_state>

Again, this limitation can be overcome easily with the same trick. Specify a
dummy outermost state as initial state and then post an event in the entry
action that will trigger a transition to the desired state.

HTH,

--
Andreas Huber
When replying by private email, please remove the words spam and trap
from the address shown in the header. 

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk