Boost logo

Boost Users :

Subject: Re: [Boost-users] How do you handle state-independent events efficiently in MSM?
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2011-09-13 15:00:03


>> we will move to plan B. Define a second region in your fsm, with only one dummy state, then add for every event you want to process

>>independently of your "regular" states a transition in the fsm from this dummy state to itself (or give this state an internal transition table).

>> As every region gets a chance to process any event, you will get the same effect and the reduced compilation time.

   

>Thanks, this is exactly what I was looking for! I implemented this and it works perfectly, and it cut down my transition table significantly!

   

>The next question applies to another smaller subset of events I need to deal with. These can also happen regardless of what state the machine is

>in, but transition the machine to a one my "regular" states. I can use a similar approach with these, but obviously I need an additional method to

>put the machine back to the dummy state in addition to the "regular" state the incoming event transitions the machine to. How would I implement

>this, or something that accomplishes something similar?

   

   

>Thanks!

>Pete

Hi,

it took a little long but I managed to make plan A work. If you provide an internal transition table (internal_transition_table) in your fsm definition, you can avoid having to define a second region with a single state. Instead you get a transition looking like this:

struct internal_transition_table : boost::mpl::vector<

Internal < event , action , guard >

> {};

In this case, action and guard are functors but it works with other rows too.
You will need the latest trunk version.

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