You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Copyright Andrew Shuvalov, MIT [License](https://github.com/shuvalov-mdb/xstate-cpp-generator/blob/master/LICENSE)
8
9
9
10
## Features
10
11
11
12
* Design and test the State Machine in [Xstate](https://github.com/davidkpiano/xstate) and then convert to C++ without any changes
12
13
* Use the [online vizualizer](https://xstate.js.org/viz/) to debug the State Machine
13
-
* SM basics: [States](https://xstate.js.org/docs/guides/states.html), [Events](https://xstate.js.org/docs/guides/events.html), [Transitions](https://xstate.js.org/docs/guides/transitions.html)
14
+
* SM basic features supported: [States](https://xstate.js.org/docs/guides/states.html), [Events](https://xstate.js.org/docs/guides/events.html), [Transitions](https://xstate.js.org/docs/guides/transitions.html)
15
+
* SM extra features supported: [Actions](https://xstate.js.org/docs/guides/actions.html#declarative-actions)
14
16
* Generated C++ is fully synchronized, safe to use in multi-threaded environemnt without any changes
15
-
* No exteral dependencies except STL. No boost dependency.
16
-
* Callback model based on subclassing and virtual methods
17
-
* Callbacks are invoked when: leaving a state, entering a state, after entering a state
17
+
* No external dependencies except STL. No boost dependency.
18
+
* Callback model:
19
+
* Entry, Exit and Trasition [Actions](https://xstate.js.org/docs/guides/actions.html#declarative-actions) are code
20
+
generated as static methods in the template object used to declare the State Machine and can be implemented by the user
21
+
* Every state and transtion callbacks are generated as virtual methods that can be overloaded by subclassing
18
22
* Arbitrary user-defined data structure (called Context) can be stored in the SM
19
23
* Any event can have an arbitrary user-defined payload attached. The event payload is propagated to related callbacks
20
24
21
25
## Install and Quick Start Tutorial
22
26
23
-
Install the xstate-cpp-generator TypeScript package, locally (or globally with `-g` option):
27
+
### 1. Install the xstate-cpp-generator TypeScript package, locally (or globally with `-g` option):
24
28
25
29
```bash
26
30
npm install xstate-cpp-generator
27
31
```
28
-
Create a simple Xstate model file `ping.ts` with few lines to trigger C++ generation at the end:
32
+
### 2. Create a simple Xstate model file `engineer.ts` with few lines to trigger C++ generation at the end:
33
+
(this example is located at https://github.com/shuvalov-mdb/xstate-cpp-generator/tree/master/demo-project)
0 commit comments