Examples

The following examples are available to show case how yasmine works and to provide a quick start guide for developing with yasmine. They provide a walk-through the C++ code, so you can jump right in using yasmine.

  • Hello, yasmine! - The mandatory variation of the 'Hello world!' example for yasmine C++11 state machine library. It shows the very basics of using yasmine by building a very simple state machine.

  • The classic farmroad example - A classic example for a more complex state machine that originates from the book "Contemporary Logic Design" by Randy H. Katz. It is solving the traffic light controller problem (a.k.a. the farm road problem).

  • Forty two (42) - An example of a state machine that contains all the different kind of vertices. It shows how to add states, pseudostates and also guards and behaviors using predefined macros.

  • Events with parameters example - An example that shows how to use events with parameters. Different approaches are shown: strongly typed and manual down-casting of events.

  • Sub state machine with variables example - A project that demonstrates how a sub state machine can be used. Also the usage of variables that are shared between states is shown in this example.

  • Event collector example (from version 1.1.0) - This project shows the way the event collector works and how events can be enqueued from a state behavior and/or from a transition behavior.

  • Unhandled event handler (from version 1.3.0) - An example if a state machine that handle the events that are not processed and deferred.