Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/google/statechart
C++ StateChart Library
https://github.com/google/statechart
cpp scxml state-machine statechart
Last synced: 2 months ago
JSON representation
C++ StateChart Library
- Host: GitHub
- URL: https://github.com/google/statechart
- Owner: google
- License: apache-2.0
- Archived: true
- Created: 2018-05-01T19:55:57.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-10T01:34:09.000Z (about 5 years ago)
- Last Synced: 2024-08-03T12:01:23.381Z (6 months ago)
- Topics: cpp, scxml, state-machine, statechart
- Language: C++
- Homepage:
- Size: 212 KB
- Stars: 116
- Watchers: 10
- Forks: 35
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-code-for-gamedev - google/statechart - C++ StateChart Library (Objects - Entity, Actor / Finite State Machine)
README
# C++ StateChart Library
StateCharts [(Harel, 1987)](ref1) is a visual formalism for declarative
description of complex interactive systems.
It extends the conventional state machine formalism with Hierarchy, Concurrency
and Communication.[SCXML](https://www.w3.org/TR/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](statechart/example/microwave_statechart.svg "Microwave StateChart")
You can see [//statechart/example/microwave_example_main.cc](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](https://www.bazel.build/).
```
# 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](https://www.sciencedirect.com/science/article/pii/0167642387900359)
* State Chart XML (SCXML): State Machine Notation for Control Abstraction.
[Link](https://www.w3.org/TR/scxml/)