Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding event payloads #102

Open
wizfromoz opened this issue Jul 22, 2019 · 3 comments
Open

Adding event payloads #102

wizfromoz opened this issue Jul 22, 2019 · 3 comments

Comments

@wizfromoz
Copy link

This is a suggestion for improvement:

It would be nice if it was possible to pass additional data when dispatching an event. I currently get around this by placing data in the user_model area, but it complicates control of the access in a multi-threaded environment. It would be much simpler if one could pass payload data alongside the event instance when firing events.

@sstiller
Copy link
Contributor

This was added in December 2018 to the string version of dispatch().
It has a second param with a std::any (or boost::any, depending on configurend C++ version).
The any object can be accessed in the transition with _event.data (using any_cast, of course).
See #87
Works fine on a large embedded state machine I'm working on.

@wizfromoz
Copy link
Author

I am using the release version 0.9, which was released in January. It looks like the change you're talking about hasn't made to the release line. Is this in some kind of development line? Any idea when it will make it to the release?
Thanks for your prompt response.

@jp-embedded
Copy link
Owner

The master branch is stable, so you can try this. It is just not tagged with a version nummer.

It wont probobly be long before a new tag is made

But anyway, this feature is missing in the non-string version

You have to enable the string version with a parameter to scxmlcc. Also note that this wont have the same performance if that is critical for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants