United Statesgoogle/statechart
C++ StateChart Library
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.
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
Similar Projects
Discover other similar projects and AI models.
ScxmlEditor - powerful tool for creating, editing and debugging scxml files
QP/C Real-Time Event Framework/RTOS implements event-driven Active Object (Actor) model combined with Hierarchical State Machines. Specifically designed for embedded systems (e.g., ARM Cortex-M MCUs).
Firecrawl is the knowledge infrastructure to make your agents smarter. It connects your agents to the web, and to Alexandria, our library of everything else.