<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Tutorial</title><link>https://sourceforge.net/p/instantfsm/wiki/Tutorial/</link><description>Recent changes to Tutorial</description><atom:link href="https://sourceforge.net/p/instantfsm/wiki/Tutorial/feed" rel="self"/><language>en</language><lastBuildDate>Mon, 10 Mar 2014 21:55:12 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/instantfsm/wiki/Tutorial/feed" rel="self" type="application/rss+xml"/><item><title>Tutorial modified by Alexis Chol</title><link>https://sourceforge.net/p/instantfsm/wiki/Tutorial/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -40,6 +40,7 @@

 A detail of each exception that can be thrown will be given during the tutorial. You can also find it in the [cheatsheet](CheatSheet).

+## Events ##

 ## States ##
 The first interesting feature is to be able to add subStates to the root state (the StateMachine instance).
@@ -123,14 +124,141 @@
 Note: The definition of an initial State amongst the nested States of a parallel State is not required.

 ## Entry and Exit callbacks ##
-
+Most of the time, the execution of your state machine drives properties of other systems. It can be sending some event or messages through a communication system or displaying and hiding some elements of a GUI. These action are executed relatively to the current configuration of the state machine, meaning that one action has to be undergone when entering the state and another, sometimes inserse action, when leaving it.
+For instance, for a music player, I can have a state Playing and another state Stopped. In the Playing state, I need to turn the Play button into a Pause button and enable the Stop button, while in Stopped state, I need to turn the Pause button into Play and disable the Stop button.
+To achieve this kind of behavior, you can setup `entry` and `exit` callbacks to each `State` you create, by calling respectively the `OnEntry` and `OnExit` functions inside the State function.
+Each of these functions take a callable type as parameter, which will be called upon entry (respectively exit) of the State.
+This callable can be of two forms : 
+ 
+ * void(void) : taking no parameter and returning nothing
+ * void(StateMachine&amp;) : taking a StateMachine&amp; parameter and returning nothing
+ 
+The former one is a simple callback with no parameter, while the latter one, receives the StateMachine instance as parameter, allowing the callback to issue an event or query the activity of a state.
+This use of a generic callable as parameter allows for various types to be passed, be it pointer to function, `std::bind` results, `std::function` and especially lambda functions.
+
+Here is a sample of displaying to the standard output when entering and exiting a state using simple functions: 
+
+~~~~~~
+:::cpp
+using namespace ifsm;
+
+void entering(){
+  std::cout&lt;&lt;"Entering the root state!"&lt;&lt;&lt;"Exiting the root state!"&lt;&lt;/pre&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Chol</dc:creator><pubDate>Mon, 10 Mar 2014 21:55:12 -0000</pubDate><guid>https://sourceforge.neta9c57e0891a23e3d458cdec99bd6e8b005866613</guid></item><item><title>Tutorial modified by Alexis Chol</title><link>https://sourceforge.net/p/instantfsm/wiki/Tutorial/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -1 +1,136 @@
-Work In Progress
+
+# Tutorial #
+
+[TOC]
+
+## Simplest State Machine ##
+
+~~~~~~
+:::cpp
+using namespace ifsm;
+
+StateMachine myMachine;
+~~~~~~
+
+This is the simple one. 
+
+This kind of FSM is not going to be very helpful, but will start from there and expand.
+
+Note: The StateMachine instance is a state itself, so anything that applies to State instances in the rest of this page also applies to the StateMachine instance, ie. transitions, properties, OnEntry, OnExit, ...
+
+
+## Validity and error management ##
+
+Describing an FSM follows a set of rules. When on of these rule is broken, instantFSM throws a meaningfull exception to inform the developper of the problem. It is then good practice, during development, to surround your instantation with a try/catch block and display meaningfull error when an exception is caught:
+
+~~~~~~
+:::cpp
+using namespace ifsm;
+
+try{
+  StateMachine myMachine(
+    
+  );
+}
+catch(const StateMachineException&amp; e){
+  std::cout&lt;&lt;&lt;/pre&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Chol</dc:creator><pubDate>Wed, 05 Mar 2014 22:40:19 -0000</pubDate><guid>https://sourceforge.net195e04f42fcfcb2b2a483bdcfe7d8bbf69dba6b0</guid></item><item><title>Tutorial modified by Alexis Chol</title><link>https://sourceforge.net/p/instantfsm/wiki/Tutorial/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Work In Progress&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Chol</dc:creator><pubDate>Tue, 04 Mar 2014 22:55:44 -0000</pubDate><guid>https://sourceforge.netf7736ae43d9a360a8386806f61e28f330ef08821</guid></item></channel></rss>