Boost logo

Boost Users :

Subject: [Boost-users] [msm] euml submachine with non-default constructor
From: squiremyrkle_at_[hidden]
Date: 2012-05-15 14:17:30


Hello, having trouble getting this to work.

Here’s a simplification of what I’m trying:

//states and events defined elsewhere

struct sub_fsm : public msm::front::state_machine_def<sub_fsm,
state_base>
{
    typedef entry_state_impl initial_state;

    BOOST_MSM_EUML_DECLARE_TRANSITION_TABLE((
      entry_state + some_event() / action1
       == next_state
    ), transition_table)

    sub_fsm() : pctx_(nullptr) {}
    sub_fsm(context *p) : pctx_(p) {}

    context *pctx_;
};

typedef msm::back::state_machine<sub_fsm> sub_helper;
struct sub_machine : public sub_helper, public
msm::front::euml::euml_state<sub_helper>
{
    sub_machine() {}
    sub_machine(context *p) : sub_helper(p) {}
};
sub_machine const sub;

struct outer_fsm : public msm::front::state_machine_def<outer_fsm,
state_base>
{
typedef outer_entry_state_impl initial_state;

    BOOST_MSM_EUML_DECLARE_TRANSITION_TABLE((
      outer_entry_state + another_event() / action2 == sub
    ), transition_table)

    outer_fsm() : pctx_(nullptr) {}
    outer_fsm(context *p) : pctx_(p) {}

    context *pctx_;
};
typedef msm::back::state_machine<outer_fsm> outer_machine;

int main()
{
    context ctx;
    outer_machine fsm(msm::back::states_ << sub_machine(&ctx), &ctx);
}

This doesn’t compile under VC2010, it can’t deduce the template
arguments for operator <<().

Am I on the right track here? Should the template parameter of
euml_state<> really be sub_helper and not sub_machine (I got that chunk
of code from here:
http://svn.boost.org/svn/boost/trunk/libs/msm/doc/HTML/examples/CompositeTutorialWithEumlTable.cpp)?

What am I doing wrong?

Thanks for any help,
Mark

-- 
http://www.fastmail.fm - Choose from over 50 domains or use your own

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