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

Add _event system variable if string events enabled #87

Merged
merged 6 commits into from
Dec 6, 2018

Conversation

sstiller
Copy link
Contributor

Adding variable _event https://www.w3.org/TR/scxml/#SystemVariables
with the contents name and data. https://www.w3.org/TR/scxml/#InternalStructureofEvents
_event.name contains the event name as std::string
_event.data is a boost::any (new dependency)

The support for _event currently only works for string events. _event.data could be added to the other version of dispatch() later.

_event.data is really great to update the data model in scxml or for guard conditions for transitions.

@jp-embedded
Copy link
Owner

Great addition ☺️

I would prefer to use std:any instead boost:any to have a dependency on c++17 instead of boost

@sstiller
Copy link
Contributor Author

In my targets I can only use C++14 (too old compilers).
Perhaps we can add a compiler switch.

@jp-embedded
Copy link
Owner

Yes, then both options are available. I think we should make the c++17 option the default because c++17 eventually will become more and more common. Also, we already have the c++17 dependency when using the --threadsafe option, where boost is a new one.

@sstiller
Copy link
Contributor Author

Would you prefer

  • a cmdline option for scxmlcc to specify the wanted C++ version or
  • always adding #if __cplusplus >= 201703L to the generated code to use boost::any or std::any
    Then the type changes with the used c++ version automatically, what may not be wanted by the user.

Or do you have another idea?

@jp-embedded
Copy link
Owner

I think I prefer a 'use boost instead c++17' option rather than using the ifdef, because its a matter of using/not using an external library more than enabling/disabling a feature that requires c++17

Also, it could end up with a lot of ifdefs with the other method because the threadsafe option has the same issue which also requires c++17 (this could also be implemented with boost as an alternative)

@jp-embedded
Copy link
Owner

Thanks a lot :-)

@jp-embedded jp-embedded merged commit 8a58021 into jp-embedded:master Dec 6, 2018
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

Successfully merging this pull request may close these issues.

2 participants