Skip to content

shamim-akhtar/fsm-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reusable Finite State Machine using C++

There are several ways you can implement a finite state machine using C++. The easiest and fastest way probably is to use the enumerator type and the switch-case statement. However, in this tutorial, we are not going to do that. Instead, we will use a slightly sophisticated, more robust, generic class-based approach to reuse across multiple projects.

At the same time, we also want to extend the functionality by using functors in the same framework. But first, let’s recap on what is a Finite State Machine.

Turnstile Wikipedia

Definition

Finite State Machine (or FSM in short) is a computational pattern that defines and models state behaviour. At any given time, a Finite State Machine can exist in only one state out of a set of a possible number of states. This state can change to another in response to some inputs (sometimes called events).

The process of switching from one state to another is called a transition.

Read the tutorial on https://faramira.com/reusable-finite-state-machine-using-cpp/

About

This repository implements a reusable Finite State Machine using C++. It also illustrates the concept by applying the implemented Finite State Machine in a few example use cases.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages