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

Class Switch

examples/api/mealy_machine.cpp:13–25  ·  view source on GitHub ↗

---------------------------------------------------------------------------- 2. State Machine Base Class Declaration

Source from the content-addressed store, hash-verified

11// 2. State Machine Base Class Declaration
12//
13struct Switch : tinyfsm::MealyMachine<Switch>
14{
15 /* pure virtual reaction (override required in all states) */
16 virtual void react(Toggle const &) = 0;
17
18 /* transition actions */
19 static void OpenCircuit() {
20 std::cout << "* Opening ciruit (light goes OFF)" << std::endl;
21 }
22 static void CloseCircuit() {
23 std::cout << "* Closing ciruit (light goes ON)" << std::endl;
24 }
25};
26
27
28// ----------------------------------------------------------------------------

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected