Boost logo

Boost Users :

Subject: Re: [Boost-users] [msm] EUML in a header file
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2011-05-10 16:53:47


> Christophe,
>
> One problem I've run into with the EUML frontend is the the _EVENT, _ACTION and _STATE
> macros define non-static instance variables. So, if I define a state machine in a header file which
> then gets included in multiple source files (e.g. I have two classes which use the same state machine)
> I get linker errors about duplicate instances. For states, I can work around this issue by doing, for example,
>
> BOOST_MSM_EUML_DECLARE_STATE((),MyStateType)
> static MyStateType MyState;
>
> and then using MyState in the transition table. Events and Actions don't seem to have the corresponding
> _DECLARE_ macros, so this workaround isn't really feasible at this point in time. Any thoughts?

Hi Nate,

The problem is that I'm missing some const. I added the ones I saw, to
get you further, but I'll need to have a closer look at all this quite
fast.
The trunk version should solve the problems you encountered until now.
I hope this will buy me the time to check a bit more ;-)

BTW, the macros are not an absolute need, they're just here because
people complained about the parens in the transition table. You always
have the possibility to avoid the macro:
struct play : msm::front::euml::euml_event<play> {};
//same for states

//transition table
state1() + play() == state2()

You can also provide your own instances inside a front-end definition,
thus eliminating the problem completely, as in:
http://www.boost.org/doc/libs/1_46_0/libs/msm/doc/HTML/examples/SimpleTutorialWithEumlTable.cpp

Here the states and events could easily be move inside the front-end.
It's actually my personal preference.

Thanks,
Christophe


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