MCPcopy Create free account
hub / github.com/digint/tinyfsm / main

Function main

examples/api/simple_switch.cpp:60–85  ·  view source on GitHub ↗

---------------------------------------------------------------------------- Main

Source from the content-addressed store, hash-verified

58// Main
59//
60int main()
61{
62 // instantiate events
63 Toggle toggle;
64
65 fsm_handle::start();
66
67 while(1)
68 {
69 char c;
70 std::cout << std::endl << "t=Toggle, q=Quit ? ";
71 std::cin >> c;
72 switch(c) {
73 case 't':
74 std::cout << "> Toggling switch..." << std::endl;
75 fsm_handle::dispatch(toggle);
76 // alternative: instantiating causes no overhead (empty declaration)
77 //fsm_handle::dispatch(Toggle());
78 break;
79 case 'q':
80 return 0;
81 default:
82 std::cout << "> Invalid input" << std::endl;
83 };
84 }
85}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected