Boost logo

Boost :

Subject: Re: [boost] [msm] Nested submachines and explicit state entry
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2010-06-10 08:32:37


>MSM Documentation (section: Explicit Entry):
>---------------------------------------------
>You can then use it as target in a transition with State1 as source:
>_row < State1, Event2, SubFsm2::direct< SubFsm2_::SubState2> >
>The syntax deserves some explanation. SubFsm2_ is a front end. SubState2
>is a nested state, therefore the SubFsm2_::SubState2 syntax. The
>containing machine (containing State1 and SubFsm2) refers to the backend
>instance (SubFsm2). SubFsm2::direct states that an explicit entry is
>desired.
---------------------------------------------

>So I think the code snippet has to look like as follows (SubFsm2 instead
>of SubFsm2_):
>_row < State1, Event2, SubFsm2::direct< SubFsm2::SubState2> >

Actually not but I might need to detail a bit.
Consider:

struct SubFsm2_ ... // front-end
{
  struct SubState2 ... // ---> nested type
};
typedef msm::back::state_machine<SubFsm2_> SubFsm2; //back-end

SubFsm2_ : front-end
SubFsm2: back-end

SubFsm2_::SubState2 : the complete name of SubState2.
Which means that :

_row < State1, Event2, SubFsm2::direct< SubFsm2_::SubState2> >

is correct. The back-end(SubFsm2) provides a direct entry type
(SubFsm2::direct<>) taking as argument the direct entry state, which
name is SubFsm2_::SubState2.

Regards,

Christophe


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