Boost logo

Boost Users :

From: Jan Eickmann (je_at_[hidden])
Date: 2005-03-10 15:21:01


Andreas Huber wrote:
> Hi Jan
>
>> when doing a transition using transit<myDestinationState>, I would
>> like to pass some parameters to myDestination.
>
>
> What is the ctor of myDestination going to do with them? Where do these
> arguments come from? What did you do with them in the react function?
>
>> Problem is, those
>> parameter-values will not be known at compile time, so I can't just
>> pass them in as template-parameters to myDestinationState.
>> Of course I could just set some global (or static member member)
>> variable and read that from myDestinationState's constructor but this
>> doesn't feel like a very clean design.
>>
>> Any suggestions?
>
>
> There are various ways: Have a variable in an outer state, have one in
> the FSM, use a transition action or avoid the problem altogether. What
> exactly the best one is really depends on the source of your problem.
>
> Regards,
> Andreas Huber

Thanks for the help so far,

I'll try to give some more information. In the application we are
developing, we have a screen that is kind of like an encyclopedia. This
screen is usually shown after the user presses a "more information"
button in a popup dialog, etc.
That encyclopedia-screen is the state I want to transit to. Now what I
want to do is tell that screen what entry to show.
In order to be able to get back to the original state, I put the
"normal" GUI of the application in a state that has a deep-history.

So the common outer state would basicly be the FSM but I would rather
avoid having a variable there as this would require changing the FSM
itself everytime I want to add a similar screen that gets told from the
outside what to do exactly.

I currently don't really see how I can avoid the problem altogether...

Regards,

Jan Eickmann


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