User Tools

Site Tools


fsm:use_fsm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
fsm:use_fsm [2007/12/22 14:45] – external edit 127.0.0.1fsm:use_fsm [2020/11/23 17:23] (current) – external edit 127.0.0.1
Line 14: Line 14:
  
 ===== Controlling the FSM operation ===== ===== Controlling the FSM operation =====
- 
- 
- 
- 
- 
 ==== Directed work with the "idle" event ==== ==== Directed work with the "idle" event ====
  
Line 26: Line 21:
  
 Syntactic sugar: the idle() method is a shorthand for apply_events(fsm::IDLE_EVENT). Syntactic sugar: the idle() method is a shorthand for apply_events(fsm::IDLE_EVENT).
- 
  
 ==== Filtering events ==== ==== Filtering events ====
Line 37: Line 31:
   * fsm::EVENT_SINK : receives events but throws them away.   * fsm::EVENT_SINK : receives events but throws them away.
     * Switching from fsm::EVENT_QUEUE to fsm::EVENT_SINK empties the event queue accumulated while under fsm::MODE_QUEUE     * Switching from fsm::EVENT_QUEUE to fsm::EVENT_SINK empties the event queue accumulated while under fsm::MODE_QUEUE
- 
- 
- 
  
 ==== Disabling post-events actions ==== ==== Disabling post-events actions ====
Line 51: Line 42:
 For a very basic FSM going just from initial to final randomly, building the table and transitions can look like: For a very basic FSM going just from initial to final randomly, building the table and transitions can look like:
  
-<php>+<code php>
 class foo extends fsm class foo extends fsm
   {   {
Line 78: Line 69:
     }     }
   }   }
-</php>+</code> 
 + 
  
 Application code not involved in the FSM operation can use the FSM apply_event method($event_name) to submit an event to the FSM. Only allowed events for the given state the FSM is in are allowed: submitting other events throws an exception.  Application code not involved in the FSM operation can use the FSM apply_event method($event_name) to submit an event to the FSM. Only allowed events for the given state the FSM is in are allowed: submitting other events throws an exception. 
fsm/use_fsm.1198334708.txt.gz · Last modified: 2020/11/23 17:23 (external edit)