Any further development will happen in fea_libs. Cheers.
A buffet of state machines.
Each header contains a more detailed explanation of the state machine's features, design and limitations. Here is a quick overview.
This is a stack based state machine. It is very fast and supports the most essential fsm features. Under the hood, it uses std::array
and std::function
. This is a great fsm if you need many machines running concurrently, or you need a very fast runtime machine. The design is very simple, making it robust and easy to debug.
This is the "big boi". A full implementation of a hierarchical finite state machine (aka state chart). It is a heap fsm, evaluation uses a queue to process your events. It has all the bells and whistles : transition guards, auto transition guards, history state, parallel states, parent/children states, etc. Use this for very complex behavior you need to manage.
This is a compile-time executable state machine. It is mostly a novel design to experiment with the possibilities opened up when creating a truly constexpr
state machine. The features are quite limited, though you have the added benefit of compile-time validation. For experimentation only, a thorough deep-dive is available in this blog post.
TODO: This will be a mirror state machine to fsm.hpp. It should have a reasonable amount of features, with less overhead using std::tuple
and storing your functions directly without the need of std::function
or C pointers. If this gains feature parity with fsm.hpp, it will replace it.
fea_state_machines
is a header only state machine lib with no dependencies other than the stl.
The unit tests depend on gtest. They are not built by default.
Install recent conan, cmake and compiler.
mkdir build && cd build
cmake .. -DBUILD_TESTING=On && cmake --build . --config debug
bin/fea_state_machines_tests.exe
// Optionally
cmake --build . --target install