65.9K
CodeProject is changing. Read more.
Home

StateProto Beta - State Chart Designer for Qf4Net

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.27/5 (5 votes)

Jul 5, 2006

2 min read

viewsIcon

34185

downloadIcon

1185

Drawing state diagrams, and C# code generation for the modified QF4Net.

StateProto

Introduction

StateProto is a .NET application that provides a design surface on which you can draw State Diagrams. If the diagram is sufficiently detailed, then it becomes possible to generate C# code to run against the QF4Net State Engine.

Background

Qf4net is a C#/.NET port by Dr. Rainer Hessmer of the Quantum Hierarchichal State Machine Framework by Miro Samek.

Both of these frameworks are mainly the core State Machine execution engines. The advantage of the Quantum based frameworks is that they implement a Method-Per-State State Machine architecture which keeps the required boiler plate code both to a minimum and understandable. Even for this understandability, it still takes effort to write up the code manually, which led me to search for a diagramming tool. While a number of tools do already exist, I found that each required quite a bit of work to do the code generation and to work in a way that made sense to me. And thus, as a typical developer, I decided to write one myself.

There is still much to do with regards to multiple state machine interactions, etcetera, but the application is demo-able for single state machine implementations.

Using the code

Included in the downloads above is a code sample that can be found in StateProto_WatchSample_Demo.zip. If you extract this file, you will find a directory tree rooted at Hsm. In there, you will find the current version of the StateProto.exe. Also, the sample code for a Watch Demo is in Samples/SampleWatch, with the full state machine file in Samples/SampleWatch_b.sm1.

Hsm/bin/debug contains a precompiled release of SampleWatch.exe. Run it, click on "Create Watch", and then click on "SetEvt" a couple of times. When you're bored, click on "ModeEvt" to see what it does differently.

Watch Demo

Points of interest

The diagram displays states with a different colour at each nesting level. Big items still to work on are undo/redo and a graphical tree layout algorithm.

History

The first beta release with the Watch Sample, white paper and the Watch Sample documentation.

References