All Projects → andrew-gresyk → HFSM

andrew-gresyk / HFSM

Licence: MIT license
Hierarchical Finite State Machine Framework

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to HFSM

fea state machines
A Buffet Of C++17 State Machines
Stars: ✭ 19 (-73.97%)
Mutual labels:  fsm, fsm-library, hfsm
xstate-cpp-generator
C++ State Machine generator for Xstate
Stars: ✭ 33 (-54.79%)
Mutual labels:  fsm, fsm-library
kstatemachine
KStateMachine is a Kotlin DSL library for creating finite state machines (FSM) and hierarchical state machines (HSM).
Stars: ✭ 63 (-13.7%)
Mutual labels:  fsm, fsm-library
Hfsm2
High-Performance Hierarchical Finite State Machine Framework
Stars: ✭ 134 (+83.56%)
Mutual labels:  fsm, mit-license
use-state-machine
Use Finite State Machines with React Hooks
Stars: ✭ 28 (-61.64%)
Mutual labels:  fsm
FiniteStateMachine
This project is a finite state machine designed to be used in games.
Stars: ✭ 45 (-38.36%)
Mutual labels:  fsm
brush
An amazing scaffolding for developing database-driven websites, applications and APIs. Built on Laravel Lumen Framework, MySQL and Angular.
Stars: ✭ 23 (-68.49%)
Mutual labels:  mit-license
remachine
[WIP] Reason pattern matching viz
Stars: ✭ 44 (-39.73%)
Mutual labels:  fsm
hsluv-c
C99 implementation of HSLuv (revision 4)
Stars: ✭ 71 (-2.74%)
Mutual labels:  mit-license
AuroraCMS
The Australian Open Source Content Management System
Stars: ✭ 13 (-82.19%)
Mutual labels:  mit-license
as fsm
A finite state machine implementation for elixir
Stars: ✭ 14 (-80.82%)
Mutual labels:  fsm
Cold-Family-Feud
Host your own Family Feud game. Mobile friendly with built in buzzers.
Stars: ✭ 30 (-58.9%)
Mutual labels:  mit-license
chatto
Chatto is a minimal chatbot framework in Go.
Stars: ✭ 98 (+34.25%)
Mutual labels:  fsm
qp-arduino
QP real-time embedded frameworks/RTOS for Arduino (AVR and SAM)
Stars: ✭ 37 (-49.32%)
Mutual labels:  fsm
pastafarian
A tiny event-based finite state machine
Stars: ✭ 20 (-72.6%)
Mutual labels:  fsm
magento-grid-colors
Magento 2 Grid Colors module for colorizing admin grids. Supports saving of states with the help of grid's bookmarks.
Stars: ✭ 54 (-26.03%)
Mutual labels:  mit-license
xstate
State machines and statecharts for the modern web.
Stars: ✭ 21,286 (+29058.9%)
Mutual labels:  fsm
Samurai
Archived: A Discord bot for BitZeny users.
Stars: ✭ 21 (-71.23%)
Mutual labels:  mit-license
synflood
Start a SYN flood attack to an ip address.
Stars: ✭ 27 (-63.01%)
Mutual labels:  mit-license
HacktoberFest2021
Beginner-friendly repository for Hacktober Fest 2021. Start your contribution to open source through baby steps. 💜
Stars: ✭ 33 (-54.79%)
Mutual labels:  mit-license

Standard License: MIT Build status Build Status

HFSM (Hierarchical Finite State Machine) Framework

Header-only heriarchical FSM framework in C++14, completely static (no dynamic allocations), built with variadic templates.

Compiler Support

DEPRECATED, FURTHER DEVELOPMENT CONTINUES IN HFSM2

Compiler Support

  • Visual Studio 14.u3, 15.7
  • GCC 4.9, 5.4, 6.3, 7.3, 8.0
  • Clang 3.6, 3.7, 3.8, 3.9, 4.0, 5.0, 6.0

Basic Usage

// 1. Include HFSM header:
#include <hfsm/machine_single.hpp>

// 2. Define interface class between the FSM and its owner
//    (also ok to use the owner object itself):
struct Context { /* ... */ };

// 3. (Optional) Typedef hfsm::Machine for convenience:
using M = hfsm::Machine<OwnerClass>;

// 4. Define states:
struct MyState1 : M::Bare {
    // 5. Override some of the following state functions:
    void enter(Context& _);
    void update(Context& _);
    void transition(Control& c, Context& _);
    void leave(Context& _);
};

struct MyState2 : M::Bare { /* .. */ };
struct MySubState1 : M::Bare { /* .. */ };
struct MySubState2 : M::Bare { /* .. */ };

struct MyState3 : M::Bare { /* .. */ };
struct MyOrthogonalState1 : M::Bare { /* .. */ };
struct MyOrthogonalState2 : M::Bare { /* .. */ };

// 6. Declare state machine structure:
using MyFSM = M::PeerRoot<
    MyState1,
    M::Composite<MyState2,
        MySubState1,
        MySubState2,
    >,
    M::Orthogonal<MyState3,
        MyOrthogonalState1,
        MyOrthogonalState2,
    >
>;

int main() {
    // 7. Create context and state machine instances:
    Context context;
    MyFSM fsm(context);

    // 8. Kick off periodic updates:
    bool running = true;
    while (running)
        fsm.update();

    return 0;
}

Feature Highlights

  • Permissive MIT License
  • Written in widely-supported modern(ish) C++ 14
  • 100% NoUML-compliant
  • Not hamstrung by restrictive event reaction-based approach, but supports powerful event handling
  • Hierarchical, with composite (sub-machine) and orthogonal regions
  • Header-only
  • Fully static, no dynamic allocations
  • Uses inline-friendly compile-time pylymorphism, no virtual methods were harmed
  • Type-safe transitions: FSM.changeTo<TargetState>()
  • Gamedev-friendly, supports explicit State::update()
  • Scaleable, supports state re-use via state injections
  • Debug-assisted, includes automatic structure and activity visualization API with #define HFSM_ENABLE_STRUCTURE_REPORT
  • Convenient, minimal boilerplate

Documentation

See Wiki for Tutorial and docs.


Get Updates


Special Thanks

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].