Class FooState

Inheritance Relationships

Base Type

  • public yasmin::State

Class Documentation

class FooState : public yasmin::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.

Public Functions

FooState()

Constructs a FooState object, initializing the counter.

~FooState()

Destructs the FooState object.

std::string execute(std::shared_ptr<yasmin::Blackboard> blackboard)

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.

Parameters:

blackboard – Shared pointer to the blackboard for state communication.

Returns:

std::string The outcome of the execution: “outcome1” or “outcome2”.

Public Members

int counter

Counter to track the number of executions.