Skip to content

google/statechart

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
May 2, 2018
May 2, 2018

C++ StateChart Library

StateCharts (Harel, 1987) is a visual formalism for declarative description of complex interactive systems. It extends the conventional state machine formalism with Hierarchy, Concurrency and Communication.

SCXML is a W3C standard based on StateCharts. This is a C++ library that implements the SCXML specification. Instead of XML, a StateChart is represented as a StateChart protobuf.

Features

Many features from the SCXML standard have been implemented.

  • Composite State
  • Parallel State
  • Datamodel
  • Transitions (Conditional, Eventless)
  • Executable Statements (Raise, Log, Assign, If, ForEach, Send)
  • Serialize/Deserialize the state machine

TODO

  • History

Example

Here's an example of a StateChart that describes a Microwave.

Microwave StateChart

You can see //statechart/example/microwave_example_main.cc for details on how to specify such a StateChart as a StateChart proto and how to use it in code.

Usage

To build the library you'll need bazel. You can download and install it from here.

# Download/Clone the repo.
git clone https://github.com/google/statechart.git
cd statechart

# Build the library
bazel build //statechart/...

# Run unit tests
bazel test //statechart/...

# Run the Microwave example
bazel run //statechart/example:microwave_example_main -- --alsologtostderr

Disclaimer

This is not an officially supported Google product.

References

  • David Harel, 1987, Statecharts: a visual formalism for complex systems, Science of Computer Programming. Link
  • State Chart XML (SCXML): State Machine Notation for Control Abstraction. Link

About

C++ StateChart Library

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published