Elma
An event loop manager for embedded systems
|
States for the StateMachine class. More...
#include <state.h>
Public Member Functions | |
State () | |
Construct an unnamed State. | |
State (std::string name) | |
Construct a state with the given name. | |
std::string | name () |
int | id () |
virtual void | entry (const Event &e)=0 |
virtual void | during ()=0 |
virtual void | exit (const Event &e)=0 |
void | emit (const Event &e) |
StateMachine & | state_machine () |
Friends | |
class | StateMachine |
States for the StateMachine class.
States are used with the StateMachine class. For example usage, see the documentation for that class.
|
pure virtual |
A method that derived instances should define. It is called repeatedly by the update() method of the containing StateMachine when the state is active.
Implemented in microwave_example::DoorOpen, microwave_example::DoorClosedOn, microwave_example::DoorClosedOff, and toggle_switch_example::Mode.
void elma::State::emit | ( | const Event & | e | ) |
|
pure virtual |
A method that derived instances should define. It is called when the state is entered by the state machine either when the machine starts or when a transition to the state is fired.
e | The event that led to the transition into the state |
Implemented in microwave_example::DoorOpen, microwave_example::DoorClosedOn, microwave_example::DoorClosedOff, and toggle_switch_example::Mode.
|
pure virtual |
A method that derived instances should define. It is called just before the state is exited by the state machine when a transition from the state is fired.
e | The event that led to the transition out of the state |
Implemented in microwave_example::DoorOpen, microwave_example::DoorClosedOn, microwave_example::DoorClosedOff, and toggle_switch_example::Mode.
|
inline |
|
inline |
|
inline |