Marking initial state in transition that originates from its nested state
How does one indicate initial state in an explicit transition that originates from the state nested inside the initial one, like in following example:
struct TopState {
TopState() {}
auto configure() const noexcept {
using namespace msm;
return make_transition_table(
// Mark ss1 as initial state.
*ss1(ls1_1) + event<e3> = ss2, // Compilation error.
ss2 + event<e4> = ss1
/* ... */
);
}
};
Introducing separate initial state with anonymous transition to ss1 solves it, but is there a better way?
Thanks @Ulenspiegel for pointing out this issue. Unfortunately this is not implemented yet completly but your syntax is the one which should evntually works for it. For now you can explicitly enter sub state machine, like that:
idle + event<e3> = sub(region1_state, region2_state, etc...)
I will keep this issue open as long as the proper functionality will not be implemented.
I think that the question is related to exit point pseudo state on UML2.x. http://redboltz.wikidot.com/exit-point-pseudo-state
And the @krzysztof-jusiak 's comment is related to entry point pseudo state. http://redboltz.wikidot.com/entry-point-pseudo-state
I also want to that feature.
Does the comment https://github.com/boost-experimental/sml/issues/44#issuecomment-223609106 mean that I can specify submachines' entry state directly? If it is, does it work with #75?
I mean something like as follows:
idle + event<e3> = "sub1"_s.sm<sub>(region1_state, region2_state, etc...)
I noticed that
idle + event<e3> = "sub1"_s.sm<sub>(region1_state, region2_state, etc...)
got compile error but
idle + event<e3> = "sub1"_s.sm<sub>()(region1_state, region2_state, etc...)
compiles successfully.
However, it seems that transition doesn't happen. I guess that this functionality doesn't work the current version. (https://github.com/boost-experimental/sml/commit/bdad61940497e4a2ea99514bc3462f30d73e8360) http://melpon.org/wandbox/permlink/F8fxhXEk3doZJhbD
Interesting. Thanks @redboltz for pointing it out. It shouldn't work yet, I'm implementing it at the moment (explicit entry + entry/exit pseudo states). Will keep you informed about the progress.
Will pseudo entry and exit states eventually be supported?