Boost logo

Boost Users :

Subject: [Boost-users] [boost.msm] BOOST_MSM_EUML_DECLARE_STATE_MACHINE with state base class
From: Stefan Näwe (stefan.naewe_at_[hidden])
Date: 2014-05-23 05:56:19


Hi there,

I use MSM from boost 1.49 with VC9 on Windows XP.
I want to use the eUML front end.
My states shall use a polymorphic base class and are defined
like this:

// State base class
struct Worker { virtual void work() = 0; };

// a state
struct Running_ : msmf::state<Worker>, euml_state<Running_>
{
  void work() { ... }
} const Running;

My transition table is defined with BOOST_MSM_EUML_TRANSITION_TABLE()

My state machine is defined like this:

BOOST_MSM_EUML_DECLARE_STATE_MACHINE((
        trans_table,
        init_ << AnyState,
        no_action, // fsm_entry
        no_action, // fsm_exit
        attributes_ << one_attr << another_attr,
        configure_ << no_configure_,
        Log_No_Transition,
        Log_Exception),
  MyFSM_fe)

struct FSM : msmb::state_machine<MyFSM_fe> {};

All OK until here.

But now I want to add the state base class to the
above invocation of BOOST_MSM_EUML_DECLARE_STATE_MACHINE to be
able to say :

    fsm.get_state_by_id(fsm.current_state()[0])->work()

at any given time.

BOOST_MSM_EUML_DECLARE_STATE_MACHINE((
        trans_table,
        init_ << Running,
        no_action, // fsm_entry
        no_action, // fsm_exit
        attributes_ << one_attr << another_attr,
        configure_ << no_configure_,
        Log_No_Transition,
        Log_Exception,
        Worker),
  MyFSM_fe)

But this gives me a compile error:

   C2275: 'Worker' : illegal use of this type as an expression.

Is there any way to achieve what I need ? Can I somehow
_NOT_ use the macro and create the same state machine (i.e. with
attributes!) ?

Thanks for any help!

Stefan

-- 
----------------------------------------------------------------
/dev/random says: A Bugless Program is an Abstract Theoretical Concept.
python -c "print '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')" 
GPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9  9666 829B 49C5 9221 27AF

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