Search code examples
c++boostboost-msm

Access front end by the back end of boost meta state machine


For some reasons, I can't setup the parameter of the state machine by constructor So I would like to access the public member function of the meta state machine by the back end. That is, I want something like

typedef msm::back::state_machine<player_> player;

player p;
p.get_front_end(); //get the address of the front end
p.get_front_end().set_param(34) //call the member function of front end

Is this possible?Thanks

The other solution is pass the parameter into the state machine by Event.

p.process_event(open_theme(34));

Solution

  • The back-end inherits the front-end, so you can call set_param directly on p.