Boost logo

Boost Users :

Subject: Re: [Boost-users] [statechart] Can inner states be defined for a statein orthogonal region?
From: Andreas Huber (ahd6974-spamboostorgtrap_at_[hidden])
Date: 2009-08-13 16:53:34


Hi Gordon

I don't have access to a compiler right now, but from looking at the source
this seems easy to fix:

> struct SerialPort : public state_machine< SerialPort, StateTXWrapper > {}
>
> struct StateTXWrapper: simple_state< StateTXWrapper, SerialPort,
> mpl::list< StateTXNotReady, StateStart > > {};

The inner initial states StateTXNotReady and StateStart are missing, I guess
you did not intend to post the complete code?

> struct StateMrf : simple_state< StateMrf,
> StateTXWrapper::orthogonal< 0 > > {};

Fine so far.

> struct StatePortClosed : simple_state< StatePortClosed,
> StateTXWrapper::orthogonal< 0 > > {};
>
> struct StateOpenPort : simple_state< StateOpenPort,
> StatePortClosed > {};
>
> struct StateOpenPortWait : simple_state< StateOpenPortWait,
> StatePortClosed > {};

The error lies in the declaration of the 3 states above. StateOpenPort &
StateOpenPortWait claim to be inner states of StatePortClosed. However,
since StatePortClosed does not define an inner initial state, it is assumed
to be an innermost state, which is why the assertions do not hold. You can
fix this e.g. as follows:

struct StateOpenPort;
   struct StatePortClosed : simple_state< StatePortClosed,
StateTXWrapper::orthogonal< 0 >, StateOpenPort > {};

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