Skip to content

Issue about non trivial on_entry/on_exit #369

Closed
@GuiCodron

Description

@GuiCodron

Expected Behavior

I don't really know what you want from non trivial on_exit/on_entry, but I thought it would pick the most specific on_exit/on_entry and avoid using the default one.

i.e. the following state machine:
struct c {
auto operator()() noexcept {
using namespace sml;
// clang-format off
return make_transition_table(
*idle + sml::on_exit<> / [this] { calls+="|"; }
,idle + sml::on_exit / [this] { calls+="e2|"; }
,idle + event = s1
,idle + event = s1
);
// clang-format on
}

std::string calls;

};

Triggering an event e2 should only add "e2|" and triggering e1 should add "_|".
Same expected behaviour if sm was inside a parent sm.

Actual Behavior

Triggering e2 add "e2|" and "_|"

Steps to Reproduce the Problem

  1. checkout this version https://github.com/GuiCodron/sml/tree/gco/fix-non-trivial-entry-exit
  2. Execute the following command from root directory
    mkdir -f BUILD && cd BUILD && rm -rf *; cmake .. && make test_transitions && ./test/ft/test_transitions
  3. Test will fail with on_exit being called multiple times

I can work on this. But I would like to know what is the expected behaviour of non-trivial on_entry/on_entry?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions