Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "statemachine.hpp"
- using namespace std;
- int main()
- {
- cout << "State machine" << endl;
- StateMachine stateMachine;
- // Add states
- stateMachine.addState("idle");
- stateMachine.addState("processing");
- // Add actions
- stateMachine.addAction("ready");
- // Set transitions
- stateMachine.addTransition("idle", "ready", "processing");
- // Set start state
- stateMachine.setStartState("idle");
- // Use state machine
- std::cout << stateMachine.getCurrentState() << "\n";
- stateMachine.processAction("ready");
- std::cout << stateMachine.getCurrentState() << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement