Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

Finite State Machine Implementation in C++

IP.com Disclosure Number: IPCOM000112940D
Original Publication Date: 1994-Jun-01
Included in the Prior Art Database: 2005-Mar-27
Document File: 4 page(s) / 91K

Publishing Venue

IBM

Related People

Ries, N: AUTHOR

Abstract

Disclosed is an implementation of a Finite State Machine (FSM) in the C++ programming language. Finite State Machines provide the capability to process algorithms in a table driven manner. A problem solving algorithm can be defined, maintained and enhanced in tabular form. The Finite State Machine can be used in many different application areas, for example communications protocols or expression parsing functions.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 52% of the total text.

Finite State Machine Implementation in C++

      Disclosed is an implementation of a Finite State Machine (FSM)
in the C++ programming language.  Finite State Machines provide the
capability to process algorithms in a table driven manner.  A problem
solving algorithm can be defined, maintained and enhanced in tabular
form.  The Finite State Machine can be used in many different
application areas, for example communications protocols or expression
parsing functions.

The finite state machine implementation presented consists of the
following components:

o   C header file with definitions enabling application programmers
    to define algorithms in tabular form

o   FSM (Finite State Machine) class in C++

      An application programmer can create instances (objects) of
this class in his application program.  The constructor takes as
parameter the pointer to the first entry of a state table (array of
state table entries) also provided by the application programmer.  A
state table can be an array of any number of state table entries as
shown in the Figure.  Each table entry contains five fields:

1.  Current State

2.  Event

3.  Predicate(s)

4.  Action(s)

5.  New State

      At any given point in time, the problem to be solved is in a
defined state termed the current state.  If we use the example of a
communications protocol,  the current state could be IDLE state,
i.e., meaning that no session is established yet.  Events from the
outside will affect the problem and change the state.  Thus, a
communications protocol instance may pick up from the communications
link a message containing a request for session establishment.

      The application program implementing the communications
protocol passes to the previously created FSM object both of the
invocation parameters:

o   Current State (IDLE)

o   Event (Connect Request)

The FSM object scans the state table for entries matching the
invocation parameters.  When the object finds such an entry, it
invokes a predicate function which evaluates certain conditions.  For
this purpose, the third field of each table entry contain...