Blame libs/statechart/doc/definitions.html

Packit 58578d
Packit 58578d
Packit 58578d
<html>
Packit 58578d
<head>
Packit 58578d
  <meta http-equiv="Content-Language" content="en-us">
Packit 58578d
  <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
Packit 58578d
  <meta name="ProgId" content="FrontPage.Editor.Document">
Packit 58578d
  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
Packit 58578d
  <link rel="stylesheet" type="text/css" href="../../../boost.css">
Packit 58578d
Packit 58578d
  <title>The Boost Statechart Library - Definitions</title>
Packit 58578d
</head>
Packit 58578d
Packit 58578d
<body link="#0000FF" vlink="#800080">
Packit 58578d
  
Packit 58578d
  "header">
Packit 58578d
    
Packit 58578d
      
Packit 58578d
        

Packit 58578d
        "../../../boost.png" border="0" width="277" height="86">
Packit 58578d
      
Packit 58578d
Packit 58578d
      
Packit 58578d
        

The Boost Statechart Library

Packit 58578d
Packit 58578d
        

Definitions

Packit 58578d
      
Packit 58578d
    
Packit 58578d
  
Packit 58578d
  
Packit 58578d
Packit 58578d
  

Introduction

Packit 58578d
Packit 58578d
  

The Boost.Statechart documentation uses a lot of terminology specific to

Packit 58578d
  state machines. Most of it is equal to the one used in the UML
Packit 58578d
  specifications. This document contains only definitions for terminology not
Packit 58578d
  used by the UML
Packit 58578d
  standard. A short tour around UML terminology can be found 
Packit 58578d
  "http://www.sts.tu-harburg.de/teaching/ws-99.00/OOA+D/StateDiagrams.pdf">here.

Packit 58578d
Packit 58578d
  

Definitions

Packit 58578d
Packit 58578d
  
Packit 58578d
    
Context
Packit 58578d
Packit 58578d
    
Innermost common context
Packit 58578d
Packit 58578d
    
Innermost state
Packit 58578d
Packit 58578d
    
In-state reaction
Packit 58578d
Packit 58578d
    
Outermost state
Packit 58578d
Packit 58578d
    
Polymorphic events
Packit 58578d
Packit 58578d
    
Reaction
Packit 58578d
Packit 58578d
    
Unstable state
Packit 58578d
Packit 58578d
    
Unstable state machine
Packit 58578d
  
Packit 58578d
Packit 58578d
  

Context

Packit 58578d
Packit 58578d
  

The contexts of a state define its location in the state hierarchy. A

Packit 58578d
  state's direct context is defined by what is passed as the
Packit 58578d
  Context template parameter of the 
Packit 58578d
  "reference.html#ClassTemplatesimple_state">simple_state and
Packit 58578d
  state class
Packit 58578d
  templates. This can either be the state machine (which makes the state an
Packit 58578d
  outermost state) or its direct outer state. A
Packit 58578d
  state's indirect contexts follow from the direct context of its
Packit 58578d
  direct context and the direct context of the direct context of its direct
Packit 58578d
  context and so on. Examples:

Packit 58578d
Packit 58578d
  

Packit 58578d
  border="0" width="467" height="572">

