|
Boost Users : |
Subject: Re: [Boost-users] [Statechart] Passing Arguments in the Events Concept
From: Babi Seal (sseal73_at_[hidden])
Date: 2008-09-30 18:07:08
Thanks for your prompt response. Yes it works really well.
----- Original Message ----
From: Andreas Huber <ahd6974-spamboostorgtrap_at_[hidden]>
To: boost-users_at_[hidden]
Sent: Tuesday, September 30, 2008 1:08:24 PM
Subject: Re: [Boost-users] [Statechart] Passing Arguments in the Events Concept
Hi
> I have been researching the Boost archives, Tutorials,
> examples and I do find references to the fact that it is
> possible to provide arguments along with Events that a
> custom_reaction (in self-transition) can selectively
> "react" on based on the value of the argument but
> I am unable to articulate it using the Boost Statechart
> library.
I just realized that there is not a single example on how to pass arguments with events. It's very easy to do, though:
struct EvWhatever : sc::event< EvWhatever >
{
int Arg1;
double Arg2;
// More arguments here
};
You might want to add a constructor that accepts corresponding arguments and sets the data members Arg1 & Arg2 accordingly.
You can access Arg1 & Arg2 in the react member function, in a transition action or the function called by an in_state_reaction.
Hope this helps. if not, please let me know.
Regards,
-- Andreas Huber
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