boost::msm usage: how to set properties of target states

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

boost::msm usage: how to set properties of target states

spiritwalker
States in my fsm has different properties. I define a event which will invoke a transition to a target state. I want to set properties of target by event data. My choices are:
1. set properties in the action or guard: but it is still in the source state. I fill not good if i set the target state properties at the time
2. set properties in the target entry: but the value of properties have been calculated in guard on receiving the event so i should recalculated again :(

Any one can give me more ideas. Thanks !
Reply | Threaded
Open this post in threaded view
|

Re: boost::msm usage: how to set properties of targetstates

Christophe Henry-2
Hi,

>States in my fsm has different properties. I define a event which will
>invoke
>a transition to a target state. I want to set properties of target by event
>data. My choices are:
>1. set properties in the action or guard: but it is still in the source
>state. I fill not good if i set the target state properties at the time
>2. set properties in the target entry: but the value of properties have
>been
>calculated in guard on receiving the event so i should recalculated again
>:(
>
>Any one can give me more ideas. Thanks !


You can const_cast the event in the guard (sounds a bit strange though to
have a guard doing work, an action in the same transition would be a better
place) and set the value inside, then use it in the entry.

HTH,
Christophe

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users