Boost logo

Boost Users :

Subject: Re: [Boost-users] boost.MSM: No member function 'process_any_event' declared
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2013-03-05 16:16:24


Hi Rafael,

> Hi Christophe,
>
> In case a class is derived from the msm::back::state_machine class and
> used
> with the favor_compile_time policy I get the following error:
>
> *No member function 'process_any_event' declared*
>
> Please consider the following code snippets to get more details:
>
> *// MasterStateMachine.hpp*
>
> struct Master_: mgp_state_machine_def<Master_> {
> // ...
> }
>
> *class MasterStateMachine : public msm::back::state_machine<Master_,
> msm::back::favor_compile_time>{
>
> public:
> MasterStateMachine () { // some stufff };
>
> }
>
> *// MasterStateMachine.cpp*
> #include "MasterStateMachine.hpp"
> BOOST_MSM_BACK_GENERATE_PROCESS_EVENT(MasterStateMachine)
>
>
> Why does the compiler complains although the class MasterStateMachine
> inherits the "process_any_event" method from the
> *msm::back::state_machine<Master_, msm::back::favor_compile_time>*
> back-end?
>
> The point of matter is the
> *BOOST_MSM_BACK_GENERATE_PROCESS_EVENT(MasterStateMachine)* macro. In case
> it is uncomment, everythin works fine, but unfortunately without the
> support
> of the favor_compile_time policy.

Either I misunderstood you or you got it wrong (more likely, the doc is not
clear enough as this policy is little known).
The point of this macro is simply to allow SUBMACHINES to be built in their
own TU and you should not use it for the top-level fsm.
IIUC, MasterStateMachine is your top-level fsm, right? Then you don't need
the macro and you still get the favor_compile_time policy.
Of course, you don't get any process_any_event, but you don't need it as
it's only an implementation detail for submachines.
You call process_event as usual.
The policy will bring a little gain for compiling the top-level fsm, but the
main gain is the possibility to build submachines in their own TU, which
usually means faster compile (granted, I compile with -j12 or -j4 ;-) ).

HTH,
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