Packit 58578d
Packit 58578d
  
    Packit 58578d
        
  • A's direct context is the state machine (not visible in this
  • Packit 58578d
        picture). A does not have any indirect contexts
    Packit 58578d
    Packit 58578d
        
  • B's direct context is A. B's indirect context is the
  • Packit 58578d
        state machine (not visible in this picture)
    Packit 58578d
    Packit 58578d
        
  • C's direct context is B. C's indirect contexts are B, A
  • Packit 58578d
        and the state machine (not visible in this picture)
    Packit 58578d
    Packit 58578d
        
  • D's direct context is A. D's indirect context is the
  • Packit 58578d
        state machine (not visible in this picture)
    Packit 58578d
      
    Packit 58578d
    Packit 58578d
      

    Innermost

    Packit 58578d
      common context
    Packit 58578d
    Packit 58578d
      

    The innermost common context of two states is the first direct or

    Packit 58578d
      indirect context that both states have in common. Also known as Least
    Packit 58578d
      Common Ancestor (UML).

    Packit 58578d
    Packit 58578d
      

    Innermost state

    Packit 58578d
    Packit 58578d
      

    An innermost state is a state that does not itself have inner states.

    Packit 58578d
      Also known as leaf state or simple state (UML). Note that 
    Packit 58578d
      "reference.html#ClassTemplatesimple_state">boost::statechart::simple_state<>
    Packit 58578d
      is not a model of the UML simple state.

    Packit 58578d
    Packit 58578d
      

    In-state

    Packit 58578d
      reaction
    Packit 58578d
    Packit 58578d
      

    An in-state reaction is a reaction that neither

    Packit 58578d
      exits nor enters any states. Also known as inner transition or internal
    Packit 58578d
      transition (UML).

    Packit 58578d
    Packit 58578d
      

    Outermost state

    Packit 58578d
    Packit 58578d
      

    An outermost state is a state that does not itself have outer states.

    Packit 58578d
      Note that an outermost state is different from the UML top state. A state
    Packit 58578d
      machine can have an arbitrary number of the former but only exactly one of
    Packit 58578d
      the latter. Boost.Statechart only supports outermost states.

    Packit 58578d
    Packit 58578d
      

    Polymorphic

    Packit 58578d
      events
    Packit 58578d
    Packit 58578d
      

    An FSM library supports polymorphic events if events can inherit from

    Packit 58578d
      each other without restrictions and if it allows the definition of
    Packit 58578d
      reactions for leafs and nodes of the resulting event inheritance
    Packit 58578d
      tree.

    Packit 58578d
    Packit 58578d
      

    Example (using a hypothetical FSM library, as Boost.Statechart does not

    Packit 58578d
      support polymorphic events):

    Packit 58578d
      
    Packit 58578d
    struct EvButtonPressed : Event // node
    Packit 58578d
    {
    Packit 58578d
      /* common button pressed properties */
    Packit 58578d
    };
    Packit 58578d
    Packit 58578d
    struct EvPlayButtonPressed : EvButtonPressed {}; // leaf
    Packit 58578d
    struct EvStopButtonPressed : EvButtonPressed {}; // leaf
    Packit 58578d
    struct EvForwardButtonPressed : EvButtonPressed {}; // leaf
    Packit 58578d
    Packit 58578d
    Packit 58578d
      

    If a state machine needs to react whenever any button (including

    Packit 58578d
      the ones that may be added in the future) is pressed, a reaction for
    Packit 58578d
      EvButtonPressed can be defined.

    Packit 58578d
    Packit 58578d
      

    Reaction

    Packit 58578d
    Packit 58578d
      

    A reaction consists of all the side effects caused by the processing of

    Packit 58578d
      one event. Reactions can be categorized as follows:

    Packit 58578d
    Packit 58578d
      
      Packit 58578d
          
    1. In-state reaction
    2. Packit 58578d
      Packit 58578d
          
    3. Event deferral
    4. Packit 58578d
      Packit 58578d
          
    5. Transition
    6. Packit 58578d
      Packit 58578d
          
    7. Termination, also known as transition to the final state (UML)
    8. Packit 58578d
        
      Packit 58578d
      Packit 58578d
        

      Note that it is possible to mix a reaction of type 1 with one of the

      Packit 58578d
        other types (the in-state reaction is always executed first) but it is not
      Packit 58578d
        possible to mix a reaction of type 2-4 with anything else but type 1.

      Packit 58578d
      Packit 58578d
        

      A reaction is always associated with exactly one state type and exactly

      Packit 58578d
        one event type.

      Packit 58578d
      Packit 58578d
        

      Unstable state

      Packit 58578d
      Packit 58578d
        

      A state is unstable from the moment when it has been entered until after

      Packit 58578d
        its last direct inner state has been entered. A state is also
      Packit 58578d
        unstable from the moment just before its first direct inner state is
      Packit 58578d
        exited until right before the state itself is exited.

      Packit 58578d
      Packit 58578d
        

      Unstable state

      Packit 58578d
        machine
      Packit 58578d
      Packit 58578d
        

      A state machine is unstable if at least one of its currently active

      Packit 58578d
        states is unstable. This is the case during the following three
      Packit 58578d
        operations:

      Packit 58578d
      Packit 58578d
        
        Packit 58578d
            
      • Initiation: From the moment after the first state has been entered
      • Packit 58578d
            until after the last state of the initial state configuration has been
        Packit 58578d
            entered
        Packit 58578d
        Packit 58578d
            
      • Transition: From the moment just before the first state of the
      • Packit 58578d
            current state configuration is exited until after the last state of the
        Packit 58578d
            destination state configuration has been entered
        Packit 58578d
        Packit 58578d
            
      • Termination: From the moment just before the first state is exited
      • Packit 58578d
            until right before the last terminated state is exited. A successfully
        Packit 58578d
            executed termination (no exception was thrown) never leaves any states
        Packit 58578d
            unstable. For example, consider the active state A with two orthogonal
        Packit 58578d
            regions in which the inner states B and C are each active. Terminating
        Packit 58578d
            either B or C does not make A unstable. Neither does terminating both, as
        Packit 58578d
            that inevitably also terminates A
        Packit 58578d
          
        Packit 58578d
        Packit 58578d
          

        Under normal circumstances a state machine has Run-To-Completion

        Packit 58578d
          semantics, that is, it is always stable before the machine returns to the
        Packit 58578d
          client or before the next event is dequeued. So, a state machine is usually
        Packit 58578d
          only unstable when it is busy processing an event and becomes stable again
        Packit 58578d
          right before it has finished processing the event. However, this can not be
        Packit 58578d
          guaranteed when entry, exit or transition actions fail. Such a failure is
        Packit 58578d
          reported by an event, which must be processed while the state machine is
        Packit 58578d
          unstable. However, exception event processing rules ensure that a state
        Packit 58578d
          machine is never unstable when it returns to the client (see 
        Packit 58578d
          "reference.html#process_event">state_machine<>::process_event()
        Packit 58578d
          for details).

        Packit 58578d
          
        Packit 58578d
        Packit 58578d
          

        Packit 58578d
          "../../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
        Packit 58578d
          height="31" width="88">

        Packit 58578d
        Packit 58578d
          

        Revised

        Packit 58578d
          29 December, 2006

        Packit 58578d
        Packit 58578d
          

        Copyright © 2003-2006

        Packit 58578d
          Andreas Huber Dönni

        Packit 58578d
        Packit 58578d
          

        Distributed under the Boost Software License, Version 1.0. (See

        Packit 58578d
          accompanying file LICENSE_1_0.txt or
        Packit 58578d
          copy at 
        Packit 58578d
          "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt)

        Packit 58578d
        </body>
        Packit 58578d
        </html>