C++ YASMIN (Yet Another State MachINe)
|
Represents the "Foo" state in the state machine. More...
Public Member Functions | |
FooState () | |
Constructs a FooState object, initializing the counter. | |
std::string | execute (std::shared_ptr< yasmin::blackboard::Blackboard > blackboard) override |
Executes the Foo state logic. | |
Public Member Functions inherited from yasmin::State | |
State (std::set< std::string > outcomes) | |
Constructs a State with a set of possible outcomes. | |
std::string | operator() (std::shared_ptr< blackboard::Blackboard > blackboard) |
Executes the state and returns the outcome. | |
virtual void | cancel_state () |
Cancels the current state execution. | |
bool | is_canceled () const |
Checks if the state has been canceled. | |
bool | is_running () const |
Checks if the state is currently running. | |
std::set< std::string > const & | get_outcomes () |
Gets the set of possible outcomes for this state. | |
virtual std::string | to_string () |
Converts the state to a string representation. | |
Public Attributes | |
int | counter |
Counter to track the number of executions. | |
Additional Inherited Members | |
Protected Attributes inherited from yasmin::State | |
std::set< std::string > | outcomes |
The possible outcomes of this state. | |
Represents the "Foo" state in the state machine.
This state increments a counter each time it is executed and communicates the current count via the blackboard.
|
inline |
Constructs a FooState object, initializing the counter.
|
inlineoverridevirtual |
Executes the Foo state logic.
This method logs the execution, waits for 3 seconds, increments the counter, and sets a string in the blackboard. The state will transition to either "outcome1" or "outcome2" based on the current value of the counter.
blackboard | Shared pointer to the blackboard for state communication. |
Reimplemented from yasmin::State.
int FooState::counter |
Counter to track the number of executions.