Boost logo

Boost Users :

Subject: [Boost-users] [StateChart] How to pass arguments to a state constructor when doing state transition?
From: Zhu Bicen (zhubicen_at_[hidden])
Date: 2011-03-22 09:15:36


Hi all,

I have a state like this, which has two parameters in it's constructor
except the ctx.
I want to know how to pass these two arguments to the constructor, when do
state transition?
I have tried this:
transit< RepeatedPlayingState , 1, 2>();

But it cause compiling error? How to do this? I want to pass something to a
new entered state.

Thanks!

class RepeatedPlayingState: public state< RepeatedPlayingState, PlayingState
>
{
public:
    RepeatedPlayingState( my_context ctx , long start_pos, long end_pos) :
my_base( ctx ){
        context< PlayerFsm >().player_.PlayFromTo(start_pos, end_pos);
    }
};

Best Regards
Hill



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