sml icon indicating copy to clipboard operation
sml copied to clipboard

Marking initial state in transition that originates from its nested state

Open Ulenspiegel opened this issue 9 years ago • 6 comments

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?

Ulenspiegel avatar Jun 02 '16 22:06 Ulenspiegel

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.

kris-jusiak avatar Jun 03 '16 15:06 kris-jusiak

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.

redboltz avatar Oct 29 '16 14:10 redboltz

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...)

redboltz avatar Nov 20 '16 06:11 redboltz

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

redboltz avatar Nov 20 '16 14:11 redboltz

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.

kris-jusiak avatar Nov 22 '16 20:11 kris-jusiak

Will pseudo entry and exit states eventually be supported?

thildenbrand avatar Apr 19 '21 09:04 thildenbrand