Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Designing a state machine in C++

I have a little problem that involves modeling a state machine.

I have managed to do a little bit of knowledge engineering and 'reverse engineer' a set of primitive deterministic rules that determine state as well as state transitions.

I would like to know what the best practices are regarding:

  • How to rigorously test my states and state transitions to make sure that the system cannot end up in an undetermined state.

  • How to enforce state transition requirements (for example, it should be impossible to go directly from stateFoo to StateFooBar, i.e. to imbue each state with 'knowledge' about the states it can transition to.

Ideally, I would like to use clean, pattern based design, with templates wherever possible.

I do need somewhere to start though and I would be grateful for any pointers (no pun intended), that are sent my way.

like image 692
skyeagle Avatar asked Apr 24 '10 16:04

skyeagle


1 Answers

Be sure to take a look at the Boost Statechart Library.

like image 142
gammelgul Avatar answered Sep 20 '22 02:09

gammelgul