
OO Finite State Machine Language
Quote:
>Hello,
>Does anyone know where I can find work that has been done on the definition
of
>finite state machines?
Having scanned for this info before, it seems there are three schools of
thought here:
global boolean variables and lots of 'if' statements
An FSM class set as described in the book /Object Lifecycles : Modeling
the World in States/ by Sally Shlaer and Stephen J. Mellor
CASE tools that manage FSMs as project requirements and write code that
follows them.
I (and probably Ed) would appreciate any additions to this list, especially
clarifications on the third topic. The first needs no introduction.
The heart of the second approach is a Transistion Map, where the key is the
combination of a current state and an input event ID, and the output is a
new state. I'v defined one like this:
typedef ::std::pair< clsStateBase *, int >
transit;
typedef ::std::map< transit, clsStateBase * >
clxTransition_t;
'clsStateBase' is a protocol class that you derive states from. States are
objects. The 'int' is the input event ID. When an event arrives you build a
'transit' out of its ID and the current state, and you fetch the new state
from the map.
-- Phlip
======= http://users.deltanet.com/~tegan/home.html =======
-- 22 August 1997 - Ashley said "Dilbert" for the first time --