Giter VIP home page Giter VIP logo

dynamic-state-machine's People

Contributors

jfayot avatar

Stargazers

 avatar  avatar

Watchers

 avatar

dynamic-state-machine's Issues

Missing reset history feature

User should be able to reset the history either from the state machine itself, or from within any inner state (inside an action for instance)

A transit call is not processed outside off a processEvent

When you are using the transit function outside off a processEvent it is not processed until the next processEvent.

The following test will fail :

_sm.addState<NiceMock<s0>, Entry>();
_sm.addState<NiceMock<s1>>();
_sm.addTransition<s0, e0, s0, &s0::onEvent0>();

s0* _s0 = _sm.getState<s0>();
ON_CALL(*_s0, onEvent0(_)).WillByDefault(Invoke([&] () { _s0->transit<s1>(); }));

_sm.start();
 _s0->transit<s1>();

ASSERT_TRUE((_sm.checkStates<s1>()));

Crash when using postEvent in an onEntry call.

The application crash in debug with the following exception when using postEvent in an onEntry call.
cannot seek value-initilized deque iterator.
The m_postedTransitions list is modified while something else is using an iterator on it.

It can be reproduced with the following test :

_sm.addState<NiceMock<s0>, Entry>();
_sm.addState<NiceMock<s1>>();
_sm.addTransition<s0, e0, s0, &s0::onEvent0>();
_sm.addTransition<s1, e1, s1, &s1::onEvent1>();

s0* _s0 = _sm.getState<s0>();
s1* _s1 = _sm.getState<s1>();

ON_CALL(*_s0, onEvent0(_)).WillByDefault(Invoke([&] () { _s0->transit<s1>(); }));
ON_CALL(*_s1, onEntry0()).WillByDefault(Invoke([&] () { _s1->postEvent(e1{}); }));
ON_CALL(*_s1, onEvent1(_)).WillByDefault(Invoke([&] () { std::cout << "toto" << std::endl; }));

_sm.start();
_sm.processEvent(e0{});

ASSERT_TRUE((_sm.checkStates<s1>()));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.