Boost logo

Boost :

From: Leandro Lucarella (llucarella_at_[hidden])
Date: 2007-08-29 16:42:16

I saw your email[1] via the gmane web interface (did you Cc me? maybe
you mail was eaten by my antispam =).

I don't really know how to handle "partial" completion transitions (I
mean, with guards). But simple completion transitions could be expressed
something like:

struct B;
struct A: sc::simple_state< A, Machine >
typedef sc::completion_transition< B > reactions;

I guess is better to have partial support than no support at all =)

To implement "partial" completion transitions, maybe it could be some
scheme like this:

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();

When the state is entered, a complete_event is automatically posted, so
it can be handled by the first react(). If the guard is not true, the
event is discarded, so when the event "ev" comes, it can be handled in
the usual way (by the second react()).

Well, I guess I had an idea... =P

PS: I don't know much about UML, so I don't know if this idea is
compatible with the specifications...

Another simple question about statechart: it can handle this?

| S |<--- T
| |
o--+--> A --> B <--o |
| |

I want the state machine to start at A, but any other time S is entered,
I want to start at B. AFAIK this is possible in UML. Can I express that
in boost.statechart? I think I hit an static assertion when trying to do
that (/usr/include/boost/statechart/simple_state.hpp:885: error: invalid
application of ‘sizeof’ to incomplete type


Leandro Lucarella
Integratech S.A.

Boost list run by bdawes at, gregod at, cpdaniel at, john at